diff --git a/contracts/generated/contract_reader_interface/Initialize.go b/contracts/generated/contract_reader_interface/Initialize.go index 03e13f579..5525400f8 100644 --- a/contracts/generated/contract_reader_interface/Initialize.go +++ b/contracts/generated/contract_reader_interface/Initialize.go @@ -19,14 +19,18 @@ type Initialize struct { // // [1] = [WRITE] data // - // [2] = [] systemProgram + // [2] = [WRITE] multiRead1 + // + // [3] = [WRITE] multiRead2 + // + // [4] = [] systemProgram ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"` } // NewInitializeInstructionBuilder creates a new `Initialize` instruction builder. func NewInitializeInstructionBuilder() *Initialize { nd := &Initialize{ - AccountMetaSlice: make(ag_solanago.AccountMetaSlice, 3), + AccountMetaSlice: make(ag_solanago.AccountMetaSlice, 5), } return nd } @@ -65,15 +69,37 @@ func (inst *Initialize) GetDataAccount() *ag_solanago.AccountMeta { return inst.AccountMetaSlice[1] } +// SetMultiRead1Account sets the "multiRead1" account. +func (inst *Initialize) SetMultiRead1Account(multiRead1 ag_solanago.PublicKey) *Initialize { + inst.AccountMetaSlice[2] = ag_solanago.Meta(multiRead1).WRITE() + return inst +} + +// GetMultiRead1Account gets the "multiRead1" account. +func (inst *Initialize) GetMultiRead1Account() *ag_solanago.AccountMeta { + return inst.AccountMetaSlice[2] +} + +// SetMultiRead2Account sets the "multiRead2" account. +func (inst *Initialize) SetMultiRead2Account(multiRead2 ag_solanago.PublicKey) *Initialize { + inst.AccountMetaSlice[3] = ag_solanago.Meta(multiRead2).WRITE() + return inst +} + +// GetMultiRead2Account gets the "multiRead2" account. +func (inst *Initialize) GetMultiRead2Account() *ag_solanago.AccountMeta { + return inst.AccountMetaSlice[3] +} + // SetSystemProgramAccount sets the "systemProgram" account. func (inst *Initialize) SetSystemProgramAccount(systemProgram ag_solanago.PublicKey) *Initialize { - inst.AccountMetaSlice[2] = ag_solanago.Meta(systemProgram) + inst.AccountMetaSlice[4] = ag_solanago.Meta(systemProgram) return inst } // GetSystemProgramAccount gets the "systemProgram" account. func (inst *Initialize) GetSystemProgramAccount() *ag_solanago.AccountMeta { - return inst.AccountMetaSlice[2] + return inst.AccountMetaSlice[4] } func (inst Initialize) Build() *Instruction { @@ -113,6 +139,12 @@ func (inst *Initialize) Validate() error { return errors.New("accounts.Data is not set") } if inst.AccountMetaSlice[2] == nil { + return errors.New("accounts.MultiRead1 is not set") + } + if inst.AccountMetaSlice[3] == nil { + return errors.New("accounts.MultiRead2 is not set") + } + if inst.AccountMetaSlice[4] == nil { return errors.New("accounts.SystemProgram is not set") } } @@ -134,10 +166,12 @@ func (inst *Initialize) EncodeToTree(parent ag_treeout.Branches) { }) // Accounts of the instruction: - instructionBranch.Child("Accounts[len=3]").ParentFunc(func(accountsBranch ag_treeout.Branches) { + instructionBranch.Child("Accounts[len=5]").ParentFunc(func(accountsBranch ag_treeout.Branches) { accountsBranch.Child(ag_format.Meta(" signer", inst.AccountMetaSlice[0])) accountsBranch.Child(ag_format.Meta(" data", inst.AccountMetaSlice[1])) - accountsBranch.Child(ag_format.Meta("systemProgram", inst.AccountMetaSlice[2])) + accountsBranch.Child(ag_format.Meta(" multiRead1", inst.AccountMetaSlice[2])) + accountsBranch.Child(ag_format.Meta(" multiRead2", inst.AccountMetaSlice[3])) + accountsBranch.Child(ag_format.Meta("systemProgram", inst.AccountMetaSlice[4])) }) }) }) @@ -178,11 +212,15 @@ func NewInitializeInstruction( // Accounts: signer ag_solanago.PublicKey, data ag_solanago.PublicKey, + multiRead1 ag_solanago.PublicKey, + multiRead2 ag_solanago.PublicKey, systemProgram ag_solanago.PublicKey) *Initialize { return NewInitializeInstructionBuilder(). SetTestIdx(testIdx). SetValue(value). SetSignerAccount(signer). SetDataAccount(data). + SetMultiRead1Account(multiRead1). + SetMultiRead2Account(multiRead2). SetSystemProgramAccount(systemProgram) } diff --git a/contracts/generated/contract_reader_interface/accounts.go b/contracts/generated/contract_reader_interface/accounts.go index 3a7197749..b314d90f2 100644 --- a/contracts/generated/contract_reader_interface/accounts.go +++ b/contracts/generated/contract_reader_interface/accounts.go @@ -353,3 +353,131 @@ func (obj *TestStruct) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err err } return nil } + +type MultiRead1 struct { + A uint8 + B int16 + C bool +} + +var MultiRead1Discriminator = [8]byte{15, 46, 242, 154, 22, 213, 170, 20} + +func (obj MultiRead1) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error) { + // Write account discriminator: + err = encoder.WriteBytes(MultiRead1Discriminator[:], false) + if err != nil { + return err + } + // Serialize `A` param: + err = encoder.Encode(obj.A) + if err != nil { + return err + } + // Serialize `B` param: + err = encoder.Encode(obj.B) + if err != nil { + return err + } + // Serialize `C` param: + err = encoder.Encode(obj.C) + if err != nil { + return err + } + return nil +} + +func (obj *MultiRead1) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error) { + // Read and check account discriminator: + { + discriminator, err := decoder.ReadTypeID() + if err != nil { + return err + } + if !discriminator.Equal(MultiRead1Discriminator[:]) { + return fmt.Errorf( + "wrong discriminator: wanted %s, got %s", + "[15 46 242 154 22 213 170 20]", + fmt.Sprint(discriminator[:])) + } + } + // Deserialize `A`: + err = decoder.Decode(&obj.A) + if err != nil { + return err + } + // Deserialize `B`: + err = decoder.Decode(&obj.B) + if err != nil { + return err + } + // Deserialize `C`: + err = decoder.Decode(&obj.C) + if err != nil { + return err + } + return nil +} + +type MultiRead2 struct { + U string + V bool + W [2]uint64 +} + +var MultiRead2Discriminator = [8]byte{17, 116, 102, 101, 239, 43, 252, 86} + +func (obj MultiRead2) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error) { + // Write account discriminator: + err = encoder.WriteBytes(MultiRead2Discriminator[:], false) + if err != nil { + return err + } + // Serialize `U` param: + err = encoder.Encode(obj.U) + if err != nil { + return err + } + // Serialize `V` param: + err = encoder.Encode(obj.V) + if err != nil { + return err + } + // Serialize `W` param: + err = encoder.Encode(obj.W) + if err != nil { + return err + } + return nil +} + +func (obj *MultiRead2) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error) { + // Read and check account discriminator: + { + discriminator, err := decoder.ReadTypeID() + if err != nil { + return err + } + if !discriminator.Equal(MultiRead2Discriminator[:]) { + return fmt.Errorf( + "wrong discriminator: wanted %s, got %s", + "[17 116 102 101 239 43 252 86]", + fmt.Sprint(discriminator[:])) + } + } + // Deserialize `U`: + err = decoder.Decode(&obj.U) + if err != nil { + return err + } + // Deserialize `V`: + err = decoder.Decode(&obj.V) + if err != nil { + return err + } + // Deserialize `W`: + err = decoder.Decode(&obj.W) + if err != nil { + return err + } + return nil +}