Skip to content

Commit bd495e2

Browse files
committed
solana: check in IDL
1 parent 3f45ce1 commit bd495e2

12 files changed

+7882
-11
lines changed

.github/workflows/solana.yml

+3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ jobs:
134134
- name: Setup SDK
135135
run: make sdk
136136
shell: bash
137+
- name: Check idl
138+
run: |
139+
git diff --exit-code idl
137140
- name: Run tests
138141
run: anchor test
139142
shell: bash

solana/Makefile

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
.PHONY: build
2-
build: _anchor-build target/idl/example_native_token_transfers.json
2+
build: _anchor-build target/idl/example_native_token_transfers.json idl
33

44
# remove the generics from the idl file. This is necessary as of anchor 0.29.0, because
55
# the javascript library does not support generics yet, and just panics
66
.PHONY: target/idl/example_native_token_transfers.json
7-
target/idl/example_native_token_transfers.json:
7+
target/idl/example_native_token_transfers.json: _anchor-build
88
@echo "Removing generics from $@"
99
@ ./scripts/patch-idl $@
1010

@@ -15,10 +15,17 @@ _anchor-build:
1515
anchor-test: node_modules build target/idl/example_native_token_transfers.json sdk
1616
anchor test --skip-build
1717

18-
sdk: build target/idl/example_native_token_transfers.json
18+
sdk: build
1919
@echo "Building SDK"
2020
cd ../sdk && npm ci && npm run build:solana
2121

22+
.PHONY: idl
23+
idl: target/idl/example_native_token_transfers.json
24+
@ mkdir -p $@/json
25+
@ mkdir -p $@/ts
26+
@ cp -r target/idl/* $@/json/
27+
@ cp -r target/types/* $@/ts/
28+
2229
node_modules: package-lock.json
2330
npm ci
2431

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"version": "0.1.0",
3+
"name": "dummy_transfer_hook",
4+
"instructions": [
5+
{
6+
"name": "initializeExtraAccountMetaList",
7+
"accounts": [
8+
{
9+
"name": "payer",
10+
"isMut": true,
11+
"isSigner": true
12+
},
13+
{
14+
"name": "extraAccountMetaList",
15+
"isMut": true,
16+
"isSigner": false
17+
},
18+
{
19+
"name": "mint",
20+
"isMut": false,
21+
"isSigner": false
22+
},
23+
{
24+
"name": "tokenProgram",
25+
"isMut": false,
26+
"isSigner": false
27+
},
28+
{
29+
"name": "associatedTokenProgram",
30+
"isMut": false,
31+
"isSigner": false
32+
},
33+
{
34+
"name": "counter",
35+
"isMut": true,
36+
"isSigner": false
37+
},
38+
{
39+
"name": "systemProgram",
40+
"isMut": false,
41+
"isSigner": false
42+
}
43+
],
44+
"args": []
45+
},
46+
{
47+
"name": "transferHook",
48+
"accounts": [
49+
{
50+
"name": "sourceToken",
51+
"isMut": false,
52+
"isSigner": false
53+
},
54+
{
55+
"name": "mint",
56+
"isMut": false,
57+
"isSigner": false
58+
},
59+
{
60+
"name": "destinationToken",
61+
"isMut": false,
62+
"isSigner": false
63+
},
64+
{
65+
"name": "authority",
66+
"isMut": false,
67+
"isSigner": false
68+
},
69+
{
70+
"name": "extraAccountMetaList",
71+
"isMut": false,
72+
"isSigner": false
73+
},
74+
{
75+
"name": "dummyAccount",
76+
"isMut": false,
77+
"isSigner": false,
78+
"docs": [
79+
"computes and the on-chain code correctly passes on the PDA."
80+
]
81+
},
82+
{
83+
"name": "counter",
84+
"isMut": true,
85+
"isSigner": false
86+
}
87+
],
88+
"args": [
89+
{
90+
"name": "amount",
91+
"type": "u64"
92+
}
93+
]
94+
}
95+
],
96+
"accounts": [
97+
{
98+
"name": "Counter",
99+
"type": {
100+
"kind": "struct",
101+
"fields": [
102+
{
103+
"name": "count",
104+
"type": "u64"
105+
}
106+
]
107+
}
108+
}
109+
],
110+
"metadata": {
111+
"address": "BgabMDLaxsyB7eGMBt9L22MSk9KMrL4zY2iNe14kyFP5"
112+
}
113+
}

0 commit comments

Comments
 (0)