Skip to content

Commit

Permalink
solana: check in IDL (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcsongor authored Apr 26, 2024
1 parent 6c8ace6 commit 39d67c0
Show file tree
Hide file tree
Showing 12 changed files with 7,882 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/solana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ jobs:
- name: Setup SDK
run: make sdk
shell: bash
- name: Check idl
run: |
git diff --exit-code idl
- name: Run tests
run: anchor test
shell: bash
13 changes: 10 additions & 3 deletions solana/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.PHONY: build
build: _anchor-build target/idl/example_native_token_transfers.json
build: _anchor-build target/idl/example_native_token_transfers.json idl

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

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

sdk: build target/idl/example_native_token_transfers.json
sdk: build
@echo "Building SDK"
cd ../sdk && npm ci && npm run build:solana

.PHONY: idl
idl: target/idl/example_native_token_transfers.json
@ mkdir -p $@/json
@ mkdir -p $@/ts
@ cp -r target/idl/* $@/json/
@ cp -r target/types/* $@/ts/

node_modules: package-lock.json
npm ci

Expand Down
113 changes: 113 additions & 0 deletions solana/idl/json/dummy_transfer_hook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"version": "0.1.0",
"name": "dummy_transfer_hook",
"instructions": [
{
"name": "initializeExtraAccountMetaList",
"accounts": [
{
"name": "payer",
"isMut": true,
"isSigner": true
},
{
"name": "extraAccountMetaList",
"isMut": true,
"isSigner": false
},
{
"name": "mint",
"isMut": false,
"isSigner": false
},
{
"name": "tokenProgram",
"isMut": false,
"isSigner": false
},
{
"name": "associatedTokenProgram",
"isMut": false,
"isSigner": false
},
{
"name": "counter",
"isMut": true,
"isSigner": false
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false
}
],
"args": []
},
{
"name": "transferHook",
"accounts": [
{
"name": "sourceToken",
"isMut": false,
"isSigner": false
},
{
"name": "mint",
"isMut": false,
"isSigner": false
},
{
"name": "destinationToken",
"isMut": false,
"isSigner": false
},
{
"name": "authority",
"isMut": false,
"isSigner": false
},
{
"name": "extraAccountMetaList",
"isMut": false,
"isSigner": false
},
{
"name": "dummyAccount",
"isMut": false,
"isSigner": false,
"docs": [
"computes and the on-chain code correctly passes on the PDA."
]
},
{
"name": "counter",
"isMut": true,
"isSigner": false
}
],
"args": [
{
"name": "amount",
"type": "u64"
}
]
}
],
"accounts": [
{
"name": "Counter",
"type": {
"kind": "struct",
"fields": [
{
"name": "count",
"type": "u64"
}
]
}
}
],
"metadata": {
"address": "BgabMDLaxsyB7eGMBt9L22MSk9KMrL4zY2iNe14kyFP5"
}
}
Loading

0 comments on commit 39d67c0

Please sign in to comment.