Skip to content

Commit 4d59956

Browse files
Merge pull request #31 from Dnreikronos/dev
Dev
2 parents 411631d + a4e6c47 commit 4d59956

8 files changed

Lines changed: 1893 additions & 514 deletions

File tree

backend/package-lock.json

Lines changed: 938 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,22 @@
2424
"author": "",
2525
"license": "ISC",
2626
"dependencies": {
27+
"@coral-xyz/anchor": "^0.32.1",
2728
"@fastify/cors": "^11.1.0",
2829
"@fastify/jwt": "^10.0.0",
2930
"@fastify/swagger": "^9.5.2",
3031
"@fastify/swagger-ui": "^5.2.3",
3132
"@prisma/client": "^6.17.1",
33+
"@solana/spl-token": "^0.4.14",
34+
"@solana/web3.js": "^1.98.4",
3235
"@types/bcrypt": "^6.0.0",
3336
"bcrypt": "^6.0.0",
3437
"dotenv": "^17.2.3",
3538
"fastify": "^5.6.1",
3639
"zod": "^4.1.12"
3740
},
3841
"devDependencies": {
42+
"@coral-xyz/anchor-cli": "^0.31.2",
3943
"@types/node": "^24.7.2",
4044
"@vitest/coverage-v8": "^4.0.2",
4145
"@vitest/ui": "^4.0.2",

backend/src/idl/crypto.json

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
{
2+
"address": "BrBYcBHWA7LkqDfMGQucbs3uLS7DTGKTTzwqYiBVf9sH",
3+
"metadata": {
4+
"name": "crypto",
5+
"version": "0.1.0",
6+
"spec": "0.1.0",
7+
"description": "Created with Anchor"
8+
},
9+
"instructions": [
10+
{
11+
"name": "approve_delegate",
12+
"discriminator": [68, 6, 248, 64, 195, 222, 182, 223],
13+
"accounts": [
14+
{
15+
"name": "delegate_approval",
16+
"writable": true,
17+
"pda": {
18+
"seeds": [
19+
{
20+
"kind": "const",
21+
"value": [100, 101, 108, 101, 103, 97, 116, 101]
22+
},
23+
{
24+
"kind": "arg",
25+
"path": "subscription_id"
26+
},
27+
{
28+
"kind": "account",
29+
"path": "payer"
30+
}
31+
]
32+
}
33+
},
34+
{
35+
"name": "delegate_pda",
36+
"pda": {
37+
"seeds": [
38+
{
39+
"kind": "const",
40+
"value": [
41+
100, 101, 108, 101, 103, 97, 116, 101, 95, 112, 100, 97
42+
]
43+
}
44+
]
45+
}
46+
},
47+
{
48+
"name": "payer",
49+
"writable": true,
50+
"signer": true
51+
},
52+
{
53+
"name": "receiver"
54+
},
55+
{
56+
"name": "payer_token_account",
57+
"writable": true
58+
},
59+
{
60+
"name": "receiver_token_account"
61+
},
62+
{
63+
"name": "token_mint"
64+
},
65+
{
66+
"name": "token_program",
67+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
68+
},
69+
{
70+
"name": "system_program",
71+
"address": "11111111111111111111111111111111"
72+
}
73+
],
74+
"args": [
75+
{
76+
"name": "subscription_id",
77+
"type": "string"
78+
},
79+
{
80+
"name": "approved_amount",
81+
"type": "u64"
82+
}
83+
]
84+
},
85+
{
86+
"name": "charge_subscription",
87+
"discriminator": [121, 52, 210, 23, 3, 68, 86, 194],
88+
"accounts": [
89+
{
90+
"name": "delegate_approval",
91+
"writable": true,
92+
"pda": {
93+
"seeds": [
94+
{
95+
"kind": "const",
96+
"value": [100, 101, 108, 101, 103, 97, 116, 101]
97+
},
98+
{
99+
"kind": "arg",
100+
"path": "subscription_id"
101+
},
102+
{
103+
"kind": "account",
104+
"path": "delegate_approval.payer",
105+
"account": "DelegateApproval"
106+
}
107+
]
108+
}
109+
},
110+
{
111+
"name": "delegate_pda",
112+
"pda": {
113+
"seeds": [
114+
{
115+
"kind": "const",
116+
"value": [
117+
100, 101, 108, 101, 103, 97, 116, 101, 95, 112, 100, 97
118+
]
119+
}
120+
]
121+
}
122+
},
123+
{
124+
"name": "payer_token_account",
125+
"writable": true
126+
},
127+
{
128+
"name": "receiver_token_account",
129+
"writable": true
130+
},
131+
{
132+
"name": "backend",
133+
"signer": true
134+
},
135+
{
136+
"name": "token_program",
137+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
138+
}
139+
],
140+
"args": [
141+
{
142+
"name": "subscription_id",
143+
"type": "string"
144+
},
145+
{
146+
"name": "amount",
147+
"type": "u64"
148+
}
149+
]
150+
},
151+
{
152+
"name": "revoke_delegate",
153+
"discriminator": [142, 66, 98, 126, 102, 60, 92, 163],
154+
"accounts": [
155+
{
156+
"name": "delegate_approval",
157+
"writable": true,
158+
"pda": {
159+
"seeds": [
160+
{
161+
"kind": "const",
162+
"value": [100, 101, 108, 101, 103, 97, 116, 101]
163+
},
164+
{
165+
"kind": "arg",
166+
"path": "subscription_id"
167+
},
168+
{
169+
"kind": "account",
170+
"path": "payer"
171+
}
172+
]
173+
}
174+
},
175+
{
176+
"name": "payer",
177+
"writable": true,
178+
"signer": true
179+
}
180+
],
181+
"args": [
182+
{
183+
"name": "_subscription_id",
184+
"type": "string"
185+
}
186+
]
187+
}
188+
],
189+
"accounts": [
190+
{
191+
"name": "DelegateApproval",
192+
"discriminator": [41, 170, 124, 42, 55, 141, 43, 120]
193+
}
194+
],
195+
"errors": [
196+
{
197+
"code": 6000,
198+
"name": "Unauthorized",
199+
"msg": "Unauthorized: only backend can charge"
200+
},
201+
{
202+
"code": 6001,
203+
"name": "InsufficientAllowance",
204+
"msg": "Insufficient allowance"
205+
}
206+
],
207+
"types": [
208+
{
209+
"name": "DelegateApproval",
210+
"type": {
211+
"kind": "struct",
212+
"fields": [
213+
{
214+
"name": "payer",
215+
"type": "pubkey"
216+
},
217+
{
218+
"name": "receiver",
219+
"type": "pubkey"
220+
},
221+
{
222+
"name": "token_mint",
223+
"type": "pubkey"
224+
},
225+
{
226+
"name": "payer_token_account",
227+
"type": "pubkey"
228+
},
229+
{
230+
"name": "receiver_token_account",
231+
"type": "pubkey"
232+
},
233+
{
234+
"name": "approved_amount",
235+
"type": "u64"
236+
},
237+
{
238+
"name": "spent_amount",
239+
"type": "u64"
240+
},
241+
{
242+
"name": "subscription_id",
243+
"type": "string"
244+
},
245+
{
246+
"name": "created_at",
247+
"type": "i64"
248+
},
249+
{
250+
"name": "bump",
251+
"type": "u8"
252+
}
253+
]
254+
}
255+
}
256+
]
257+
}

0 commit comments

Comments
 (0)