@helium/spl-utils 0.11.16 → 0.11.17
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/LICENSE +203 -0
- package/lib/cjs/anchorError.js.map +1 -1
- package/lib/cjs/draft.js +1 -2
- package/lib/cjs/draft.js.map +1 -1
- package/lib/cjs/executeRemoteTxn.js +9 -10
- package/lib/cjs/executeRemoteTxn.js.map +1 -1
- package/lib/cjs/fetchBackwardsCompatibleIdl.js +2 -3
- package/lib/cjs/fetchBackwardsCompatibleIdl.js.map +1 -1
- package/lib/cjs/idl/voter_stake_registry.json +234 -152
- package/lib/cjs/mplAssetAPI.js +26 -27
- package/lib/cjs/mplAssetAPI.js.map +1 -1
- package/lib/cjs/priorityFees.js +8 -8
- package/lib/cjs/priorityFees.js.map +1 -1
- package/lib/cjs/proofArgsAndAccounts.js +3 -4
- package/lib/cjs/proofArgsAndAccounts.js.map +1 -1
- package/lib/cjs/token.js +22 -23
- package/lib/cjs/token.js.map +1 -1
- package/lib/cjs/transaction.js +52 -52
- package/lib/cjs/transaction.js.map +1 -1
- package/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/lib/cjs/utils.js +27 -17
- package/lib/cjs/utils.js.map +1 -1
- package/lib/esm/src/anchorError.js.map +1 -1
- package/lib/esm/src/draft.js.map +1 -1
- package/lib/esm/src/executeRemoteTxn.js.map +1 -1
- package/lib/esm/src/fetchBackwardsCompatibleIdl.js.map +1 -1
- package/lib/esm/src/idl/voter_stake_registry.json +234 -152
- package/lib/esm/src/mplAssetAPI.js.map +1 -1
- package/lib/esm/src/priorityFees.js.map +1 -1
- package/lib/esm/src/proofArgsAndAccounts.js.map +1 -1
- package/lib/esm/src/token.js.map +1 -1
- package/lib/esm/src/transaction.js.map +1 -1
- package/lib/esm/src/utils.js.map +1 -1
- package/lib/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/src/executeRemoteTxn.d.ts +0 -1
- package/lib/types/src/executeRemoteTxn.d.ts.map +1 -1
- package/lib/types/src/mplAssetAPI.d.ts +0 -1
- package/lib/types/src/mplAssetAPI.d.ts.map +1 -1
- package/lib/types/src/priorityFees.d.ts.map +1 -1
- package/lib/types/src/token.d.ts +0 -1
- package/lib/types/src/token.d.ts.map +1 -1
- package/lib/types/src/transaction.d.ts +0 -1
- package/lib/types/src/transaction.d.ts.map +1 -1
- package/lib/types/src/utils.d.ts.map +1 -1
- package/package.json +14 -13
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"address": "hvsrNC3NKbcryqDs2DocYHZ9yPKEVzdSjQG6RVtK1s8",
|
|
3
3
|
"metadata": {
|
|
4
4
|
"name": "voter_stake_registry",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.6",
|
|
6
6
|
"spec": "0.1.0",
|
|
7
7
|
"description": "Heliums voter weight plugin for spl-governance"
|
|
8
8
|
},
|
|
@@ -145,6 +145,7 @@
|
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
"name": "registrar",
|
|
148
|
+
"writable": true,
|
|
148
149
|
"relations": [
|
|
149
150
|
"position"
|
|
150
151
|
]
|
|
@@ -1914,48 +1915,18 @@
|
|
|
1914
1915
|
"accounts": [
|
|
1915
1916
|
{
|
|
1916
1917
|
"name": "rent_refund",
|
|
1917
|
-
"writable": true
|
|
1918
|
-
"relations": [
|
|
1919
|
-
"marker"
|
|
1920
|
-
]
|
|
1918
|
+
"writable": true
|
|
1921
1919
|
},
|
|
1922
1920
|
{
|
|
1923
1921
|
"name": "marker",
|
|
1924
|
-
"writable": true
|
|
1925
|
-
"pda": {
|
|
1926
|
-
"seeds": [
|
|
1927
|
-
{
|
|
1928
|
-
"kind": "const",
|
|
1929
|
-
"value": [
|
|
1930
|
-
109,
|
|
1931
|
-
97,
|
|
1932
|
-
114,
|
|
1933
|
-
107,
|
|
1934
|
-
101,
|
|
1935
|
-
114
|
|
1936
|
-
]
|
|
1937
|
-
},
|
|
1938
|
-
{
|
|
1939
|
-
"kind": "account",
|
|
1940
|
-
"path": "marker.mint",
|
|
1941
|
-
"account": "VoteMarkerV0"
|
|
1942
|
-
},
|
|
1943
|
-
{
|
|
1944
|
-
"kind": "account",
|
|
1945
|
-
"path": "proposal"
|
|
1946
|
-
}
|
|
1947
|
-
]
|
|
1948
|
-
}
|
|
1922
|
+
"writable": true
|
|
1949
1923
|
},
|
|
1950
1924
|
{
|
|
1951
1925
|
"name": "position",
|
|
1952
1926
|
"writable": true
|
|
1953
1927
|
},
|
|
1954
1928
|
{
|
|
1955
|
-
"name": "proposal"
|
|
1956
|
-
"relations": [
|
|
1957
|
-
"marker"
|
|
1958
|
-
]
|
|
1929
|
+
"name": "proposal"
|
|
1959
1930
|
},
|
|
1960
1931
|
{
|
|
1961
1932
|
"name": "system_program",
|
|
@@ -2270,16 +2241,41 @@
|
|
|
2270
2241
|
]
|
|
2271
2242
|
},
|
|
2272
2243
|
{
|
|
2273
|
-
"name": "
|
|
2244
|
+
"name": "temp_release_position_v0",
|
|
2274
2245
|
"discriminator": [
|
|
2275
2246
|
18,
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2247
|
+
41,
|
|
2248
|
+
232,
|
|
2249
|
+
50,
|
|
2250
|
+
253,
|
|
2251
|
+
184,
|
|
2252
|
+
27,
|
|
2253
|
+
43
|
|
2254
|
+
],
|
|
2255
|
+
"accounts": [
|
|
2256
|
+
{
|
|
2257
|
+
"name": "authority",
|
|
2258
|
+
"signer": true,
|
|
2259
|
+
"address": "hprdnjkbziK8NqhThmAn5Gu4XqrBbctX8du4PfJdgvW"
|
|
2260
|
+
},
|
|
2261
|
+
{
|
|
2262
|
+
"name": "position",
|
|
2263
|
+
"writable": true
|
|
2264
|
+
}
|
|
2265
|
+
],
|
|
2266
|
+
"args": []
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
"name": "transfer_position_v0",
|
|
2270
|
+
"discriminator": [
|
|
2271
|
+
13,
|
|
2272
|
+
19,
|
|
2273
|
+
112,
|
|
2274
|
+
27,
|
|
2275
|
+
248,
|
|
2276
|
+
208,
|
|
2277
|
+
38,
|
|
2278
|
+
145
|
|
2283
2279
|
],
|
|
2284
2280
|
"accounts": [
|
|
2285
2281
|
{
|
|
@@ -2288,131 +2284,235 @@
|
|
|
2288
2284
|
"signer": true
|
|
2289
2285
|
},
|
|
2290
2286
|
{
|
|
2291
|
-
"name": "
|
|
2292
|
-
"writable": true,
|
|
2287
|
+
"name": "position",
|
|
2293
2288
|
"pda": {
|
|
2294
2289
|
"seeds": [
|
|
2295
2290
|
{
|
|
2296
2291
|
"kind": "const",
|
|
2297
2292
|
"value": [
|
|
2298
2293
|
112,
|
|
2299
|
-
114,
|
|
2300
2294
|
111,
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
107,
|
|
2308
|
-
101,
|
|
2309
|
-
114
|
|
2295
|
+
115,
|
|
2296
|
+
105,
|
|
2297
|
+
116,
|
|
2298
|
+
105,
|
|
2299
|
+
111,
|
|
2300
|
+
110
|
|
2310
2301
|
]
|
|
2311
2302
|
},
|
|
2312
2303
|
{
|
|
2313
2304
|
"kind": "account",
|
|
2314
|
-
"path": "
|
|
2315
|
-
},
|
|
2316
|
-
{
|
|
2317
|
-
"kind": "account",
|
|
2318
|
-
"path": "proposal"
|
|
2305
|
+
"path": "mint"
|
|
2319
2306
|
}
|
|
2320
2307
|
]
|
|
2321
2308
|
}
|
|
2322
2309
|
},
|
|
2323
2310
|
{
|
|
2324
|
-
"name": "
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
"address": "hprdnjkbziK8NqhThmAn5Gu4XqrBbctX8du4PfJdgvW"
|
|
2311
|
+
"name": "mint",
|
|
2312
|
+
"writable": true,
|
|
2313
|
+
"relations": [
|
|
2314
|
+
"position"
|
|
2315
|
+
]
|
|
2330
2316
|
},
|
|
2331
2317
|
{
|
|
2332
|
-
"name": "
|
|
2318
|
+
"name": "from_token_account",
|
|
2319
|
+
"writable": true,
|
|
2320
|
+
"pda": {
|
|
2321
|
+
"seeds": [
|
|
2322
|
+
{
|
|
2323
|
+
"kind": "account",
|
|
2324
|
+
"path": "from"
|
|
2325
|
+
},
|
|
2326
|
+
{
|
|
2327
|
+
"kind": "const",
|
|
2328
|
+
"value": [
|
|
2329
|
+
6,
|
|
2330
|
+
221,
|
|
2331
|
+
246,
|
|
2332
|
+
225,
|
|
2333
|
+
215,
|
|
2334
|
+
101,
|
|
2335
|
+
161,
|
|
2336
|
+
147,
|
|
2337
|
+
217,
|
|
2338
|
+
203,
|
|
2339
|
+
225,
|
|
2340
|
+
70,
|
|
2341
|
+
206,
|
|
2342
|
+
235,
|
|
2343
|
+
121,
|
|
2344
|
+
172,
|
|
2345
|
+
28,
|
|
2346
|
+
180,
|
|
2347
|
+
133,
|
|
2348
|
+
237,
|
|
2349
|
+
95,
|
|
2350
|
+
91,
|
|
2351
|
+
55,
|
|
2352
|
+
145,
|
|
2353
|
+
58,
|
|
2354
|
+
140,
|
|
2355
|
+
245,
|
|
2356
|
+
133,
|
|
2357
|
+
126,
|
|
2358
|
+
255,
|
|
2359
|
+
0,
|
|
2360
|
+
169
|
|
2361
|
+
]
|
|
2362
|
+
},
|
|
2363
|
+
{
|
|
2364
|
+
"kind": "account",
|
|
2365
|
+
"path": "mint"
|
|
2366
|
+
}
|
|
2367
|
+
],
|
|
2368
|
+
"program": {
|
|
2369
|
+
"kind": "const",
|
|
2370
|
+
"value": [
|
|
2371
|
+
140,
|
|
2372
|
+
151,
|
|
2373
|
+
37,
|
|
2374
|
+
143,
|
|
2375
|
+
78,
|
|
2376
|
+
36,
|
|
2377
|
+
137,
|
|
2378
|
+
241,
|
|
2379
|
+
187,
|
|
2380
|
+
61,
|
|
2381
|
+
16,
|
|
2382
|
+
41,
|
|
2383
|
+
20,
|
|
2384
|
+
142,
|
|
2385
|
+
13,
|
|
2386
|
+
131,
|
|
2387
|
+
11,
|
|
2388
|
+
90,
|
|
2389
|
+
19,
|
|
2390
|
+
153,
|
|
2391
|
+
218,
|
|
2392
|
+
255,
|
|
2393
|
+
16,
|
|
2394
|
+
132,
|
|
2395
|
+
4,
|
|
2396
|
+
142,
|
|
2397
|
+
123,
|
|
2398
|
+
216,
|
|
2399
|
+
219,
|
|
2400
|
+
233,
|
|
2401
|
+
248,
|
|
2402
|
+
89
|
|
2403
|
+
]
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2333
2406
|
},
|
|
2334
2407
|
{
|
|
2335
|
-
"name": "
|
|
2336
|
-
"
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2408
|
+
"name": "to_token_account",
|
|
2409
|
+
"writable": true,
|
|
2410
|
+
"pda": {
|
|
2411
|
+
"seeds": [
|
|
2412
|
+
{
|
|
2413
|
+
"kind": "account",
|
|
2414
|
+
"path": "to"
|
|
2415
|
+
},
|
|
2416
|
+
{
|
|
2417
|
+
"kind": "const",
|
|
2418
|
+
"value": [
|
|
2419
|
+
6,
|
|
2420
|
+
221,
|
|
2421
|
+
246,
|
|
2422
|
+
225,
|
|
2423
|
+
215,
|
|
2424
|
+
101,
|
|
2425
|
+
161,
|
|
2426
|
+
147,
|
|
2427
|
+
217,
|
|
2428
|
+
203,
|
|
2429
|
+
225,
|
|
2430
|
+
70,
|
|
2431
|
+
206,
|
|
2432
|
+
235,
|
|
2433
|
+
121,
|
|
2434
|
+
172,
|
|
2435
|
+
28,
|
|
2436
|
+
180,
|
|
2437
|
+
133,
|
|
2438
|
+
237,
|
|
2439
|
+
95,
|
|
2440
|
+
91,
|
|
2441
|
+
55,
|
|
2442
|
+
145,
|
|
2443
|
+
58,
|
|
2444
|
+
140,
|
|
2445
|
+
245,
|
|
2446
|
+
133,
|
|
2447
|
+
126,
|
|
2448
|
+
255,
|
|
2449
|
+
0,
|
|
2450
|
+
169
|
|
2451
|
+
]
|
|
2452
|
+
},
|
|
2453
|
+
{
|
|
2454
|
+
"kind": "account",
|
|
2455
|
+
"path": "mint"
|
|
2456
|
+
}
|
|
2457
|
+
],
|
|
2458
|
+
"program": {
|
|
2459
|
+
"kind": "const",
|
|
2460
|
+
"value": [
|
|
2461
|
+
140,
|
|
2462
|
+
151,
|
|
2463
|
+
37,
|
|
2464
|
+
143,
|
|
2465
|
+
78,
|
|
2466
|
+
36,
|
|
2467
|
+
137,
|
|
2468
|
+
241,
|
|
2469
|
+
187,
|
|
2470
|
+
61,
|
|
2471
|
+
16,
|
|
2472
|
+
41,
|
|
2473
|
+
20,
|
|
2474
|
+
142,
|
|
2475
|
+
13,
|
|
2476
|
+
131,
|
|
2477
|
+
11,
|
|
2478
|
+
90,
|
|
2479
|
+
19,
|
|
2480
|
+
153,
|
|
2481
|
+
218,
|
|
2482
|
+
255,
|
|
2483
|
+
16,
|
|
2484
|
+
132,
|
|
2485
|
+
4,
|
|
2486
|
+
142,
|
|
2487
|
+
123,
|
|
2488
|
+
216,
|
|
2489
|
+
219,
|
|
2490
|
+
233,
|
|
2491
|
+
248,
|
|
2492
|
+
89
|
|
2493
|
+
]
|
|
2345
2494
|
}
|
|
2346
2495
|
}
|
|
2347
|
-
}
|
|
2348
|
-
]
|
|
2349
|
-
},
|
|
2350
|
-
{
|
|
2351
|
-
"name": "temp_backfill_recent_proposals",
|
|
2352
|
-
"discriminator": [
|
|
2353
|
-
248,
|
|
2354
|
-
23,
|
|
2355
|
-
82,
|
|
2356
|
-
43,
|
|
2357
|
-
69,
|
|
2358
|
-
233,
|
|
2359
|
-
74,
|
|
2360
|
-
26
|
|
2361
|
-
],
|
|
2362
|
-
"accounts": [
|
|
2363
|
-
{
|
|
2364
|
-
"name": "authority",
|
|
2365
|
-
"signer": true,
|
|
2366
|
-
"address": "hprdnjkbziK8NqhThmAn5Gu4XqrBbctX8du4PfJdgvW"
|
|
2367
2496
|
},
|
|
2368
2497
|
{
|
|
2369
|
-
"name": "
|
|
2370
|
-
"
|
|
2371
|
-
"relations": [
|
|
2372
|
-
"position"
|
|
2373
|
-
]
|
|
2498
|
+
"name": "from",
|
|
2499
|
+
"signer": true
|
|
2374
2500
|
},
|
|
2375
2501
|
{
|
|
2376
|
-
"name": "
|
|
2377
|
-
"
|
|
2502
|
+
"name": "to",
|
|
2503
|
+
"signer": true
|
|
2378
2504
|
},
|
|
2379
2505
|
{
|
|
2380
2506
|
"name": "system_program",
|
|
2381
2507
|
"address": "11111111111111111111111111111111"
|
|
2382
|
-
}
|
|
2383
|
-
],
|
|
2384
|
-
"args": [
|
|
2385
|
-
{
|
|
2386
|
-
"name": "args",
|
|
2387
|
-
"type": {
|
|
2388
|
-
"defined": {
|
|
2389
|
-
"name": "TempBackfillRecentProposalsArgs"
|
|
2390
|
-
}
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
]
|
|
2394
|
-
},
|
|
2395
|
-
{
|
|
2396
|
-
"name": "temp_release_position_v0",
|
|
2397
|
-
"discriminator": [
|
|
2398
|
-
18,
|
|
2399
|
-
41,
|
|
2400
|
-
232,
|
|
2401
|
-
50,
|
|
2402
|
-
253,
|
|
2403
|
-
184,
|
|
2404
|
-
27,
|
|
2405
|
-
43
|
|
2406
|
-
],
|
|
2407
|
-
"accounts": [
|
|
2508
|
+
},
|
|
2408
2509
|
{
|
|
2409
|
-
"name": "
|
|
2410
|
-
"
|
|
2411
|
-
"address": "hprdnjkbziK8NqhThmAn5Gu4XqrBbctX8du4PfJdgvW"
|
|
2510
|
+
"name": "token_program",
|
|
2511
|
+
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
2412
2512
|
},
|
|
2413
2513
|
{
|
|
2414
|
-
"name": "
|
|
2415
|
-
"
|
|
2514
|
+
"name": "associated_token_program",
|
|
2515
|
+
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
2416
2516
|
}
|
|
2417
2517
|
],
|
|
2418
2518
|
"args": []
|
|
@@ -4330,24 +4430,6 @@
|
|
|
4330
4430
|
]
|
|
4331
4431
|
}
|
|
4332
4432
|
},
|
|
4333
|
-
{
|
|
4334
|
-
"name": "TempBackfillRecentProposalsArgs",
|
|
4335
|
-
"type": {
|
|
4336
|
-
"kind": "struct",
|
|
4337
|
-
"fields": [
|
|
4338
|
-
{
|
|
4339
|
-
"name": "recent_proposals",
|
|
4340
|
-
"type": {
|
|
4341
|
-
"vec": {
|
|
4342
|
-
"defined": {
|
|
4343
|
-
"name": "RecentProposal"
|
|
4344
|
-
}
|
|
4345
|
-
}
|
|
4346
|
-
}
|
|
4347
|
-
}
|
|
4348
|
-
]
|
|
4349
|
-
}
|
|
4350
|
-
},
|
|
4351
4433
|
{
|
|
4352
4434
|
"name": "TransferArgsV0",
|
|
4353
4435
|
"type": {
|
package/lib/cjs/mplAssetAPI.js
CHANGED
|
@@ -23,7 +23,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.getAsset = getAsset;
|
|
27
|
+
exports.getAssetBatch = getAssetBatch;
|
|
28
|
+
exports.getAssets = getAssets;
|
|
29
|
+
exports.getAssetProof = getAssetProof;
|
|
30
|
+
exports.getAssetProofBatch = getAssetProofBatch;
|
|
31
|
+
exports.getAssetsByOwnerWithPageInfo = getAssetsByOwnerWithPageInfo;
|
|
32
|
+
exports.getAssetsByOwner = getAssetsByOwner;
|
|
33
|
+
exports.searchAssets = searchAssets;
|
|
34
|
+
exports.searchAssetsWithPageInfo = searchAssetsWithPageInfo;
|
|
35
|
+
exports.getAssetsByGroup = getAssetsByGroup;
|
|
36
|
+
exports.getAssetsByCreator = getAssetsByCreator;
|
|
27
37
|
const web3_js_1 = require("@solana/web3.js");
|
|
28
38
|
const axios_1 = __importDefault(require("axios"));
|
|
29
39
|
// @ts-ignore
|
|
@@ -56,7 +66,6 @@ function getAsset(url, assetId) {
|
|
|
56
66
|
}
|
|
57
67
|
});
|
|
58
68
|
}
|
|
59
|
-
exports.getAsset = getAsset;
|
|
60
69
|
function getAssetBatch(url, assetIds) {
|
|
61
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
71
|
try {
|
|
@@ -87,7 +96,6 @@ function getAssetBatch(url, assetIds) {
|
|
|
87
96
|
}
|
|
88
97
|
});
|
|
89
98
|
}
|
|
90
|
-
exports.getAssetBatch = getAssetBatch;
|
|
91
99
|
function getAssets(url, assetIds) {
|
|
92
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
101
|
try {
|
|
@@ -131,7 +139,6 @@ function getAssets(url, assetIds) {
|
|
|
131
139
|
}
|
|
132
140
|
});
|
|
133
141
|
}
|
|
134
|
-
exports.getAssets = getAssets;
|
|
135
142
|
function toAsset(result) {
|
|
136
143
|
return Object.assign(Object.assign({}, result), { creators: result.creators.map(({ address, share, verified, }) => ({
|
|
137
144
|
share,
|
|
@@ -177,7 +184,6 @@ function getAssetProof(url, assetId) {
|
|
|
177
184
|
}
|
|
178
185
|
});
|
|
179
186
|
}
|
|
180
|
-
exports.getAssetProof = getAssetProof;
|
|
181
187
|
function getAssetProofBatch(url, assetIds) {
|
|
182
188
|
return __awaiter(this, void 0, void 0, function* () {
|
|
183
189
|
try {
|
|
@@ -215,10 +221,9 @@ function getAssetProofBatch(url, assetIds) {
|
|
|
215
221
|
}
|
|
216
222
|
});
|
|
217
223
|
}
|
|
218
|
-
|
|
219
|
-
function
|
|
220
|
-
|
|
221
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
function getAssetsByOwnerWithPageInfo(url_1, wallet_1) {
|
|
225
|
+
return __awaiter(this, arguments, void 0, function* (url, wallet, { sortBy = { sortBy: "created", sortDirection: "asc" }, limit = 50, page = 1, before = "", after = "", } = {}) {
|
|
226
|
+
var _a;
|
|
222
227
|
try {
|
|
223
228
|
const response = yield axios_1.default.post(url, {
|
|
224
229
|
jsonrpc: "2.0",
|
|
@@ -250,29 +255,26 @@ function getAssetsByOwnerWithPageInfo(url, wallet, { sortBy = { sortBy: "created
|
|
|
250
255
|
}
|
|
251
256
|
});
|
|
252
257
|
}
|
|
253
|
-
exports.getAssetsByOwnerWithPageInfo = getAssetsByOwnerWithPageInfo;
|
|
254
258
|
/**
|
|
255
259
|
* Get assets by owner address.
|
|
256
260
|
* Returns just the assets array for backward compatibility.
|
|
257
261
|
* Use getAssetsByOwnerWithPageInfo for pagination info.
|
|
258
262
|
*/
|
|
259
|
-
function getAssetsByOwner(
|
|
260
|
-
return __awaiter(this,
|
|
263
|
+
function getAssetsByOwner(url_1, wallet_1) {
|
|
264
|
+
return __awaiter(this, arguments, void 0, function* (url, wallet, opts = {}) {
|
|
261
265
|
const result = yield getAssetsByOwnerWithPageInfo(url, wallet, opts);
|
|
262
266
|
return result.items;
|
|
263
267
|
});
|
|
264
268
|
}
|
|
265
|
-
exports.getAssetsByOwner = getAssetsByOwner;
|
|
266
269
|
function searchAssets(url, opts) {
|
|
267
270
|
return __awaiter(this, void 0, void 0, function* () {
|
|
268
271
|
return (yield searchAssetsWithPageInfo(url, opts)).items;
|
|
269
272
|
});
|
|
270
273
|
}
|
|
271
|
-
exports.searchAssets = searchAssets;
|
|
272
274
|
function searchAssetsWithPageInfo(url, _a) {
|
|
273
|
-
var _b;
|
|
274
|
-
var { creatorVerified = true, sortBy = { sortBy: "created", sortDirection: "asc" }, page = 1, limit = 1000, collection, tokenType } = _a, rest = __rest(_a, ["creatorVerified", "sortBy", "page", "limit", "collection", "tokenType"]);
|
|
275
275
|
return __awaiter(this, void 0, void 0, function* () {
|
|
276
|
+
var _b;
|
|
277
|
+
var { creatorVerified = true, sortBy = { sortBy: "created", sortDirection: "asc" }, page = 1, limit = 1000, collection, tokenType } = _a, rest = __rest(_a, ["creatorVerified", "sortBy", "page", "limit", "collection", "tokenType"]);
|
|
276
278
|
const params = Object.assign(Object.assign({ page,
|
|
277
279
|
limit, sortBy: tokenType && ["all", "fungible"].includes(tokenType) ? null : sortBy, creatorVerified: tokenType && ["all", "fungible"].includes(tokenType)
|
|
278
280
|
? null
|
|
@@ -307,7 +309,6 @@ function searchAssetsWithPageInfo(url, _a) {
|
|
|
307
309
|
}
|
|
308
310
|
});
|
|
309
311
|
}
|
|
310
|
-
exports.searchAssetsWithPageInfo = searchAssetsWithPageInfo;
|
|
311
312
|
/**
|
|
312
313
|
* Get assets by group (e.g., collection).
|
|
313
314
|
* More performant than searchAssets for collection queries.
|
|
@@ -316,9 +317,9 @@ exports.searchAssetsWithPageInfo = searchAssetsWithPageInfo;
|
|
|
316
317
|
* For cursor-based pagination, pass the `cursor` from the previous response.
|
|
317
318
|
* The API will return the next page of items. Continue until cursor is undefined.
|
|
318
319
|
*/
|
|
319
|
-
function getAssetsByGroup(
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
function getAssetsByGroup(url_1, _a) {
|
|
321
|
+
return __awaiter(this, arguments, void 0, function* (url, { groupKey = "collection", groupValue, page, limit = 1000, cursor, }) {
|
|
322
|
+
var _b;
|
|
322
323
|
try {
|
|
323
324
|
const params = {
|
|
324
325
|
groupKey,
|
|
@@ -348,7 +349,7 @@ function getAssetsByGroup(url, { groupKey = "collection", groupValue, page, limi
|
|
|
348
349
|
}
|
|
349
350
|
const result = response.data.result;
|
|
350
351
|
return {
|
|
351
|
-
items: ((
|
|
352
|
+
items: ((_b = result.items) === null || _b === void 0 ? void 0 : _b.map(toAsset)) || [],
|
|
352
353
|
limit: result.limit || limit,
|
|
353
354
|
total: result.total || 0,
|
|
354
355
|
page: result.page,
|
|
@@ -361,14 +362,13 @@ function getAssetsByGroup(url, { groupKey = "collection", groupValue, page, limi
|
|
|
361
362
|
}
|
|
362
363
|
});
|
|
363
364
|
}
|
|
364
|
-
exports.getAssetsByGroup = getAssetsByGroup;
|
|
365
365
|
/**
|
|
366
366
|
* Get assets by creator address.
|
|
367
367
|
* More performant than searchAssets for creator queries.
|
|
368
368
|
*/
|
|
369
|
-
function getAssetsByCreator(
|
|
370
|
-
|
|
371
|
-
|
|
369
|
+
function getAssetsByCreator(url_1, _a) {
|
|
370
|
+
return __awaiter(this, arguments, void 0, function* (url, { creatorAddress, onlyVerified = true, page = 1, limit = 1000, }) {
|
|
371
|
+
var _b;
|
|
372
372
|
try {
|
|
373
373
|
const response = yield axios_1.default.post(url, {
|
|
374
374
|
jsonrpc: "2.0",
|
|
@@ -391,7 +391,7 @@ function getAssetsByCreator(url, { creatorAddress, onlyVerified = true, page = 1
|
|
|
391
391
|
}
|
|
392
392
|
const result = response.data.result;
|
|
393
393
|
return {
|
|
394
|
-
items: ((
|
|
394
|
+
items: ((_b = result.items) === null || _b === void 0 ? void 0 : _b.map(toAsset)) || [],
|
|
395
395
|
limit: result.limit || limit,
|
|
396
396
|
total: result.total || 0,
|
|
397
397
|
page: result.page || page,
|
|
@@ -403,5 +403,4 @@ function getAssetsByCreator(url, { creatorAddress, onlyVerified = true, page = 1
|
|
|
403
403
|
}
|
|
404
404
|
});
|
|
405
405
|
}
|
|
406
|
-
exports.getAssetsByCreator = getAssetsByCreator;
|
|
407
406
|
//# sourceMappingURL=mplAssetAPI.js.map
|