descro playgound & sdk

This commit is contained in:
thesn10
2026-05-18 22:02:41 +02:00
parent 84a2ec4200
commit 2a89352212
37 changed files with 8775 additions and 12088 deletions

674
sdk/src/idl/descro.json Normal file
View File

@@ -0,0 +1,674 @@
{
"address": "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3",
"metadata": {
"name": "descro",
"version": "0.1.0",
"spec": "0.1.0",
"description": "Created with Anchor"
},
"instructions": [
{
"name": "cancel",
"discriminator": [
232,
219,
223,
41,
219,
236,
220,
190
],
"accounts": [
{
"name": "seller",
"writable": true,
"signer": true
},
{
"name": "escrow_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
101,
115,
99,
114,
111,
119
]
},
{
"kind": "account",
"path": "escrow_account.seller",
"account": "EscrowAccount"
},
{
"kind": "account",
"path": "escrow_account.escrow_id",
"account": "EscrowAccount"
}
]
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": []
},
{
"name": "complete",
"discriminator": [
0,
77,
224,
147,
136,
25,
88,
76
],
"accounts": [
{
"name": "buyer",
"signer": true
},
{
"name": "seller",
"writable": true
},
{
"name": "escrow_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
101,
115,
99,
114,
111,
119
]
},
{
"kind": "account",
"path": "escrow_account.seller",
"account": "EscrowAccount"
},
{
"kind": "account",
"path": "escrow_account.escrow_id",
"account": "EscrowAccount"
}
]
}
},
{
"name": "vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
118,
97,
117,
108,
116
]
},
{
"kind": "account",
"path": "escrow_account"
}
]
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": []
},
{
"name": "create_escrow",
"discriminator": [
253,
215,
165,
116,
36,
108,
68,
80
],
"accounts": [
{
"name": "seller",
"writable": true,
"signer": true
},
{
"name": "buyer"
},
{
"name": "escrow_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
101,
115,
99,
114,
111,
119
]
},
{
"kind": "account",
"path": "seller"
},
{
"kind": "arg",
"path": "escrow_id"
}
]
}
},
{
"name": "vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
118,
97,
117,
108,
116
]
},
{
"kind": "account",
"path": "escrow_account"
}
]
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": [
{
"name": "amount",
"type": "u64"
},
{
"name": "dispute_resolver",
"type": {
"option": "pubkey"
}
},
{
"name": "escrow_id",
"type": "u64"
}
]
},
{
"name": "deposit",
"discriminator": [
242,
35,
198,
137,
82,
225,
242,
182
],
"accounts": [
{
"name": "buyer",
"writable": true,
"signer": true
},
{
"name": "escrow_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
101,
115,
99,
114,
111,
119
]
},
{
"kind": "account",
"path": "escrow_account.seller",
"account": "EscrowAccount"
},
{
"kind": "account",
"path": "escrow_account.escrow_id",
"account": "EscrowAccount"
}
]
}
},
{
"name": "vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
118,
97,
117,
108,
116
]
},
{
"kind": "account",
"path": "escrow_account"
}
]
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": []
},
{
"name": "dispute",
"discriminator": [
216,
92,
128,
146,
202,
85,
135,
73
],
"accounts": [
{
"name": "initiator",
"signer": true
},
{
"name": "escrow_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
101,
115,
99,
114,
111,
119
]
},
{
"kind": "account",
"path": "escrow_account.seller",
"account": "EscrowAccount"
},
{
"kind": "account",
"path": "escrow_account.escrow_id",
"account": "EscrowAccount"
}
]
}
}
],
"args": []
},
{
"name": "resolve",
"discriminator": [
246,
150,
236,
206,
108,
63,
58,
10
],
"accounts": [
{
"name": "resolver",
"signer": true
},
{
"name": "winner",
"writable": true
},
{
"name": "seller",
"writable": true
},
{
"name": "escrow_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
101,
115,
99,
114,
111,
119
]
},
{
"kind": "account",
"path": "escrow_account.seller",
"account": "EscrowAccount"
},
{
"kind": "account",
"path": "escrow_account.escrow_id",
"account": "EscrowAccount"
}
]
}
},
{
"name": "vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
118,
97,
117,
108,
116
]
},
{
"kind": "account",
"path": "escrow_account"
}
]
}
},
{
"name": "resolver_entry",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
114,
101,
115,
111,
108,
118,
101,
114
]
},
{
"kind": "account",
"path": "escrow_account.dispute_resolver",
"account": "EscrowAccount"
}
],
"program": {
"kind": "const",
"value": [
4,
21,
77,
207,
27,
130,
71,
134,
111,
76,
186,
244,
136,
42,
168,
238,
151,
132,
148,
41,
241,
127,
56,
240,
140,
66,
190,
194,
253,
243,
165,
91
]
}
}
},
{
"name": "escrow_authority",
"pda": {
"seeds": [
{
"kind": "const",
"value": [
101,
115,
99,
114,
111,
119,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
]
}
]
}
},
{
"name": "registry_program"
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": [
{
"name": "winner",
"type": {
"defined": {
"name": "Winner"
}
}
}
]
}
],
"accounts": [
{
"name": "EscrowAccount",
"discriminator": [
36,
69,
48,
18,
128,
225,
125,
135
]
}
],
"errors": [
{
"code": 6000,
"name": "InvalidState",
"msg": "Invalid state for this instruction"
},
{
"code": 6001,
"name": "Unauthorized",
"msg": "Signer is not authorized"
},
{
"code": 6002,
"name": "NoResolverConfigured",
"msg": "No resolver configured for this escrow"
},
{
"code": 6003,
"name": "UnauthorizedResolver",
"msg": "Signer is not the configured resolver"
},
{
"code": 6004,
"name": "Expired",
"msg": "Escrow has expired"
}
],
"types": [
{
"name": "EscrowAccount",
"type": {
"kind": "struct",
"fields": [
{
"name": "seller",
"type": "pubkey"
},
{
"name": "buyer",
"type": "pubkey"
},
{
"name": "amount",
"type": "u64"
},
{
"name": "dispute_resolver",
"type": {
"option": "pubkey"
}
},
{
"name": "state",
"type": {
"defined": {
"name": "EscrowState"
}
}
},
{
"name": "bump",
"type": "u8"
},
{
"name": "vault_bump",
"type": "u8"
},
{
"name": "escrow_id",
"type": "u64"
}
]
}
},
{
"name": "EscrowState",
"type": {
"kind": "enum",
"variants": [
{
"name": "AwaitingDeposit"
},
{
"name": "Active"
},
{
"name": "Disputed"
},
{
"name": "Complete"
},
{
"name": "Cancelled"
}
]
}
},
{
"name": "Winner",
"type": {
"kind": "enum",
"variants": [
{
"name": "Buyer"
},
{
"name": "Seller"
}
]
}
}
]
}

View File

@@ -0,0 +1,385 @@
{
"address": "GwUPAKs3HHzCpj8uhet4NAnxk9GWNwfrYbpihu5DyFp",
"metadata": {
"name": "descro_ext_resolvers",
"version": "0.1.0",
"spec": "0.1.0",
"description": "Resolver Registry for the descro escrow protocol"
},
"instructions": [
{
"name": "register_resolver",
"discriminator": [
76,
101,
253,
229,
153,
242,
212,
230
],
"accounts": [
{
"name": "authority",
"writable": true,
"signer": true
},
{
"name": "resolver_entry",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
114,
101,
115,
111,
108,
118,
101,
114
]
},
{
"kind": "account",
"path": "authority"
}
]
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": [
{
"name": "resolver_type",
"type": {
"defined": {
"name": "ResolverType"
}
}
},
{
"name": "name",
"type": "string"
},
{
"name": "description",
"type": "string"
},
{
"name": "fee_bps",
"type": "u16"
},
{
"name": "fee_recipient",
"type": "pubkey"
},
{
"name": "metadata_uri",
"type": "string"
}
]
},
{
"name": "update_resolver",
"discriminator": [
108,
227,
28,
163,
123,
230,
190,
84
],
"accounts": [
{
"name": "authority",
"signer": true
},
{
"name": "resolver_entry",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
114,
101,
115,
111,
108,
118,
101,
114
]
},
{
"kind": "account",
"path": "authority"
}
]
}
}
],
"args": [
{
"name": "name",
"type": "string"
},
{
"name": "description",
"type": "string"
},
{
"name": "fee_bps",
"type": "u16"
},
{
"name": "metadata_uri",
"type": "string"
}
]
},
{
"name": "update_stats",
"discriminator": [
145,
138,
9,
150,
178,
31,
158,
244
],
"accounts": [
{
"name": "escrow_authority",
"docs": [
"Must be the Escrow Program's authority PDA — only it can sign this."
],
"signer": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
101,
115,
99,
114,
111,
119,
95,
97,
117,
116,
104,
111,
114,
105,
116,
121
]
}
],
"program": {
"kind": "const",
"value": [
189,
46,
196,
9,
38,
68,
13,
236,
154,
101,
74,
161,
29,
155,
110,
167,
230,
204,
79,
86,
74,
46,
229,
168,
214,
228,
65,
126,
160,
53,
53,
204
]
}
}
},
{
"name": "resolver_entry",
"writable": true
}
],
"args": [
{
"name": "ruling",
"type": {
"defined": {
"name": "Ruling"
}
}
}
]
}
],
"accounts": [
{
"name": "ResolverEntry",
"discriminator": [
0,
60,
55,
58,
157,
135,
51,
191
]
}
],
"errors": [
{
"code": 6000,
"name": "Unauthorized",
"msg": "Signer is not the registered authority"
},
{
"code": 6001,
"name": "UnauthorizedCaller",
"msg": "Caller is not the authorized escrow program"
},
{
"code": 6002,
"name": "InvalidFeeBps",
"msg": "Fee basis points must be <= 10000"
},
{
"code": 6003,
"name": "EmptyName",
"msg": "Name must not be empty"
}
],
"types": [
{
"name": "ResolverEntry",
"type": {
"kind": "struct",
"fields": [
{
"name": "authority",
"type": "pubkey"
},
{
"name": "resolver_type",
"type": {
"defined": {
"name": "ResolverType"
}
}
},
{
"name": "name",
"type": "string"
},
{
"name": "description",
"type": "string"
},
{
"name": "fee_bps",
"type": "u16"
},
{
"name": "fee_recipient",
"type": "pubkey"
},
{
"name": "metadata_uri",
"type": "string"
},
{
"name": "total_resolved",
"type": "u64"
},
{
"name": "ruled_for_buyer",
"type": "u64"
},
{
"name": "ruled_for_seller",
"type": "u64"
},
{
"name": "registered_at",
"type": "i64"
}
]
}
},
{
"name": "ResolverType",
"type": {
"kind": "enum",
"variants": [
{
"name": "CentralAuthority"
},
{
"name": "JuryDAO"
},
{
"name": "MAD"
},
{
"name": "Algorithmic"
},
{
"name": "Multisig"
}
]
}
},
{
"name": "Ruling",
"docs": [
"Passed to update_stats; mirrors the Escrow program's Winner enum."
],
"type": {
"kind": "enum",
"variants": [
{
"name": "Buyer"
},
{
"name": "Seller"
}
]
}
}
]
}