-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(solana)!: enable calling SetConfig without sending the transaction #310
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 183448a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This PR enables clients to call SetConfig() without sending the instructions to the blockchain. Its purpose is to retrieve the instructions that _would_ be sent -- to, for instance, use this instructions to build an mcms proposal. The instructions are returned in the `TransactionResult` object, in the `RawTransaction` attribute. In order to "activate" this mode, clients must set leave the authority private key as `nil` *and* specify the signer account in the `instructionAuth` parameter. Existing clients (who still want to send the instructions onchain) are also affected as we had to introduce a new parameter to the Configurer constructor (`instructionAuth`). Examples: ```go // send instructions on-chain result, err := NewConfigurer(client, auth, solana.PublicKey{}, chainSelector).SetConfig() assert.True(t, solana.IsSignature(result.Hash)) assert.GreaterOrEqual(t, len(result.RawTransaction.([]solana.Instruction)), 4) ``` ```go // do NOT send instructions on-chain result, err := NewConfigurer(client, auth, solana.PublicKey{}, chainSelector).SetConfig() assert.Equal(t, result.Hash, "") assert.GreaterOrEqual(t, len(result.RawTransaction.([]solana.Instruction)), 4) ``` !BREAKING CHANGE!
…breaking the contract
419ea25
to
3bbdf4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you said, elegant api is the challenge here
d96b908
to
9551439
Compare
|
This PR enables clients to call SetConfig() without sending the instructions to the blockchain. Its purpose is to retrieve the instructions that would be sent -- to, for instance, use this instructions to build an mcms proposal. The instructions are returned in the
TransactionResult
object, in theRawData
attribute (which used to be calledRawTransaction
and was renamed to reflect the fact it can hold other arbitrary types).In order to "activate" this mode, clients must set the optional argument
SkipTransaction
. For instance:BREAKING_CHANGE:
RawTransaction
renamed toRawData