Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solana: check in IDL #429

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading