gagliardetto / anchor-go

Generate Go clients from anchor IDLs for Solana blockchain programs
MIT License
138 stars 31 forks source link

panic: interface conversion: interface {} is string, not map[string]interface {} #19

Open gummy789j opened 4 months ago

gummy789j commented 4 months ago

Anyone encounter the problem like this ?

anchor-go --src=./internal/wrapper/solanaclient/.json-instruction/drift_v2.json  --dst=./internal/wrapper/solanaclient/generated
[+] Generating client from IDL: ./internal/wrapper/solanaclient/.json-instruction/drift_v2.json
panic: interface conversion: interface {} is string, not map[string]interface {}

goroutine 1 [running]:
main.(*IdlEnumFields).UnmarshalJSON(0x1400049b810, {0x1400035c666, 0x22, 0x1379a})
        /Users/steven/go/pkg/mod/github.com/gagliardetto/anchor-go@v0.3.1/idl.go:472 +0x21c
encoding/json.(*decodeState).array(0x1400014f568, {0x10104d660?, 0x14000456f28?, 0x137bf?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:507 +0x3ec
encoding/json.(*decodeState).value(0x1400014f568, {0x10104d660?, 0x14000456f28?, 0x6?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:364 +0x70
encoding/json.(*decodeState).object(0x1400014f568, {0x101087fc0?, 0x14000456f00?, 0x100b34a04?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:775 +0xb34
encoding/json.(*decodeState).value(0x1400014f568, {0x101087fc0?, 0x14000456f00?, 0x1?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:374 +0x40
encoding/json.(*decodeState).array(0x1400014f568, {0x1010602a0?, 0x140004770a8?, 0x137fd?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:562 +0x588
encoding/json.(*decodeState).value(0x1400014f568, {0x1010602a0?, 0x140004770a8?, 0x8?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:364 +0x70
encoding/json.(*decodeState).object(0x1400014f568, {0x1010882c0?, 0x14000477090?, 0x1382e?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:775 +0xb34
encoding/json.(*decodeState).value(0x1400014f568, {0x1010882c0?, 0x14000477090?, 0x4?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:374 +0x40
encoding/json.(*decodeState).object(0x1400014f568, {0x1010795a0?, 0x14000477080?, 0x100b34a04?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:775 +0xb34
encoding/json.(*decodeState).value(0x1400014f568, {0x1010795a0?, 0x14000477080?, 0x1b?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:374 +0x40
encoding/json.(*decodeState).array(0x1400014f568, {0x101052a00?, 0x1400024c230?, 0x3fddd?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:562 +0x588
encoding/json.(*decodeState).value(0x1400014f568, {0x101052a00?, 0x1400024c230?, 0x5?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:364 +0x70
encoding/json.(*decodeState).object(0x1400014f568, {0x10104d600?, 0x1400024c1c0?, 0x100b44edc?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:775 +0xb34
encoding/json.(*decodeState).value(0x1400014f568, {0x10104d600?, 0x1400024c1c0?, 0x100b44b90?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:374 +0x40
encoding/json.(*decodeState).unmarshal(0x1400014f568, {0x10104d600?, 0x1400024c1c0?})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/decode.go:181 +0x184
encoding/json.(*Decoder).Decode(0x1400014f540, {0x10104d600, 0x1400024c1c0})
        /opt/homebrew/Cellar/go@1.20/1.20.10/libexec/src/encoding/json/stream.go:73 +0x130
main.main()
        /Users/steven/go/pkg/mod/github.com/gagliardetto/anchor-go@v0.3.1/main.go:100 +0x754
SC4RECOIN commented 3 weeks ago

saaaame