@nightlylabs/dex-sdk 0.0.113 → 0.1.1
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/dist/index.cjs +45 -284
- package/dist/index.d.cts +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.js +49 -284
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -60,7 +60,6 @@ module.exports = __toCommonJS(index_exports);
|
|
|
60
60
|
|
|
61
61
|
// src/client.ts
|
|
62
62
|
var import_ts_sdk2 = require("@aptos-labs/ts-sdk");
|
|
63
|
-
var import_surf = require("@thalalabs/surf");
|
|
64
63
|
var import_isomorphic_ws = __toESM(require("isomorphic-ws"), 1);
|
|
65
64
|
var import_uuid = require("uuid");
|
|
66
65
|
|
|
@@ -1382,7 +1381,6 @@ var Client = class _Client {
|
|
|
1382
1381
|
};
|
|
1383
1382
|
this._aptos = connection;
|
|
1384
1383
|
this._chainId = chainId || 188;
|
|
1385
|
-
this._surf = (0, import_surf.createSurfClient)(this._aptos);
|
|
1386
1384
|
this._apiKey = apiKey || generateApiKey();
|
|
1387
1385
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
1388
1386
|
this._serverUrl = url || "https://api.dev.neony.exchange";
|
|
@@ -2101,9 +2099,6 @@ function parseEntryFunctionAbi(args) {
|
|
|
2101
2099
|
};
|
|
2102
2100
|
}
|
|
2103
2101
|
|
|
2104
|
-
// src/testFaucet.ts
|
|
2105
|
-
var import_surf2 = require("@thalalabs/surf");
|
|
2106
|
-
|
|
2107
2102
|
// generated_types/faucetEntrypoints.ts
|
|
2108
2103
|
var ABI26 = {
|
|
2109
2104
|
"address": "0xf9e7275e05b753979cd91727fae21c90f9ba2b2e8224e3a7d8f40afd528953b1",
|
|
@@ -2139,256 +2134,8 @@ var ABI26 = {
|
|
|
2139
2134
|
};
|
|
2140
2135
|
var faucetEntrypoints_default = ABI26;
|
|
2141
2136
|
|
|
2142
|
-
// generated_types/testFaucet.ts
|
|
2143
|
-
var ABI27 = {
|
|
2144
|
-
"address": "0xf9e7275e05b753979cd91727fae21c90f9ba2b2e8224e3a7d8f40afd528953b1",
|
|
2145
|
-
"name": "test_faucet",
|
|
2146
|
-
"friends": [],
|
|
2147
|
-
"exposed_functions": [
|
|
2148
|
-
{
|
|
2149
|
-
"name": "create_fungible_asset",
|
|
2150
|
-
"visibility": "public",
|
|
2151
|
-
"is_entry": false,
|
|
2152
|
-
"is_view": false,
|
|
2153
|
-
"generic_type_params": [],
|
|
2154
|
-
"params": [
|
|
2155
|
-
"&signer",
|
|
2156
|
-
"vector<u8>",
|
|
2157
|
-
"vector<u8>",
|
|
2158
|
-
"u8",
|
|
2159
|
-
"u128"
|
|
2160
|
-
],
|
|
2161
|
-
"return": [
|
|
2162
|
-
"0x1::fungible_asset::MintRef",
|
|
2163
|
-
"0x1::fungible_asset::TransferRef",
|
|
2164
|
-
"0x1::fungible_asset::BurnRef",
|
|
2165
|
-
"0x1::fungible_asset::MutateMetadataRef",
|
|
2166
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2167
|
-
]
|
|
2168
|
-
},
|
|
2169
|
-
{
|
|
2170
|
-
"name": "create_test_token",
|
|
2171
|
-
"visibility": "public",
|
|
2172
|
-
"is_entry": false,
|
|
2173
|
-
"is_view": false,
|
|
2174
|
-
"generic_type_params": [],
|
|
2175
|
-
"params": [
|
|
2176
|
-
"&signer",
|
|
2177
|
-
"vector<u8>"
|
|
2178
|
-
],
|
|
2179
|
-
"return": [
|
|
2180
|
-
"0x1::object::ConstructorRef",
|
|
2181
|
-
"0x1::object::Object<0xf9e7275e05b753979cd91727fae21c90f9ba2b2e8224e3a7d8f40afd528953b1::test_faucet::Token>"
|
|
2182
|
-
]
|
|
2183
|
-
},
|
|
2184
|
-
{
|
|
2185
|
-
"name": "get_faucet_data",
|
|
2186
|
-
"visibility": "public",
|
|
2187
|
-
"is_entry": false,
|
|
2188
|
-
"is_view": true,
|
|
2189
|
-
"generic_type_params": [],
|
|
2190
|
-
"params": [],
|
|
2191
|
-
"return": [
|
|
2192
|
-
"vector<vector<u8>>",
|
|
2193
|
-
"vector<address>"
|
|
2194
|
-
]
|
|
2195
|
-
},
|
|
2196
|
-
{
|
|
2197
|
-
"name": "get_token_data",
|
|
2198
|
-
"visibility": "public",
|
|
2199
|
-
"is_entry": false,
|
|
2200
|
-
"is_view": true,
|
|
2201
|
-
"generic_type_params": [],
|
|
2202
|
-
"params": [
|
|
2203
|
-
"vector<u8>"
|
|
2204
|
-
],
|
|
2205
|
-
"return": [
|
|
2206
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2207
|
-
]
|
|
2208
|
-
},
|
|
2209
|
-
{
|
|
2210
|
-
"name": "init_test_apt",
|
|
2211
|
-
"visibility": "public",
|
|
2212
|
-
"is_entry": false,
|
|
2213
|
-
"is_view": false,
|
|
2214
|
-
"generic_type_params": [],
|
|
2215
|
-
"params": [
|
|
2216
|
-
"&signer"
|
|
2217
|
-
],
|
|
2218
|
-
"return": [
|
|
2219
|
-
"0x1::fungible_asset::MintRef",
|
|
2220
|
-
"0x1::fungible_asset::TransferRef",
|
|
2221
|
-
"0x1::fungible_asset::BurnRef",
|
|
2222
|
-
"0x1::fungible_asset::MutateMetadataRef",
|
|
2223
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2224
|
-
]
|
|
2225
|
-
},
|
|
2226
|
-
{
|
|
2227
|
-
"name": "init_test_btc",
|
|
2228
|
-
"visibility": "public",
|
|
2229
|
-
"is_entry": false,
|
|
2230
|
-
"is_view": false,
|
|
2231
|
-
"generic_type_params": [],
|
|
2232
|
-
"params": [
|
|
2233
|
-
"&signer"
|
|
2234
|
-
],
|
|
2235
|
-
"return": [
|
|
2236
|
-
"0x1::fungible_asset::MintRef",
|
|
2237
|
-
"0x1::fungible_asset::TransferRef",
|
|
2238
|
-
"0x1::fungible_asset::BurnRef",
|
|
2239
|
-
"0x1::fungible_asset::MutateMetadataRef",
|
|
2240
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2241
|
-
]
|
|
2242
|
-
},
|
|
2243
|
-
{
|
|
2244
|
-
"name": "init_test_metadata",
|
|
2245
|
-
"visibility": "public",
|
|
2246
|
-
"is_entry": false,
|
|
2247
|
-
"is_view": false,
|
|
2248
|
-
"generic_type_params": [],
|
|
2249
|
-
"params": [
|
|
2250
|
-
"&0x1::object::ConstructorRef",
|
|
2251
|
-
"u128",
|
|
2252
|
-
"vector<u8>",
|
|
2253
|
-
"vector<u8>",
|
|
2254
|
-
"u8"
|
|
2255
|
-
],
|
|
2256
|
-
"return": [
|
|
2257
|
-
"0x1::fungible_asset::MintRef",
|
|
2258
|
-
"0x1::fungible_asset::TransferRef",
|
|
2259
|
-
"0x1::fungible_asset::BurnRef",
|
|
2260
|
-
"0x1::fungible_asset::MutateMetadataRef"
|
|
2261
|
-
]
|
|
2262
|
-
},
|
|
2263
|
-
{
|
|
2264
|
-
"name": "init_test_sol",
|
|
2265
|
-
"visibility": "public",
|
|
2266
|
-
"is_entry": false,
|
|
2267
|
-
"is_view": false,
|
|
2268
|
-
"generic_type_params": [],
|
|
2269
|
-
"params": [
|
|
2270
|
-
"&signer"
|
|
2271
|
-
],
|
|
2272
|
-
"return": [
|
|
2273
|
-
"0x1::fungible_asset::MintRef",
|
|
2274
|
-
"0x1::fungible_asset::TransferRef",
|
|
2275
|
-
"0x1::fungible_asset::BurnRef",
|
|
2276
|
-
"0x1::fungible_asset::MutateMetadataRef",
|
|
2277
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2278
|
-
]
|
|
2279
|
-
},
|
|
2280
|
-
{
|
|
2281
|
-
"name": "init_test_usdc",
|
|
2282
|
-
"visibility": "public",
|
|
2283
|
-
"is_entry": false,
|
|
2284
|
-
"is_view": false,
|
|
2285
|
-
"generic_type_params": [],
|
|
2286
|
-
"params": [
|
|
2287
|
-
"&signer"
|
|
2288
|
-
],
|
|
2289
|
-
"return": [
|
|
2290
|
-
"0x1::fungible_asset::MintRef",
|
|
2291
|
-
"0x1::fungible_asset::TransferRef",
|
|
2292
|
-
"0x1::fungible_asset::BurnRef",
|
|
2293
|
-
"0x1::fungible_asset::MutateMetadataRef",
|
|
2294
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2295
|
-
]
|
|
2296
|
-
},
|
|
2297
|
-
{
|
|
2298
|
-
"name": "initialize_faucet",
|
|
2299
|
-
"visibility": "public",
|
|
2300
|
-
"is_entry": false,
|
|
2301
|
-
"is_view": false,
|
|
2302
|
-
"generic_type_params": [],
|
|
2303
|
-
"params": [
|
|
2304
|
-
"&signer"
|
|
2305
|
-
],
|
|
2306
|
-
"return": []
|
|
2307
|
-
},
|
|
2308
|
-
{
|
|
2309
|
-
"name": "mint_token",
|
|
2310
|
-
"visibility": "public",
|
|
2311
|
-
"is_entry": false,
|
|
2312
|
-
"is_view": false,
|
|
2313
|
-
"generic_type_params": [],
|
|
2314
|
-
"params": [
|
|
2315
|
-
"address",
|
|
2316
|
-
"vector<u8>",
|
|
2317
|
-
"u64"
|
|
2318
|
-
],
|
|
2319
|
-
"return": []
|
|
2320
|
-
},
|
|
2321
|
-
{
|
|
2322
|
-
"name": "new_faucet_token",
|
|
2323
|
-
"visibility": "public",
|
|
2324
|
-
"is_entry": false,
|
|
2325
|
-
"is_view": false,
|
|
2326
|
-
"generic_type_params": [],
|
|
2327
|
-
"params": [
|
|
2328
|
-
"0x1::fungible_asset::MintRef",
|
|
2329
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2330
|
-
],
|
|
2331
|
-
"return": [
|
|
2332
|
-
"0xf9e7275e05b753979cd91727fae21c90f9ba2b2e8224e3a7d8f40afd528953b1::test_faucet::FaucetToken"
|
|
2333
|
-
]
|
|
2334
|
-
}
|
|
2335
|
-
],
|
|
2336
|
-
"structs": [
|
|
2337
|
-
{
|
|
2338
|
-
"name": "Token",
|
|
2339
|
-
"is_native": false,
|
|
2340
|
-
"is_event": false,
|
|
2341
|
-
"abilities": [
|
|
2342
|
-
"key"
|
|
2343
|
-
],
|
|
2344
|
-
"generic_type_params": [],
|
|
2345
|
-
"fields": [
|
|
2346
|
-
{
|
|
2347
|
-
"name": "dummy_field",
|
|
2348
|
-
"type": "bool"
|
|
2349
|
-
}
|
|
2350
|
-
]
|
|
2351
|
-
},
|
|
2352
|
-
{
|
|
2353
|
-
"name": "Faucet",
|
|
2354
|
-
"is_native": false,
|
|
2355
|
-
"is_event": false,
|
|
2356
|
-
"abilities": [
|
|
2357
|
-
"store",
|
|
2358
|
-
"key"
|
|
2359
|
-
],
|
|
2360
|
-
"generic_type_params": [],
|
|
2361
|
-
"fields": [
|
|
2362
|
-
{
|
|
2363
|
-
"name": "tokens",
|
|
2364
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>, 0xf9e7275e05b753979cd91727fae21c90f9ba2b2e8224e3a7d8f40afd528953b1::test_faucet::FaucetToken>"
|
|
2365
|
-
}
|
|
2366
|
-
]
|
|
2367
|
-
},
|
|
2368
|
-
{
|
|
2369
|
-
"name": "FaucetToken",
|
|
2370
|
-
"is_native": false,
|
|
2371
|
-
"is_event": false,
|
|
2372
|
-
"abilities": [
|
|
2373
|
-
"store"
|
|
2374
|
-
],
|
|
2375
|
-
"generic_type_params": [],
|
|
2376
|
-
"fields": [
|
|
2377
|
-
{
|
|
2378
|
-
"name": "mint",
|
|
2379
|
-
"type": "0x1::fungible_asset::MintRef"
|
|
2380
|
-
},
|
|
2381
|
-
{
|
|
2382
|
-
"name": "token",
|
|
2383
|
-
"type": "0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2384
|
-
}
|
|
2385
|
-
]
|
|
2386
|
-
}
|
|
2387
|
-
]
|
|
2388
|
-
};
|
|
2389
|
-
var testFaucet_default = ABI27;
|
|
2390
|
-
|
|
2391
2137
|
// src/testFaucet.ts
|
|
2138
|
+
var import_ts_sdk3 = require("@aptos-labs/ts-sdk");
|
|
2392
2139
|
var TestFaucet = class _TestFaucet extends client_default {
|
|
2393
2140
|
constructor(connection, enableWs, url, apiKey) {
|
|
2394
2141
|
super(connection, enableWs, url, apiKey);
|
|
@@ -2396,52 +2143,66 @@ var TestFaucet = class _TestFaucet extends client_default {
|
|
|
2396
2143
|
static async create(connection, enableWs = false, url = "https://api.dev.neony.exchange", apiKey) {
|
|
2397
2144
|
return new _TestFaucet(connection, enableWs, url, apiKey);
|
|
2398
2145
|
}
|
|
2399
|
-
initFaucetPayload() {
|
|
2400
|
-
return (0,
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2146
|
+
async initFaucetPayload() {
|
|
2147
|
+
return await (0, import_ts_sdk3.generateTransactionPayload)({
|
|
2148
|
+
aptosConfig: this._aptos.config,
|
|
2149
|
+
abi: parseEntryFunctionAbi({
|
|
2150
|
+
moduleAbi: faucetEntrypoints_default,
|
|
2151
|
+
functionName: "initialize_faucet",
|
|
2152
|
+
moduleAddress: faucetEntrypoints_default.address,
|
|
2153
|
+
moduleName: faucetEntrypoints_default.name
|
|
2154
|
+
}),
|
|
2155
|
+
function: `${faucetEntrypoints_default.address}::${faucetEntrypoints_default.name}::initialize_faucet`,
|
|
2156
|
+
typeArguments: [],
|
|
2157
|
+
functionArguments: []
|
|
2404
2158
|
});
|
|
2405
2159
|
}
|
|
2406
2160
|
async initFaucet() {
|
|
2407
|
-
const payload = this.initFaucetPayload();
|
|
2161
|
+
const payload = await this.initFaucetPayload();
|
|
2408
2162
|
console.log(this._apiKey.accountAddress.toString());
|
|
2409
|
-
const tx =
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2163
|
+
const tx = new import_ts_sdk3.MultiAgentTransaction(
|
|
2164
|
+
await (0, import_ts_sdk3.generateRawTransaction)({
|
|
2165
|
+
sender: this._apiKey.accountAddress,
|
|
2166
|
+
aptosConfig: this._aptos.config,
|
|
2167
|
+
payload
|
|
2168
|
+
}),
|
|
2169
|
+
[]
|
|
2170
|
+
);
|
|
2414
2171
|
const signature = this._aptos.sign({
|
|
2415
2172
|
signer: this._apiKey,
|
|
2416
2173
|
transaction: tx
|
|
2417
2174
|
});
|
|
2418
|
-
return await this.
|
|
2175
|
+
return await this.submitSponsoredMultiAgentTransaction(tx, signature, []);
|
|
2419
2176
|
}
|
|
2420
|
-
mintTokenPayload(receiver, token, amount) {
|
|
2421
|
-
return (0,
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2177
|
+
async mintTokenPayload(receiver, token, amount) {
|
|
2178
|
+
return await (0, import_ts_sdk3.generateTransactionPayload)({
|
|
2179
|
+
aptosConfig: this._aptos.config,
|
|
2180
|
+
abi: parseEntryFunctionAbi({
|
|
2181
|
+
moduleAbi: faucetEntrypoints_default,
|
|
2182
|
+
functionName: "mint_test_token",
|
|
2183
|
+
moduleAddress: faucetEntrypoints_default.address,
|
|
2184
|
+
moduleName: faucetEntrypoints_default.name
|
|
2185
|
+
}),
|
|
2186
|
+
function: `${faucetEntrypoints_default.address}::${faucetEntrypoints_default.name}::mint_test_token`,
|
|
2187
|
+
typeArguments: [],
|
|
2188
|
+
functionArguments: [receiver, token, amount]
|
|
2425
2189
|
});
|
|
2426
2190
|
}
|
|
2427
2191
|
async mintToken(receiver, token, amount) {
|
|
2428
|
-
const payload = this.mintTokenPayload(receiver, token, amount);
|
|
2429
|
-
const tx =
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2192
|
+
const payload = await this.mintTokenPayload(receiver, token, amount);
|
|
2193
|
+
const tx = new import_ts_sdk3.MultiAgentTransaction(
|
|
2194
|
+
await (0, import_ts_sdk3.generateRawTransaction)({
|
|
2195
|
+
sender: this._apiKey.accountAddress,
|
|
2196
|
+
aptosConfig: this._aptos.config,
|
|
2197
|
+
payload
|
|
2198
|
+
}),
|
|
2199
|
+
[]
|
|
2200
|
+
);
|
|
2434
2201
|
const signature = this._aptos.sign({
|
|
2435
2202
|
signer: this._apiKey,
|
|
2436
2203
|
transaction: tx
|
|
2437
2204
|
});
|
|
2438
|
-
return await this.
|
|
2439
|
-
}
|
|
2440
|
-
async getUSDCAddress() {
|
|
2441
|
-
return (await this._surf.useABI(testFaucet_default).view.get_token_data({
|
|
2442
|
-
functionArguments: ["USDC"],
|
|
2443
|
-
typeArguments: []
|
|
2444
|
-
}))[0].inner;
|
|
2205
|
+
return await this.submitSponsoredMultiAgentTransaction(tx, signature, []);
|
|
2445
2206
|
}
|
|
2446
2207
|
};
|
|
2447
2208
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import * as _aptos_labs_ts_sdk from '@aptos-labs/ts-sdk';
|
|
2
2
|
import { Account, Aptos, MultiAgentTransaction, AccountAuthenticator, SimpleTransaction, MoveModule, EntryFunctionABI } from '@aptos-labs/ts-sdk';
|
|
3
|
-
import * as _thalalabs_surf_build_types_core from '@thalalabs/surf/build/types/core';
|
|
4
|
-
import * as _thalalabs_surf from '@thalalabs/surf';
|
|
5
3
|
import WebSocket from 'isomorphic-ws';
|
|
6
4
|
|
|
7
5
|
type PaginationCursor = string;
|
|
@@ -1258,7 +1256,6 @@ declare const getRandomId: () => string;
|
|
|
1258
1256
|
declare class Client {
|
|
1259
1257
|
_aptos: Aptos;
|
|
1260
1258
|
_chainId: number;
|
|
1261
|
-
_surf: _thalalabs_surf_build_types_core.MoveTsClient<_thalalabs_surf.DefaultABITable>;
|
|
1262
1259
|
_apiKey: Account;
|
|
1263
1260
|
_apiKeySequenceNumber: number;
|
|
1264
1261
|
_ws: WebSocket | undefined;
|
|
@@ -1378,11 +1375,10 @@ declare const GLOBAL_DENOMINATOR = 100000000;
|
|
|
1378
1375
|
declare class TestFaucet extends Client {
|
|
1379
1376
|
constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account);
|
|
1380
1377
|
static create(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account): Promise<TestFaucet>;
|
|
1381
|
-
initFaucetPayload():
|
|
1378
|
+
initFaucetPayload(): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1382
1379
|
initFaucet(): Promise<SubmitSponsoredTransactionResponse>;
|
|
1383
|
-
mintTokenPayload(receiver: Address, token: string, amount: number):
|
|
1380
|
+
mintTokenPayload(receiver: Address, token: string, amount: number): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1384
1381
|
mintToken(receiver: Address, token: string, amount: number): Promise<SubmitSponsoredTransactionResponse>;
|
|
1385
|
-
getUSDCAddress(): Promise<`0x${string}`>;
|
|
1386
1382
|
}
|
|
1387
1383
|
|
|
1388
1384
|
declare const sleep: (ms: number) => Promise<unknown>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import * as _aptos_labs_ts_sdk from '@aptos-labs/ts-sdk';
|
|
2
2
|
import { Account, Aptos, MultiAgentTransaction, AccountAuthenticator, SimpleTransaction, MoveModule, EntryFunctionABI } from '@aptos-labs/ts-sdk';
|
|
3
|
-
import * as _thalalabs_surf_build_types_core from '@thalalabs/surf/build/types/core';
|
|
4
|
-
import * as _thalalabs_surf from '@thalalabs/surf';
|
|
5
3
|
import WebSocket from 'isomorphic-ws';
|
|
6
4
|
|
|
7
5
|
type PaginationCursor = string;
|
|
@@ -1258,7 +1256,6 @@ declare const getRandomId: () => string;
|
|
|
1258
1256
|
declare class Client {
|
|
1259
1257
|
_aptos: Aptos;
|
|
1260
1258
|
_chainId: number;
|
|
1261
|
-
_surf: _thalalabs_surf_build_types_core.MoveTsClient<_thalalabs_surf.DefaultABITable>;
|
|
1262
1259
|
_apiKey: Account;
|
|
1263
1260
|
_apiKeySequenceNumber: number;
|
|
1264
1261
|
_ws: WebSocket | undefined;
|
|
@@ -1378,11 +1375,10 @@ declare const GLOBAL_DENOMINATOR = 100000000;
|
|
|
1378
1375
|
declare class TestFaucet extends Client {
|
|
1379
1376
|
constructor(connection: Aptos, enableWs: boolean, url?: string, apiKey?: Account);
|
|
1380
1377
|
static create(connection: Aptos, enableWs?: boolean, url?: string, apiKey?: Account): Promise<TestFaucet>;
|
|
1381
|
-
initFaucetPayload():
|
|
1378
|
+
initFaucetPayload(): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1382
1379
|
initFaucet(): Promise<SubmitSponsoredTransactionResponse>;
|
|
1383
|
-
mintTokenPayload(receiver: Address, token: string, amount: number):
|
|
1380
|
+
mintTokenPayload(receiver: Address, token: string, amount: number): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1384
1381
|
mintToken(receiver: Address, token: string, amount: number): Promise<SubmitSponsoredTransactionResponse>;
|
|
1385
|
-
getUSDCAddress(): Promise<`0x${string}`>;
|
|
1386
1382
|
}
|
|
1387
1383
|
|
|
1388
1384
|
declare const sleep: (ms: number) => Promise<unknown>;
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
RawTransaction,
|
|
11
11
|
SimpleTransaction
|
|
12
12
|
} from "@aptos-labs/ts-sdk";
|
|
13
|
-
import { createSurfClient } from "@thalalabs/surf";
|
|
14
13
|
import WebSocket from "isomorphic-ws";
|
|
15
14
|
import { v4 as uuidv4 } from "uuid";
|
|
16
15
|
|
|
@@ -1332,7 +1331,6 @@ var Client = class _Client {
|
|
|
1332
1331
|
};
|
|
1333
1332
|
this._aptos = connection;
|
|
1334
1333
|
this._chainId = chainId || 188;
|
|
1335
|
-
this._surf = createSurfClient(this._aptos);
|
|
1336
1334
|
this._apiKey = apiKey || generateApiKey();
|
|
1337
1335
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
1338
1336
|
this._serverUrl = url || "https://api.dev.neony.exchange";
|
|
@@ -2051,9 +2049,6 @@ function parseEntryFunctionAbi(args) {
|
|
|
2051
2049
|
};
|
|
2052
2050
|
}
|
|
2053
2051
|
|
|
2054
|
-
// src/testFaucet.ts
|
|
2055
|
-
import { createEntryPayload } from "@thalalabs/surf";
|
|
2056
|
-
|
|
2057
2052
|
// generated_types/faucetEntrypoints.ts
|
|
2058
2053
|
var ABI26 = {
|
|
2059
2054
|
"address": "0xf9e7275e05b753979cd91727fae21c90f9ba2b2e8224e3a7d8f40afd528953b1",
|
|
@@ -2089,256 +2084,12 @@ var ABI26 = {
|
|
|
2089
2084
|
};
|
|
2090
2085
|
var faucetEntrypoints_default = ABI26;
|
|
2091
2086
|
|
|
2092
|
-
// generated_types/testFaucet.ts
|
|
2093
|
-
var ABI27 = {
|
|
2094
|
-
"address": "0xf9e7275e05b753979cd91727fae21c90f9ba2b2e8224e3a7d8f40afd528953b1",
|
|
2095
|
-
"name": "test_faucet",
|
|
2096
|
-
"friends": [],
|
|
2097
|
-
"exposed_functions": [
|
|
2098
|
-
{
|
|
2099
|
-
"name": "create_fungible_asset",
|
|
2100
|
-
"visibility": "public",
|
|
2101
|
-
"is_entry": false,
|
|
2102
|
-
"is_view": false,
|
|
2103
|
-
"generic_type_params": [],
|
|
2104
|
-
"params": [
|
|
2105
|
-
"&signer",
|
|
2106
|
-
"vector<u8>",
|
|
2107
|
-
"vector<u8>",
|
|
2108
|
-
"u8",
|
|
2109
|
-
"u128"
|
|
2110
|
-
],
|
|
2111
|
-
"return": [
|
|
2112
|
-
"0x1::fungible_asset::MintRef",
|
|
2113
|
-
"0x1::fungible_asset::TransferRef",
|
|
2114
|
-
"0x1::fungible_asset::BurnRef",
|
|
2115
|
-
"0x1::fungible_asset::MutateMetadataRef",
|
|
2116
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2117
|
-
]
|
|
2118
|
-
},
|
|
2119
|
-
{
|
|
2120
|
-
"name": "create_test_token",
|
|
2121
|
-
"visibility": "public",
|
|
2122
|
-
"is_entry": false,
|
|
2123
|
-
"is_view": false,
|
|
2124
|
-
"generic_type_params": [],
|
|
2125
|
-
"params": [
|
|
2126
|
-
"&signer",
|
|
2127
|
-
"vector<u8>"
|
|
2128
|
-
],
|
|
2129
|
-
"return": [
|
|
2130
|
-
"0x1::object::ConstructorRef",
|
|
2131
|
-
"0x1::object::Object<0xf9e7275e05b753979cd91727fae21c90f9ba2b2e8224e3a7d8f40afd528953b1::test_faucet::Token>"
|
|
2132
|
-
]
|
|
2133
|
-
},
|
|
2134
|
-
{
|
|
2135
|
-
"name": "get_faucet_data",
|
|
2136
|
-
"visibility": "public",
|
|
2137
|
-
"is_entry": false,
|
|
2138
|
-
"is_view": true,
|
|
2139
|
-
"generic_type_params": [],
|
|
2140
|
-
"params": [],
|
|
2141
|
-
"return": [
|
|
2142
|
-
"vector<vector<u8>>",
|
|
2143
|
-
"vector<address>"
|
|
2144
|
-
]
|
|
2145
|
-
},
|
|
2146
|
-
{
|
|
2147
|
-
"name": "get_token_data",
|
|
2148
|
-
"visibility": "public",
|
|
2149
|
-
"is_entry": false,
|
|
2150
|
-
"is_view": true,
|
|
2151
|
-
"generic_type_params": [],
|
|
2152
|
-
"params": [
|
|
2153
|
-
"vector<u8>"
|
|
2154
|
-
],
|
|
2155
|
-
"return": [
|
|
2156
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2157
|
-
]
|
|
2158
|
-
},
|
|
2159
|
-
{
|
|
2160
|
-
"name": "init_test_apt",
|
|
2161
|
-
"visibility": "public",
|
|
2162
|
-
"is_entry": false,
|
|
2163
|
-
"is_view": false,
|
|
2164
|
-
"generic_type_params": [],
|
|
2165
|
-
"params": [
|
|
2166
|
-
"&signer"
|
|
2167
|
-
],
|
|
2168
|
-
"return": [
|
|
2169
|
-
"0x1::fungible_asset::MintRef",
|
|
2170
|
-
"0x1::fungible_asset::TransferRef",
|
|
2171
|
-
"0x1::fungible_asset::BurnRef",
|
|
2172
|
-
"0x1::fungible_asset::MutateMetadataRef",
|
|
2173
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2174
|
-
]
|
|
2175
|
-
},
|
|
2176
|
-
{
|
|
2177
|
-
"name": "init_test_btc",
|
|
2178
|
-
"visibility": "public",
|
|
2179
|
-
"is_entry": false,
|
|
2180
|
-
"is_view": false,
|
|
2181
|
-
"generic_type_params": [],
|
|
2182
|
-
"params": [
|
|
2183
|
-
"&signer"
|
|
2184
|
-
],
|
|
2185
|
-
"return": [
|
|
2186
|
-
"0x1::fungible_asset::MintRef",
|
|
2187
|
-
"0x1::fungible_asset::TransferRef",
|
|
2188
|
-
"0x1::fungible_asset::BurnRef",
|
|
2189
|
-
"0x1::fungible_asset::MutateMetadataRef",
|
|
2190
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2191
|
-
]
|
|
2192
|
-
},
|
|
2193
|
-
{
|
|
2194
|
-
"name": "init_test_metadata",
|
|
2195
|
-
"visibility": "public",
|
|
2196
|
-
"is_entry": false,
|
|
2197
|
-
"is_view": false,
|
|
2198
|
-
"generic_type_params": [],
|
|
2199
|
-
"params": [
|
|
2200
|
-
"&0x1::object::ConstructorRef",
|
|
2201
|
-
"u128",
|
|
2202
|
-
"vector<u8>",
|
|
2203
|
-
"vector<u8>",
|
|
2204
|
-
"u8"
|
|
2205
|
-
],
|
|
2206
|
-
"return": [
|
|
2207
|
-
"0x1::fungible_asset::MintRef",
|
|
2208
|
-
"0x1::fungible_asset::TransferRef",
|
|
2209
|
-
"0x1::fungible_asset::BurnRef",
|
|
2210
|
-
"0x1::fungible_asset::MutateMetadataRef"
|
|
2211
|
-
]
|
|
2212
|
-
},
|
|
2213
|
-
{
|
|
2214
|
-
"name": "init_test_sol",
|
|
2215
|
-
"visibility": "public",
|
|
2216
|
-
"is_entry": false,
|
|
2217
|
-
"is_view": false,
|
|
2218
|
-
"generic_type_params": [],
|
|
2219
|
-
"params": [
|
|
2220
|
-
"&signer"
|
|
2221
|
-
],
|
|
2222
|
-
"return": [
|
|
2223
|
-
"0x1::fungible_asset::MintRef",
|
|
2224
|
-
"0x1::fungible_asset::TransferRef",
|
|
2225
|
-
"0x1::fungible_asset::BurnRef",
|
|
2226
|
-
"0x1::fungible_asset::MutateMetadataRef",
|
|
2227
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2228
|
-
]
|
|
2229
|
-
},
|
|
2230
|
-
{
|
|
2231
|
-
"name": "init_test_usdc",
|
|
2232
|
-
"visibility": "public",
|
|
2233
|
-
"is_entry": false,
|
|
2234
|
-
"is_view": false,
|
|
2235
|
-
"generic_type_params": [],
|
|
2236
|
-
"params": [
|
|
2237
|
-
"&signer"
|
|
2238
|
-
],
|
|
2239
|
-
"return": [
|
|
2240
|
-
"0x1::fungible_asset::MintRef",
|
|
2241
|
-
"0x1::fungible_asset::TransferRef",
|
|
2242
|
-
"0x1::fungible_asset::BurnRef",
|
|
2243
|
-
"0x1::fungible_asset::MutateMetadataRef",
|
|
2244
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2245
|
-
]
|
|
2246
|
-
},
|
|
2247
|
-
{
|
|
2248
|
-
"name": "initialize_faucet",
|
|
2249
|
-
"visibility": "public",
|
|
2250
|
-
"is_entry": false,
|
|
2251
|
-
"is_view": false,
|
|
2252
|
-
"generic_type_params": [],
|
|
2253
|
-
"params": [
|
|
2254
|
-
"&signer"
|
|
2255
|
-
],
|
|
2256
|
-
"return": []
|
|
2257
|
-
},
|
|
2258
|
-
{
|
|
2259
|
-
"name": "mint_token",
|
|
2260
|
-
"visibility": "public",
|
|
2261
|
-
"is_entry": false,
|
|
2262
|
-
"is_view": false,
|
|
2263
|
-
"generic_type_params": [],
|
|
2264
|
-
"params": [
|
|
2265
|
-
"address",
|
|
2266
|
-
"vector<u8>",
|
|
2267
|
-
"u64"
|
|
2268
|
-
],
|
|
2269
|
-
"return": []
|
|
2270
|
-
},
|
|
2271
|
-
{
|
|
2272
|
-
"name": "new_faucet_token",
|
|
2273
|
-
"visibility": "public",
|
|
2274
|
-
"is_entry": false,
|
|
2275
|
-
"is_view": false,
|
|
2276
|
-
"generic_type_params": [],
|
|
2277
|
-
"params": [
|
|
2278
|
-
"0x1::fungible_asset::MintRef",
|
|
2279
|
-
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2280
|
-
],
|
|
2281
|
-
"return": [
|
|
2282
|
-
"0xf9e7275e05b753979cd91727fae21c90f9ba2b2e8224e3a7d8f40afd528953b1::test_faucet::FaucetToken"
|
|
2283
|
-
]
|
|
2284
|
-
}
|
|
2285
|
-
],
|
|
2286
|
-
"structs": [
|
|
2287
|
-
{
|
|
2288
|
-
"name": "Token",
|
|
2289
|
-
"is_native": false,
|
|
2290
|
-
"is_event": false,
|
|
2291
|
-
"abilities": [
|
|
2292
|
-
"key"
|
|
2293
|
-
],
|
|
2294
|
-
"generic_type_params": [],
|
|
2295
|
-
"fields": [
|
|
2296
|
-
{
|
|
2297
|
-
"name": "dummy_field",
|
|
2298
|
-
"type": "bool"
|
|
2299
|
-
}
|
|
2300
|
-
]
|
|
2301
|
-
},
|
|
2302
|
-
{
|
|
2303
|
-
"name": "Faucet",
|
|
2304
|
-
"is_native": false,
|
|
2305
|
-
"is_event": false,
|
|
2306
|
-
"abilities": [
|
|
2307
|
-
"store",
|
|
2308
|
-
"key"
|
|
2309
|
-
],
|
|
2310
|
-
"generic_type_params": [],
|
|
2311
|
-
"fields": [
|
|
2312
|
-
{
|
|
2313
|
-
"name": "tokens",
|
|
2314
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>, 0xf9e7275e05b753979cd91727fae21c90f9ba2b2e8224e3a7d8f40afd528953b1::test_faucet::FaucetToken>"
|
|
2315
|
-
}
|
|
2316
|
-
]
|
|
2317
|
-
},
|
|
2318
|
-
{
|
|
2319
|
-
"name": "FaucetToken",
|
|
2320
|
-
"is_native": false,
|
|
2321
|
-
"is_event": false,
|
|
2322
|
-
"abilities": [
|
|
2323
|
-
"store"
|
|
2324
|
-
],
|
|
2325
|
-
"generic_type_params": [],
|
|
2326
|
-
"fields": [
|
|
2327
|
-
{
|
|
2328
|
-
"name": "mint",
|
|
2329
|
-
"type": "0x1::fungible_asset::MintRef"
|
|
2330
|
-
},
|
|
2331
|
-
{
|
|
2332
|
-
"name": "token",
|
|
2333
|
-
"type": "0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
2334
|
-
}
|
|
2335
|
-
]
|
|
2336
|
-
}
|
|
2337
|
-
]
|
|
2338
|
-
};
|
|
2339
|
-
var testFaucet_default = ABI27;
|
|
2340
|
-
|
|
2341
2087
|
// src/testFaucet.ts
|
|
2088
|
+
import {
|
|
2089
|
+
generateRawTransaction as generateRawTransaction2,
|
|
2090
|
+
generateTransactionPayload as generateTransactionPayload2,
|
|
2091
|
+
MultiAgentTransaction as MultiAgentTransaction2
|
|
2092
|
+
} from "@aptos-labs/ts-sdk";
|
|
2342
2093
|
var TestFaucet = class _TestFaucet extends client_default {
|
|
2343
2094
|
constructor(connection, enableWs, url, apiKey) {
|
|
2344
2095
|
super(connection, enableWs, url, apiKey);
|
|
@@ -2346,52 +2097,66 @@ var TestFaucet = class _TestFaucet extends client_default {
|
|
|
2346
2097
|
static async create(connection, enableWs = false, url = "https://api.dev.neony.exchange", apiKey) {
|
|
2347
2098
|
return new _TestFaucet(connection, enableWs, url, apiKey);
|
|
2348
2099
|
}
|
|
2349
|
-
initFaucetPayload() {
|
|
2350
|
-
return
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2100
|
+
async initFaucetPayload() {
|
|
2101
|
+
return await generateTransactionPayload2({
|
|
2102
|
+
aptosConfig: this._aptos.config,
|
|
2103
|
+
abi: parseEntryFunctionAbi({
|
|
2104
|
+
moduleAbi: faucetEntrypoints_default,
|
|
2105
|
+
functionName: "initialize_faucet",
|
|
2106
|
+
moduleAddress: faucetEntrypoints_default.address,
|
|
2107
|
+
moduleName: faucetEntrypoints_default.name
|
|
2108
|
+
}),
|
|
2109
|
+
function: `${faucetEntrypoints_default.address}::${faucetEntrypoints_default.name}::initialize_faucet`,
|
|
2110
|
+
typeArguments: [],
|
|
2111
|
+
functionArguments: []
|
|
2354
2112
|
});
|
|
2355
2113
|
}
|
|
2356
2114
|
async initFaucet() {
|
|
2357
|
-
const payload = this.initFaucetPayload();
|
|
2115
|
+
const payload = await this.initFaucetPayload();
|
|
2358
2116
|
console.log(this._apiKey.accountAddress.toString());
|
|
2359
|
-
const tx =
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2117
|
+
const tx = new MultiAgentTransaction2(
|
|
2118
|
+
await generateRawTransaction2({
|
|
2119
|
+
sender: this._apiKey.accountAddress,
|
|
2120
|
+
aptosConfig: this._aptos.config,
|
|
2121
|
+
payload
|
|
2122
|
+
}),
|
|
2123
|
+
[]
|
|
2124
|
+
);
|
|
2364
2125
|
const signature = this._aptos.sign({
|
|
2365
2126
|
signer: this._apiKey,
|
|
2366
2127
|
transaction: tx
|
|
2367
2128
|
});
|
|
2368
|
-
return await this.
|
|
2129
|
+
return await this.submitSponsoredMultiAgentTransaction(tx, signature, []);
|
|
2369
2130
|
}
|
|
2370
|
-
mintTokenPayload(receiver, token, amount) {
|
|
2371
|
-
return
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2131
|
+
async mintTokenPayload(receiver, token, amount) {
|
|
2132
|
+
return await generateTransactionPayload2({
|
|
2133
|
+
aptosConfig: this._aptos.config,
|
|
2134
|
+
abi: parseEntryFunctionAbi({
|
|
2135
|
+
moduleAbi: faucetEntrypoints_default,
|
|
2136
|
+
functionName: "mint_test_token",
|
|
2137
|
+
moduleAddress: faucetEntrypoints_default.address,
|
|
2138
|
+
moduleName: faucetEntrypoints_default.name
|
|
2139
|
+
}),
|
|
2140
|
+
function: `${faucetEntrypoints_default.address}::${faucetEntrypoints_default.name}::mint_test_token`,
|
|
2141
|
+
typeArguments: [],
|
|
2142
|
+
functionArguments: [receiver, token, amount]
|
|
2375
2143
|
});
|
|
2376
2144
|
}
|
|
2377
2145
|
async mintToken(receiver, token, amount) {
|
|
2378
|
-
const payload = this.mintTokenPayload(receiver, token, amount);
|
|
2379
|
-
const tx =
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2146
|
+
const payload = await this.mintTokenPayload(receiver, token, amount);
|
|
2147
|
+
const tx = new MultiAgentTransaction2(
|
|
2148
|
+
await generateRawTransaction2({
|
|
2149
|
+
sender: this._apiKey.accountAddress,
|
|
2150
|
+
aptosConfig: this._aptos.config,
|
|
2151
|
+
payload
|
|
2152
|
+
}),
|
|
2153
|
+
[]
|
|
2154
|
+
);
|
|
2384
2155
|
const signature = this._aptos.sign({
|
|
2385
2156
|
signer: this._apiKey,
|
|
2386
2157
|
transaction: tx
|
|
2387
2158
|
});
|
|
2388
|
-
return await this.
|
|
2389
|
-
}
|
|
2390
|
-
async getUSDCAddress() {
|
|
2391
|
-
return (await this._surf.useABI(testFaucet_default).view.get_token_data({
|
|
2392
|
-
functionArguments: ["USDC"],
|
|
2393
|
-
typeArguments: []
|
|
2394
|
-
}))[0].inner;
|
|
2159
|
+
return await this.submitSponsoredMultiAgentTransaction(tx, signature, []);
|
|
2395
2160
|
}
|
|
2396
2161
|
};
|
|
2397
2162
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nightlylabs/dex-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"packageManager": "pnpm@9.3.0+sha512.ee7b93e0c2bd11409c6424f92b866f31d3ea1bef5fbe47d3c7500cdc3c9668833d2e55681ad66df5b640c61fa9dc25d546efa54d76d7f8bf54b13614ac293631",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@aptos-labs/ts-sdk": "1.38.0",
|
|
44
|
-
"@thalalabs/surf": "1.9.2",
|
|
45
44
|
"decimal.js": "^10.5.0",
|
|
46
45
|
"isomorphic-ws": "^5.0.0",
|
|
47
46
|
"uuid": "^11.0.5"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
49
|
+
"@thalalabs/surf": "1.9.3",
|
|
50
50
|
"@changesets/cli": "^2.27.12",
|
|
51
51
|
"@types/node": "^22.10.10",
|
|
52
52
|
"dotenv": "^16.4.7",
|