diff --git a/go.mod b/go.mod index 0ae44b0..62a3bc7 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/0xjeffro/tx-parser go 1.19 require ( + github.com/gagliardetto/solana-go v1.11.0 github.com/gin-gonic/gin v1.10.0 github.com/mr-tron/base58 v1.2.0 github.com/near/borsh-go v0.3.1 @@ -10,31 +11,47 @@ require ( ) require ( + filippo.io/edwards25519 v1.0.0-rc.1 // indirect + github.com/blendle/zapdriver v1.3.1 // indirect github.com/bytedance/sonic v1.11.6 // indirect github.com/bytedance/sonic/loader v0.1.1 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fatih/color v1.9.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gagliardetto/binary v0.8.0 // indirect + github.com/gagliardetto/treeout v0.1.4 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.20.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.13.6 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/leodido/go-urn v1.4.0 // indirect + github.com/logrusorgru/aurora v2.0.3+incompatible // indirect + github.com/mattn/go-colorable v0.1.4 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect + go.mongodb.org/mongo-driver v1.11.0 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/multierr v1.6.0 // indirect + go.uber.org/zap v1.21.0 // indirect golang.org/x/arch v0.8.0 // indirect golang.org/x/crypto v0.23.0 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect + golang.org/x/term v0.20.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 7334443..a2d5f17 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,9 @@ +filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= +filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/blendle/zapdriver v1.3.1 h1:C3dydBOWYRiOk+B8X9IVZ5IOe+7cl+tGOexN4QqHfpE= +github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox4J2u4eHCc= github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= @@ -9,8 +15,16 @@ github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gagliardetto/binary v0.8.0 h1:U9ahc45v9HW0d15LoN++vIXSJyqR/pWw8DDlhd7zvxg= +github.com/gagliardetto/binary v0.8.0/go.mod h1:2tfj51g5o9dnvsc+fL3Jxr22MuWzYXwx9wEoN0XQ7/c= +github.com/gagliardetto/solana-go v1.11.0 h1:g6mR7uRNVT0Y0LVR0bvJNfKV6TyO6oUzBYu03ZmkEmY= +github.com/gagliardetto/solana-go v1.11.0/go.mod h1:afBEcIRrDLJst3lvAahTr63m6W2Ns6dajZxe2irF7Jg= +github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw= +github.com/gagliardetto/treeout v0.1.4/go.mod h1:loUefvXTrlRG5rYmJmExNryyBRh8f89VZhmMOyCyqok= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= @@ -24,36 +38,66 @@ github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBEx github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= +github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 h1:mPMvm6X6tf4w8y7j9YIt6V9jfWhL6QlbEc7CCmeQlWk= +github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1/go.mod h1:ye2e/VUEtE2BHE+G/QcKkcLQVAEJoYRFj5VUOQatCRE= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/near/borsh-go v0.3.1 h1:ukNbhJlPKxfua0/nIuMZhggSU8zvtRP/VyC25LLqPUA= github.com/near/borsh-go v0.3.1/go.mod h1:NeMochZp7jN/pYFuxLkrZtmLqbADmnp/y1+/dL+AsyQ= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 h1:RN5mrigyirb8anBEtdjtHFIufXdacyTi6i4KBfeNXeo= +github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091/go.mod h1:VlduQ80JcGJSargkRU4Sg9Xo63wZD/l8A5NC/Uo1/uU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -61,29 +105,93 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= +github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.mongodb.org/mongo-driver v1.11.0 h1:FZKhBSTydeuffHj9CBjXlR8vQLee1cQyTWYPA6/tqiE= +go.mongodb.org/mongo-driver v1.11.0/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= +go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= diff --git a/solana/parser_test.go b/solana/parser_test.go index fa43e88..999eb45 100644 --- a/solana/parser_test.go +++ b/solana/parser_test.go @@ -15,24 +15,26 @@ import ( "testing" ) -func TestBrokenData_0(t *testing.T) { - jsonFile, err := os.Open("data/broken_data_0.json") +func readJsonFile(filename string) ([]byte, error) { + jsonFile, err := os.Open(filename) if err != nil { - t.Errorf("Error opening JSON file: %v", err) + return nil, err } defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + return ioutil.ReadAll(jsonFile) +} + +func TestBrokenData_0(t *testing.T) { + byteValue, err := readJsonFile("data/broken_data_0.json") _, err = Parser(byteValue) assert.NotEqual(t, err, nil) } func TestBrokenData_1(t *testing.T) { - jsonFile, err := os.Open("data/broken_data_1.json") + byteValue, err := readJsonFile("data/broken_data_1.json") if err != nil { - t.Errorf("Error opening JSON file: %v", err) + t.Errorf("Error reading JSON file: %v", err) } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) results, err := Parser(byteValue) assert.Equal(t, results[0].Actions[0].GetProgramID(), "Unknown") assert.Equal(t, results[0].Actions[0].GetProgramName(), "Unknown") @@ -41,15 +43,10 @@ func TestBrokenData_1(t *testing.T) { } func TestPumpFunSell_0(t *testing.T) { - jsonFile, err := os.Open("data/pumpfun_sell_0.json") + byteValue, err := readJsonFile("data/pumpfun_sell_0.json") if err != nil { t.Errorf("Error opening JSON file: %v", err) } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) - if err != nil { - t.Errorf("Error reading JSON file: %v", err) - } results, _ := Parser(byteValue) action := results[0].Actions[3] if sellAction, ok := action.(*types.PumpFunSellAction); ok { @@ -67,12 +64,7 @@ func TestPumpFunSell_0(t *testing.T) { } func TestPumpFunBuy_0(t *testing.T) { - jsonFile, err := os.Open("data/pumpfun_buy_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/pumpfun_buy_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -94,12 +86,7 @@ func TestPumpFunBuy_0(t *testing.T) { } func TestPumpFunBuy_1(t *testing.T) { - jsonFile, err := os.Open("data/pumpfun_buy_1.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/pumpfun_buy_1.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -121,12 +108,7 @@ func TestPumpFunBuy_1(t *testing.T) { } func TestPumpFunCreate_0(t *testing.T) { - jsonFile, err := os.Open("data/pumpfun_create_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/pumpfun_create_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -152,12 +134,7 @@ func TestPumpFunCreate_0(t *testing.T) { } func TestComputeBudgetSetComputeUnitLimit(t *testing.T) { - jsonFile, err := os.Open("data/pumpfun_sell_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/pumpfun_sell_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -174,12 +151,7 @@ func TestComputeBudgetSetComputeUnitLimit(t *testing.T) { } func TestComputeBudgetSetComputeUnitPrice(t *testing.T) { - jsonFile, err := os.Open("data/pumpfun_sell_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/pumpfun_sell_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -196,12 +168,7 @@ func TestComputeBudgetSetComputeUnitPrice(t *testing.T) { } func TestSystemProgramTransfer(t *testing.T) { - jsonFile, err := os.Open("data/pumpfun_sell_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/pumpfun_sell_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -219,13 +186,31 @@ func TestSystemProgramTransfer(t *testing.T) { } } -func TestTokenProgramTransfer(t *testing.T) { - jsonFile, err := os.Open("data/token_transfer_0.json") +func TestSystemProgramCreateAccountWithSeed(t *testing.T) { + byteValue, err := readJsonFile("data/raydiumLiquidityPoolV4_swap_0.json") if err != nil { - t.Errorf("Error opening JSON file: %v", err) + t.Errorf("Error reading JSON file: %v", err) } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + results, _ := Parser(byteValue) + action := results[0].Actions[2] + if transferAction, ok := action.(*types.SystemProgramCreateAccountWithSeedAction); ok { + assert.Equal(t, transferAction.ProgramID, systemProgram.Program) + assert.Equal(t, transferAction.ProgramName, systemProgram.ProgramName) + assert.Equal(t, transferAction.InstructionName, "CreateAccountWithSeed") + assert.Equal(t, transferAction.Who, "Do3UdALe5F7NRXB4uYcBzZtCbAt8ssu4a5kGZVucKhC5") + assert.Equal(t, transferAction.NewAccount, "AgcEC7E1yxeZoRVnAZTmGA86ncrPTqKkBiz1T9F5MxhN") + assert.Equal(t, transferAction.Base, "Do3UdALe5F7NRXB4uYcBzZtCbAt8ssu4a5kGZVucKhC5") + assert.Equal(t, transferAction.Seed, "5PwC7hE3bfVrXbgN21qYnjizph1NWo7g") + assert.Equal(t, transferAction.Lamports, uint64(2039280)) + assert.Equal(t, transferAction.Space, uint64(165)) + assert.Equal(t, transferAction.Owner, "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA") + } else { + t.Errorf("Error type assertion") + } +} + +func TestTokenProgramTransfer(t *testing.T) { + byteValue, err := readJsonFile("data/token_transfer_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -245,12 +230,7 @@ func TestTokenProgramTransfer(t *testing.T) { } func TestTokenProgramTransferChecked(t *testing.T) { - jsonFile, err := os.Open("data/transferChecked_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/transferChecked_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -272,12 +252,7 @@ func TestTokenProgramTransferChecked(t *testing.T) { } func TestTokenProgramInitializeAccount(t *testing.T) { - jsonFile, err := os.Open("data/raydiumLiquidityPoolV4_swap_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/raydiumLiquidityPoolV4_swap_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -298,12 +273,7 @@ func TestTokenProgramInitializeAccount(t *testing.T) { } func TestU6m2CDdhRgSwap(t *testing.T) { - jsonFile, err := os.Open("data/U6m2CDdhRg_swap_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/U6m2CDdhRg_swap_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -326,12 +296,7 @@ func TestU6m2CDdhRgSwap(t *testing.T) { } func TestU6m2CDdhRgSwap1(t *testing.T) { - jsonFile, err := os.Open("data/U6m2CDdhRg_swap_1.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/U6m2CDdhRg_swap_1.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -354,12 +319,7 @@ func TestU6m2CDdhRgSwap1(t *testing.T) { } func TestJupiterDcaOpenDcaV2_0(t *testing.T) { - jsonFile, err := os.Open("data/jupiterDca_openDcaV2_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/jupiterDca_openDcaV2_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -389,12 +349,7 @@ func TestJupiterDcaOpenDcaV2_0(t *testing.T) { } func TestJupiterDcaOpenDcaV2_1(t *testing.T) { - jsonFile, err := os.Open("data/jupiterDca_openDcaV2_1.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/jupiterDca_openDcaV2_1.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -424,12 +379,7 @@ func TestJupiterDcaOpenDcaV2_1(t *testing.T) { } func TestJupiterDcaEndAndClose_0(t *testing.T) { - jsonFile, err := os.Open("data/jupiterDca_endAndClose_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/jupiterDca_endAndClose_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -453,12 +403,7 @@ func TestJupiterDcaEndAndClose_0(t *testing.T) { } func TestJupiterDcaEndAndClose_1(t *testing.T) { - jsonFile, err := os.Open("data/jupiterDca_endAndClose_1.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/jupiterDca_endAndClose_1.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } @@ -482,12 +427,7 @@ func TestJupiterDcaEndAndClose_1(t *testing.T) { } func TestJupiterDcaCloseDca_0(t *testing.T) { - jsonFile, err := os.Open("data/jupiterDca_CloseDca_0.json") - if err != nil { - t.Errorf("Error opening JSON file: %v", err) - } - defer jsonFile.Close() - byteValue, err := ioutil.ReadAll(jsonFile) + byteValue, err := readJsonFile("data/jupiterDca_CloseDca_0.json") if err != nil { t.Errorf("Error reading JSON file: %v", err) } diff --git a/solana/programs/systemProgram/meta.go b/solana/programs/systemProgram/meta.go index 3708e1b..20430d6 100644 --- a/solana/programs/systemProgram/meta.go +++ b/solana/programs/systemProgram/meta.go @@ -4,3 +4,4 @@ const Program = "11111111111111111111111111111111" const ProgramName = "System Program" var TransferDiscriminator = uint32(2) +var CreateAccountWithSeedDiscriminator = uint32(3) diff --git a/solana/programs/systemProgram/parsers/createAccountWithSeed.go b/solana/programs/systemProgram/parsers/createAccountWithSeed.go new file mode 100644 index 0000000..5674ca0 --- /dev/null +++ b/solana/programs/systemProgram/parsers/createAccountWithSeed.go @@ -0,0 +1,34 @@ +package parsers + +import ( + "encoding/binary" + "github.com/0xjeffro/tx-parser/solana/programs/systemProgram" + "github.com/0xjeffro/tx-parser/solana/types" + solanago "github.com/gagliardetto/solana-go" +) + +func CreateAccountWithSeedParser(result *types.ParsedResult, instruction types.Instruction, decodedData []byte) (*types.SystemProgramCreateAccountWithSeedAction, error) { + basePubKey := solanago.PublicKeyFromBytes(decodedData[4:36]) + seedLength := binary.LittleEndian.Uint64(decodedData[36:44]) + seed := string(decodedData[44 : 44+seedLength]) + lamports := binary.LittleEndian.Uint64(decodedData[44+seedLength : 44+seedLength+8]) + space := binary.LittleEndian.Uint64(decodedData[44+seedLength+8 : 44+seedLength+16]) + ownerPubKey := solanago.PublicKeyFromBytes(decodedData[44+seedLength+16 : 44+seedLength+16+32]) + + action := types.SystemProgramCreateAccountWithSeedAction{ + BaseAction: types.BaseAction{ + ProgramID: result.AccountList[instruction.ProgramIDIndex], + ProgramName: systemProgram.ProgramName, + InstructionName: "CreateAccountWithSeed", + }, + Who: result.AccountList[instruction.Accounts[0]], + NewAccount: result.AccountList[instruction.Accounts[1]], + Base: basePubKey.String(), + Seed: seed, + Lamports: lamports, + Space: space, + Owner: ownerPubKey.String(), + } + + return &action, nil +} diff --git a/solana/programs/systemProgram/parsers/index.go b/solana/programs/systemProgram/parsers/index.go index 77e1ccb..fd4b945 100644 --- a/solana/programs/systemProgram/parsers/index.go +++ b/solana/programs/systemProgram/parsers/index.go @@ -13,11 +13,13 @@ func InstructionRouter(result *types.ParsedResult, instruction types.Instruction if err != nil { return nil, err } - discriminator := binary.LittleEndian.Uint32(decode[:4]) + discriminator := binary.LittleEndian.Uint32(decode[0:4]) switch discriminator { case systemProgram.TransferDiscriminator: return TransferParser(result, instruction, decode) + case systemProgram.CreateAccountWithSeedDiscriminator: + return CreateAccountWithSeedParser(result, instruction, decode) default: return types.UnknownAction{ BaseAction: types.BaseAction{ diff --git a/solana/types/systemProgramAction.go b/solana/types/systemProgramAction.go index 0adddd4..2f56515 100644 --- a/solana/types/systemProgramAction.go +++ b/solana/types/systemProgramAction.go @@ -6,3 +6,14 @@ type SystemProgramTransferAction struct { To string `json:"to"` Lamports uint64 `json:"lamports"` } + +type SystemProgramCreateAccountWithSeedAction struct { + BaseAction + Who string `json:"who"` + NewAccount string `json:"newAccount"` + Base string `json:"base"` + Seed string `json:"seed"` + Lamports uint64 `json:"lamports"` + Space uint64 `json:"space"` + Owner string `json:"owner"` +}