Last active
March 20, 2026 13:55
-
-
Save Soniachniy/3342e0ebda5891a7d99a6d7b886ad9b6 to your computer and use it in GitHub Desktop.
Solana escrow contract
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "address": "4g5EN9Sk7wEcZqfjdjDtvq7T9u5YUrBKTe23fVJoL8yy", | |
| "metadata": { | |
| "name": "escrow", | |
| "version": "0.1.0", | |
| "spec": "0.1.0", | |
| "description": "Created with Anchor" | |
| }, | |
| "instructions": [ | |
| { | |
| "name": "make_offer", | |
| "discriminator": [214, 98, 97, 35, 59, 12, 44, 178], | |
| "accounts": [ | |
| { | |
| "name": "maker", | |
| "writable": true, | |
| "signer": true | |
| }, | |
| { | |
| "name": "token_mint_a" | |
| }, | |
| { | |
| "name": "token_mint_b" | |
| }, | |
| { | |
| "name": "maker_token_account_a", | |
| "writable": true, | |
| "pda": { | |
| "seeds": [ | |
| { "kind": "account", "path": "maker" }, | |
| { "kind": "account", "path": "token_program" }, | |
| { "kind": "account", "path": "token_mint_a" } | |
| ], | |
| "program": { | |
| "kind": "const", | |
| "value": [140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89] | |
| } | |
| } | |
| }, | |
| { | |
| "name": "offer", | |
| "writable": true, | |
| "pda": { | |
| "seeds": [ | |
| { "kind": "const", "value": [111, 102, 102, 101, 114] }, | |
| { "kind": "account", "path": "maker" }, | |
| { "kind": "arg", "path": "id" } | |
| ] | |
| } | |
| }, | |
| { | |
| "name": "vault", | |
| "writable": true, | |
| "pda": { | |
| "seeds": [ | |
| { "kind": "account", "path": "offer" }, | |
| { "kind": "account", "path": "token_program" }, | |
| { "kind": "account", "path": "token_mint_a" } | |
| ], | |
| "program": { | |
| "kind": "const", | |
| "value": [140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89] | |
| } | |
| } | |
| }, | |
| { | |
| "name": "associated_token_program", | |
| "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" | |
| }, | |
| { | |
| "name": "token_program" | |
| }, | |
| { | |
| "name": "system_program", | |
| "address": "11111111111111111111111111111111" | |
| } | |
| ], | |
| "args": [ | |
| { "name": "id", "type": "u64" }, | |
| { "name": "token_a_offered_amount", "type": "u64" }, | |
| { "name": "token_b_wanted_amount", "type": "u64" } | |
| ] | |
| }, | |
| { | |
| "name": "take_offer", | |
| "discriminator": [128, 156, 242, 207, 237, 192, 103, 240], | |
| "accounts": [ | |
| { | |
| "name": "taker", | |
| "writable": true, | |
| "signer": true | |
| }, | |
| { | |
| "name": "maker", | |
| "writable": true, | |
| "relations": ["offer"] | |
| }, | |
| { | |
| "name": "token_mint_a", | |
| "relations": ["offer"] | |
| }, | |
| { | |
| "name": "token_mint_b", | |
| "relations": ["offer"] | |
| }, | |
| { | |
| "name": "taker_token_account_a", | |
| "writable": true, | |
| "pda": { | |
| "seeds": [ | |
| { "kind": "account", "path": "taker" }, | |
| { "kind": "account", "path": "token_program" }, | |
| { "kind": "account", "path": "token_mint_a" } | |
| ], | |
| "program": { | |
| "kind": "const", | |
| "value": [140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89] | |
| } | |
| } | |
| }, | |
| { | |
| "name": "taker_token_account_b", | |
| "writable": true, | |
| "pda": { | |
| "seeds": [ | |
| { "kind": "account", "path": "taker" }, | |
| { "kind": "account", "path": "token_program" }, | |
| { "kind": "account", "path": "token_mint_b" } | |
| ], | |
| "program": { | |
| "kind": "const", | |
| "value": [140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89] | |
| } | |
| } | |
| }, | |
| { | |
| "name": "maker_token_account_b", | |
| "writable": true, | |
| "pda": { | |
| "seeds": [ | |
| { "kind": "account", "path": "maker" }, | |
| { "kind": "account", "path": "token_program" }, | |
| { "kind": "account", "path": "token_mint_b" } | |
| ], | |
| "program": { | |
| "kind": "const", | |
| "value": [140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89] | |
| } | |
| } | |
| }, | |
| { | |
| "name": "offer", | |
| "writable": true, | |
| "pda": { | |
| "seeds": [ | |
| { "kind": "const", "value": [111, 102, 102, 101, 114] }, | |
| { "kind": "account", "path": "maker" }, | |
| { "kind": "account", "path": "offer.id", "account": "Offer" } | |
| ] | |
| } | |
| }, | |
| { | |
| "name": "vault", | |
| "writable": true, | |
| "pda": { | |
| "seeds": [ | |
| { "kind": "account", "path": "offer" }, | |
| { "kind": "account", "path": "token_program" }, | |
| { "kind": "account", "path": "token_mint_a" } | |
| ], | |
| "program": { | |
| "kind": "const", | |
| "value": [140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89] | |
| } | |
| } | |
| }, | |
| { | |
| "name": "associated_token_program", | |
| "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" | |
| }, | |
| { | |
| "name": "token_program" | |
| }, | |
| { | |
| "name": "system_program", | |
| "address": "11111111111111111111111111111111" | |
| } | |
| ], | |
| "args": [] | |
| } | |
| ], | |
| "accounts": [ | |
| { | |
| "name": "Offer", | |
| "discriminator": [215, 88, 60, 71, 170, 162, 73, 229] | |
| } | |
| ], | |
| "errors": [ | |
| { | |
| "code": 6000, | |
| "name": "CustomError", | |
| "msg": "Custom error message" | |
| } | |
| ], | |
| "types": [ | |
| { | |
| "name": "Offer", | |
| "type": { | |
| "kind": "struct", | |
| "fields": [ | |
| { "name": "id", "type": "u64" }, | |
| { "name": "maker", "type": "pubkey" }, | |
| { "name": "token_mint_a", "type": "pubkey" }, | |
| { "name": "token_mint_b", "type": "pubkey" }, | |
| { "name": "token_b_wanted_amount", "type": "u64" }, | |
| { "name": "bump", "type": "u8" } | |
| ] | |
| } | |
| } | |
| ], | |
| "constants": [ | |
| { | |
| "name": "SEED", | |
| "type": "string", | |
| "value": "\"anchor\"" | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment