Skip to content

Commit

Permalink
parse
Browse files Browse the repository at this point in the history
  • Loading branch information
imerkle committed Jul 15, 2021
1 parent 3d46c07 commit c6b44e9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions assotokenprog/parse.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package assotokenprog

import "github.com/portto/solana-go-sdk/types"

func ParseAssocToken(ins types.Instruction) (types.ParsedInstruction, error) {
var parsedInstruction types.ParsedInstruction
var err error
instructionType := "create"
parsedInfo := map[string]interface{}{
"source": ins.Accounts[0].PubKey.ToBase58(),
"account": ins.Accounts[1].PubKey.ToBase58(),
"wallet": ins.Accounts[2].PubKey.ToBase58(),
"mint": ins.Accounts[3].PubKey.ToBase58(),
"systemProgram": ins.Accounts[4].PubKey.ToBase58(),
"tokenProgram": ins.Accounts[5].PubKey.ToBase58(),
"rentSysvar": ins.Accounts[6].PubKey.ToBase58(),
}
parsedInstruction.Parsed = &types.InstructionInfo{
Info: parsedInfo,
InstructionType: instructionType,
}
return parsedInstruction, err
}

0 comments on commit c6b44e9

Please sign in to comment.