nara-sdk 1.0.69 → 1.0.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.ts CHANGED
@@ -140,6 +140,7 @@ export {
140
140
  unbindTwitter,
141
141
  verifyTwitter,
142
142
  rejectTwitter,
143
+ approveRejectedTwitter,
143
144
  approveTweet,
144
145
  rejectTweet,
145
146
  // Admin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nara-sdk",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
4
4
  "description": "SDK for the Nara chain (Solana-compatible)",
5
5
  "module": "index.ts",
6
6
  "main": "index.ts",
@@ -1578,6 +1578,53 @@ export async function rejectTwitter(
1578
1578
  return sendTx(connection, wallet, [ix]);
1579
1579
  }
1580
1580
 
1581
+ /**
1582
+ * Approve a previously rejected twitter verification (verifier-only).
1583
+ * Awards verification reward and points to the agent owner.
1584
+ * @param freeStakeDelta - If provided, also adjusts free stake credits for the agent owner in the same tx.
1585
+ */
1586
+ export async function approveRejectedTwitter(
1587
+ connection: Connection,
1588
+ wallet: Keypair,
1589
+ agentId: string,
1590
+ username: string,
1591
+ options?: AgentRegistryOptions,
1592
+ freeStakeDelta?: number,
1593
+ freeStakeReason?: string
1594
+ ): Promise<string> {
1595
+ const program = createProgram(connection, wallet, options?.programId);
1596
+ const agentPda = getAgentPda(program.programId, agentId);
1597
+
1598
+ const accountInfo = await connection.getAccountInfo(agentPda);
1599
+ if (!accountInfo) throw new Error(`Agent "${agentId}" not found`);
1600
+ const authority = new PublicKey(accountInfo.data.subarray(8, 40));
1601
+
1602
+ const pointMint = getPointMintPda(program.programId);
1603
+ const authorityPointAccount = getAssociatedTokenAddressSync(
1604
+ pointMint, authority, true, TOKEN_2022_PROGRAM_ID
1605
+ );
1606
+
1607
+ const ix = await program.methods
1608
+ .approveRejectedTwitter(agentId, username)
1609
+ .accounts({
1610
+ verifier: wallet.publicKey,
1611
+ authority,
1612
+ authorityPointAccount,
1613
+ } as any)
1614
+ .instruction();
1615
+
1616
+ const ixs = [ix];
1617
+ if (freeStakeDelta !== undefined && freeStakeDelta !== 0) {
1618
+ const { makeAdjustFreeStakeIx } = await import("./quest");
1619
+ const freeStakeIx = await makeAdjustFreeStakeIx(
1620
+ connection, wallet.publicKey, authority, freeStakeDelta, freeStakeReason ?? ""
1621
+ );
1622
+ ixs.push(freeStakeIx);
1623
+ }
1624
+
1625
+ return sendTx(connection, wallet, ixs);
1626
+ }
1627
+
1581
1628
  /**
1582
1629
  * Approve a tweet verification (verifier-only).
1583
1630
  * Awards tweet verify reward and points to the agent owner.
@@ -7,6 +7,306 @@
7
7
  "description": "Nara Agent Registry - AI agent registration center"
8
8
  },
9
9
  "instructions": [
10
+ {
11
+ "name": "approve_rejected_twitter",
12
+ "discriminator": [
13
+ 119,
14
+ 20,
15
+ 181,
16
+ 34,
17
+ 178,
18
+ 73,
19
+ 81,
20
+ 50
21
+ ],
22
+ "accounts": [
23
+ {
24
+ "name": "verifier",
25
+ "writable": true,
26
+ "signer": true
27
+ },
28
+ {
29
+ "name": "config",
30
+ "pda": {
31
+ "seeds": [
32
+ {
33
+ "kind": "const",
34
+ "value": [
35
+ 99,
36
+ 111,
37
+ 110,
38
+ 102,
39
+ 105,
40
+ 103
41
+ ]
42
+ }
43
+ ]
44
+ }
45
+ },
46
+ {
47
+ "name": "agent",
48
+ "pda": {
49
+ "seeds": [
50
+ {
51
+ "kind": "const",
52
+ "value": [
53
+ 97,
54
+ 103,
55
+ 101,
56
+ 110,
57
+ 116
58
+ ]
59
+ },
60
+ {
61
+ "kind": "arg",
62
+ "path": "agent_id"
63
+ }
64
+ ]
65
+ }
66
+ },
67
+ {
68
+ "name": "twitter",
69
+ "writable": true,
70
+ "pda": {
71
+ "seeds": [
72
+ {
73
+ "kind": "const",
74
+ "value": [
75
+ 116,
76
+ 119,
77
+ 105,
78
+ 116,
79
+ 116,
80
+ 101,
81
+ 114
82
+ ]
83
+ },
84
+ {
85
+ "kind": "account",
86
+ "path": "agent"
87
+ }
88
+ ]
89
+ }
90
+ },
91
+ {
92
+ "name": "twitter_handle",
93
+ "writable": true,
94
+ "pda": {
95
+ "seeds": [
96
+ {
97
+ "kind": "const",
98
+ "value": [
99
+ 116,
100
+ 119,
101
+ 105,
102
+ 116,
103
+ 116,
104
+ 101,
105
+ 114,
106
+ 95,
107
+ 104,
108
+ 97,
109
+ 110,
110
+ 100,
111
+ 108,
112
+ 101
113
+ ]
114
+ },
115
+ {
116
+ "kind": "arg",
117
+ "path": "username"
118
+ }
119
+ ]
120
+ }
121
+ },
122
+ {
123
+ "name": "authority",
124
+ "writable": true
125
+ },
126
+ {
127
+ "name": "twitter_verify_vault",
128
+ "writable": true,
129
+ "pda": {
130
+ "seeds": [
131
+ {
132
+ "kind": "const",
133
+ "value": [
134
+ 116,
135
+ 119,
136
+ 105,
137
+ 116,
138
+ 116,
139
+ 101,
140
+ 114,
141
+ 95,
142
+ 118,
143
+ 101,
144
+ 114,
145
+ 105,
146
+ 102,
147
+ 121,
148
+ 95,
149
+ 118,
150
+ 97,
151
+ 117,
152
+ 108,
153
+ 116
154
+ ]
155
+ }
156
+ ]
157
+ }
158
+ },
159
+ {
160
+ "name": "treasury",
161
+ "writable": true,
162
+ "pda": {
163
+ "seeds": [
164
+ {
165
+ "kind": "const",
166
+ "value": [
167
+ 116,
168
+ 114,
169
+ 101,
170
+ 97,
171
+ 115,
172
+ 117,
173
+ 114,
174
+ 121
175
+ ]
176
+ }
177
+ ]
178
+ }
179
+ },
180
+ {
181
+ "name": "point_mint",
182
+ "writable": true,
183
+ "pda": {
184
+ "seeds": [
185
+ {
186
+ "kind": "const",
187
+ "value": [
188
+ 112,
189
+ 111,
190
+ 105,
191
+ 110,
192
+ 116,
193
+ 95,
194
+ 109,
195
+ 105,
196
+ 110,
197
+ 116
198
+ ]
199
+ }
200
+ ]
201
+ }
202
+ },
203
+ {
204
+ "name": "mint_authority",
205
+ "pda": {
206
+ "seeds": [
207
+ {
208
+ "kind": "const",
209
+ "value": [
210
+ 109,
211
+ 105,
212
+ 110,
213
+ 116,
214
+ 95,
215
+ 97,
216
+ 117,
217
+ 116,
218
+ 104,
219
+ 111,
220
+ 114,
221
+ 105,
222
+ 116,
223
+ 121
224
+ ]
225
+ }
226
+ ]
227
+ }
228
+ },
229
+ {
230
+ "name": "authority_point_account",
231
+ "writable": true,
232
+ "pda": {
233
+ "seeds": [
234
+ {
235
+ "kind": "account",
236
+ "path": "authority"
237
+ },
238
+ {
239
+ "kind": "account",
240
+ "path": "token_program"
241
+ },
242
+ {
243
+ "kind": "account",
244
+ "path": "point_mint"
245
+ }
246
+ ],
247
+ "program": {
248
+ "kind": "const",
249
+ "value": [
250
+ 140,
251
+ 151,
252
+ 37,
253
+ 143,
254
+ 78,
255
+ 36,
256
+ 137,
257
+ 241,
258
+ 187,
259
+ 61,
260
+ 16,
261
+ 41,
262
+ 20,
263
+ 142,
264
+ 13,
265
+ 131,
266
+ 11,
267
+ 90,
268
+ 19,
269
+ 153,
270
+ 218,
271
+ 255,
272
+ 16,
273
+ 132,
274
+ 4,
275
+ 142,
276
+ 123,
277
+ 216,
278
+ 219,
279
+ 233,
280
+ 248,
281
+ 89
282
+ ]
283
+ }
284
+ }
285
+ },
286
+ {
287
+ "name": "token_program",
288
+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
289
+ },
290
+ {
291
+ "name": "associated_token_program",
292
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
293
+ },
294
+ {
295
+ "name": "system_program",
296
+ "address": "11111111111111111111111111111111"
297
+ }
298
+ ],
299
+ "args": [
300
+ {
301
+ "name": "agent_id",
302
+ "type": "string"
303
+ },
304
+ {
305
+ "name": "username",
306
+ "type": "string"
307
+ }
308
+ ]
309
+ },
10
310
  {
11
311
  "name": "approve_tweet",
12
312
  "discriminator": [
@@ -4445,6 +4745,11 @@
4445
4745
  "code": 6046,
4446
4746
  "name": "AgentIdReserved",
4447
4747
  "msg": "Agent ID length <= 4 is reserved for admin only"
4748
+ },
4749
+ {
4750
+ "code": 6047,
4751
+ "name": "TwitterNotRejected",
4752
+ "msg": "Twitter binding is not in rejected status"
4448
4753
  }
4449
4754
  ],
4450
4755
  "types": [
@@ -13,6 +13,306 @@ export type NaraAgentRegistry = {
13
13
  "description": "Nara Agent Registry - AI agent registration center"
14
14
  },
15
15
  "instructions": [
16
+ {
17
+ "name": "approveRejectedTwitter",
18
+ "discriminator": [
19
+ 119,
20
+ 20,
21
+ 181,
22
+ 34,
23
+ 178,
24
+ 73,
25
+ 81,
26
+ 50
27
+ ],
28
+ "accounts": [
29
+ {
30
+ "name": "verifier",
31
+ "writable": true,
32
+ "signer": true
33
+ },
34
+ {
35
+ "name": "config",
36
+ "pda": {
37
+ "seeds": [
38
+ {
39
+ "kind": "const",
40
+ "value": [
41
+ 99,
42
+ 111,
43
+ 110,
44
+ 102,
45
+ 105,
46
+ 103
47
+ ]
48
+ }
49
+ ]
50
+ }
51
+ },
52
+ {
53
+ "name": "agent",
54
+ "pda": {
55
+ "seeds": [
56
+ {
57
+ "kind": "const",
58
+ "value": [
59
+ 97,
60
+ 103,
61
+ 101,
62
+ 110,
63
+ 116
64
+ ]
65
+ },
66
+ {
67
+ "kind": "arg",
68
+ "path": "agentId"
69
+ }
70
+ ]
71
+ }
72
+ },
73
+ {
74
+ "name": "twitter",
75
+ "writable": true,
76
+ "pda": {
77
+ "seeds": [
78
+ {
79
+ "kind": "const",
80
+ "value": [
81
+ 116,
82
+ 119,
83
+ 105,
84
+ 116,
85
+ 116,
86
+ 101,
87
+ 114
88
+ ]
89
+ },
90
+ {
91
+ "kind": "account",
92
+ "path": "agent"
93
+ }
94
+ ]
95
+ }
96
+ },
97
+ {
98
+ "name": "twitterHandle",
99
+ "writable": true,
100
+ "pda": {
101
+ "seeds": [
102
+ {
103
+ "kind": "const",
104
+ "value": [
105
+ 116,
106
+ 119,
107
+ 105,
108
+ 116,
109
+ 116,
110
+ 101,
111
+ 114,
112
+ 95,
113
+ 104,
114
+ 97,
115
+ 110,
116
+ 100,
117
+ 108,
118
+ 101
119
+ ]
120
+ },
121
+ {
122
+ "kind": "arg",
123
+ "path": "username"
124
+ }
125
+ ]
126
+ }
127
+ },
128
+ {
129
+ "name": "authority",
130
+ "writable": true
131
+ },
132
+ {
133
+ "name": "twitterVerifyVault",
134
+ "writable": true,
135
+ "pda": {
136
+ "seeds": [
137
+ {
138
+ "kind": "const",
139
+ "value": [
140
+ 116,
141
+ 119,
142
+ 105,
143
+ 116,
144
+ 116,
145
+ 101,
146
+ 114,
147
+ 95,
148
+ 118,
149
+ 101,
150
+ 114,
151
+ 105,
152
+ 102,
153
+ 121,
154
+ 95,
155
+ 118,
156
+ 97,
157
+ 117,
158
+ 108,
159
+ 116
160
+ ]
161
+ }
162
+ ]
163
+ }
164
+ },
165
+ {
166
+ "name": "treasury",
167
+ "writable": true,
168
+ "pda": {
169
+ "seeds": [
170
+ {
171
+ "kind": "const",
172
+ "value": [
173
+ 116,
174
+ 114,
175
+ 101,
176
+ 97,
177
+ 115,
178
+ 117,
179
+ 114,
180
+ 121
181
+ ]
182
+ }
183
+ ]
184
+ }
185
+ },
186
+ {
187
+ "name": "pointMint",
188
+ "writable": true,
189
+ "pda": {
190
+ "seeds": [
191
+ {
192
+ "kind": "const",
193
+ "value": [
194
+ 112,
195
+ 111,
196
+ 105,
197
+ 110,
198
+ 116,
199
+ 95,
200
+ 109,
201
+ 105,
202
+ 110,
203
+ 116
204
+ ]
205
+ }
206
+ ]
207
+ }
208
+ },
209
+ {
210
+ "name": "mintAuthority",
211
+ "pda": {
212
+ "seeds": [
213
+ {
214
+ "kind": "const",
215
+ "value": [
216
+ 109,
217
+ 105,
218
+ 110,
219
+ 116,
220
+ 95,
221
+ 97,
222
+ 117,
223
+ 116,
224
+ 104,
225
+ 111,
226
+ 114,
227
+ 105,
228
+ 116,
229
+ 121
230
+ ]
231
+ }
232
+ ]
233
+ }
234
+ },
235
+ {
236
+ "name": "authorityPointAccount",
237
+ "writable": true,
238
+ "pda": {
239
+ "seeds": [
240
+ {
241
+ "kind": "account",
242
+ "path": "authority"
243
+ },
244
+ {
245
+ "kind": "account",
246
+ "path": "tokenProgram"
247
+ },
248
+ {
249
+ "kind": "account",
250
+ "path": "pointMint"
251
+ }
252
+ ],
253
+ "program": {
254
+ "kind": "const",
255
+ "value": [
256
+ 140,
257
+ 151,
258
+ 37,
259
+ 143,
260
+ 78,
261
+ 36,
262
+ 137,
263
+ 241,
264
+ 187,
265
+ 61,
266
+ 16,
267
+ 41,
268
+ 20,
269
+ 142,
270
+ 13,
271
+ 131,
272
+ 11,
273
+ 90,
274
+ 19,
275
+ 153,
276
+ 218,
277
+ 255,
278
+ 16,
279
+ 132,
280
+ 4,
281
+ 142,
282
+ 123,
283
+ 216,
284
+ 219,
285
+ 233,
286
+ 248,
287
+ 89
288
+ ]
289
+ }
290
+ }
291
+ },
292
+ {
293
+ "name": "tokenProgram",
294
+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
295
+ },
296
+ {
297
+ "name": "associatedTokenProgram",
298
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
299
+ },
300
+ {
301
+ "name": "systemProgram",
302
+ "address": "11111111111111111111111111111111"
303
+ }
304
+ ],
305
+ "args": [
306
+ {
307
+ "name": "agentId",
308
+ "type": "string"
309
+ },
310
+ {
311
+ "name": "username",
312
+ "type": "string"
313
+ }
314
+ ]
315
+ },
16
316
  {
17
317
  "name": "approveTweet",
18
318
  "discriminator": [
@@ -4451,6 +4751,11 @@ export type NaraAgentRegistry = {
4451
4751
  "code": 6046,
4452
4752
  "name": "agentIdReserved",
4453
4753
  "msg": "Agent ID length <= 4 is reserved for admin only"
4754
+ },
4755
+ {
4756
+ "code": 6047,
4757
+ "name": "twitterNotRejected",
4758
+ "msg": "Twitter binding is not in rejected status"
4454
4759
  }
4455
4760
  ],
4456
4761
  "types": [