@vleap/warps-adapter-fastset 0.1.0-beta.51 → 0.1.0-beta.53
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.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +96 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +107 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -27,8 +27,10 @@ declare class WarpFastsetWallet implements AdapterWarpWallet {
|
|
|
27
27
|
signMessage(message: string): Promise<string>;
|
|
28
28
|
sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
|
|
29
29
|
sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
importFromMnemonic(provider: WarpWalletProvider, mnemonic: string): Promise<WarpWalletDetails>;
|
|
31
|
+
importFromPrivateKey(provider: WarpWalletProvider, privateKey: string): Promise<WarpWalletDetails>;
|
|
32
|
+
export(provider: WarpWalletProvider): Promise<WarpWalletDetails>;
|
|
33
|
+
generate(provider: WarpWalletProvider): Promise<WarpWalletDetails>;
|
|
32
34
|
getAddress(): string | null;
|
|
33
35
|
getPublicKey(): string | null;
|
|
34
36
|
private createProvider;
|
package/dist/index.d.ts
CHANGED
|
@@ -27,8 +27,10 @@ declare class WarpFastsetWallet implements AdapterWarpWallet {
|
|
|
27
27
|
signMessage(message: string): Promise<string>;
|
|
28
28
|
sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
|
|
29
29
|
sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
importFromMnemonic(provider: WarpWalletProvider, mnemonic: string): Promise<WarpWalletDetails>;
|
|
31
|
+
importFromPrivateKey(provider: WarpWalletProvider, privateKey: string): Promise<WarpWalletDetails>;
|
|
32
|
+
export(provider: WarpWalletProvider): Promise<WarpWalletDetails>;
|
|
33
|
+
generate(provider: WarpWalletProvider): Promise<WarpWalletDetails>;
|
|
32
34
|
getAddress(): string | null;
|
|
33
35
|
getPublicKey(): string | null;
|
|
34
36
|
private createProvider;
|
package/dist/index.js
CHANGED
|
@@ -1519,7 +1519,10 @@ var FastsetTokens = [
|
|
|
1519
1519
|
name: "Ethereum",
|
|
1520
1520
|
symbol: "ETH",
|
|
1521
1521
|
decimals: 18,
|
|
1522
|
-
logoUrl:
|
|
1522
|
+
logoUrl: {
|
|
1523
|
+
light: "https://joai.ai/images/tokens/eth-white.svg",
|
|
1524
|
+
dark: "https://joai.ai/images/tokens/eth-black.svg"
|
|
1525
|
+
},
|
|
1523
1526
|
amount: 0n
|
|
1524
1527
|
},
|
|
1525
1528
|
{
|
|
@@ -1537,7 +1540,7 @@ var FastsetTokens = [
|
|
|
1537
1540
|
name: "Solana",
|
|
1538
1541
|
symbol: "SOL",
|
|
1539
1542
|
decimals: 9,
|
|
1540
|
-
logoUrl: "https://
|
|
1543
|
+
logoUrl: "https://joai.ai/images/tokens/sol.svg",
|
|
1541
1544
|
amount: 0n
|
|
1542
1545
|
},
|
|
1543
1546
|
{
|
|
@@ -1555,7 +1558,10 @@ var FastsetTokens = [
|
|
|
1555
1558
|
name: "Wrapped SET",
|
|
1556
1559
|
symbol: "WSET",
|
|
1557
1560
|
decimals: 18,
|
|
1558
|
-
logoUrl:
|
|
1561
|
+
logoUrl: {
|
|
1562
|
+
light: "https://joai.ai/images/tokens/set-white.svg",
|
|
1563
|
+
dark: "https://joai.ai/images/tokens/set-black.svg"
|
|
1564
|
+
},
|
|
1559
1565
|
amount: 0n
|
|
1560
1566
|
}
|
|
1561
1567
|
];
|
|
@@ -1606,7 +1612,7 @@ var WarpFastsetDataLoader = class {
|
|
|
1606
1612
|
symbol: assetInfo.symbol,
|
|
1607
1613
|
name: assetInfo.name,
|
|
1608
1614
|
decimals: assetInfo.decimals,
|
|
1609
|
-
logoUrl: assetInfo.logoUrl
|
|
1615
|
+
logoUrl: assetInfo.logoUrl,
|
|
1610
1616
|
amount
|
|
1611
1617
|
});
|
|
1612
1618
|
}
|
|
@@ -1627,7 +1633,7 @@ var WarpFastsetDataLoader = class {
|
|
|
1627
1633
|
symbol: assetInfo.symbol,
|
|
1628
1634
|
name: assetInfo.name,
|
|
1629
1635
|
decimals: assetInfo.decimals,
|
|
1630
|
-
logoUrl: assetInfo.logoUrl
|
|
1636
|
+
logoUrl: assetInfo.logoUrl,
|
|
1631
1637
|
amount: 0n
|
|
1632
1638
|
};
|
|
1633
1639
|
}
|
|
@@ -2418,19 +2424,47 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
|
|
|
2418
2424
|
const signature = ed.sign(messageBytes, privateKey);
|
|
2419
2425
|
return uint8ArrayToHex(signature);
|
|
2420
2426
|
}
|
|
2421
|
-
|
|
2427
|
+
async importFromMnemonic(mnemonic) {
|
|
2422
2428
|
const seed = bip39.mnemonicToSeedSync(mnemonic);
|
|
2423
2429
|
const privateKey = seed.slice(0, 32);
|
|
2424
2430
|
const publicKey = ed.getPublicKey(privateKey);
|
|
2425
2431
|
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2426
|
-
|
|
2432
|
+
const walletDetails = {
|
|
2427
2433
|
provider: _MnemonicWalletProvider.PROVIDER_NAME,
|
|
2428
2434
|
address,
|
|
2429
|
-
privateKey:
|
|
2435
|
+
privateKey: uint8ArrayToHex(privateKey),
|
|
2430
2436
|
mnemonic
|
|
2431
2437
|
};
|
|
2438
|
+
(0, import_warps5.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
|
|
2439
|
+
return walletDetails;
|
|
2440
|
+
}
|
|
2441
|
+
async importFromPrivateKey(privateKey) {
|
|
2442
|
+
const privateKeyBytes = Buffer.from(privateKey, "hex");
|
|
2443
|
+
const publicKey = ed.getPublicKey(new Uint8Array(privateKeyBytes));
|
|
2444
|
+
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2445
|
+
const walletDetails = {
|
|
2446
|
+
provider: _MnemonicWalletProvider.PROVIDER_NAME,
|
|
2447
|
+
address,
|
|
2448
|
+
privateKey,
|
|
2449
|
+
mnemonic: null
|
|
2450
|
+
};
|
|
2451
|
+
(0, import_warps5.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
|
|
2452
|
+
return walletDetails;
|
|
2432
2453
|
}
|
|
2433
|
-
|
|
2454
|
+
async export() {
|
|
2455
|
+
const privateKey = this.getPrivateKey();
|
|
2456
|
+
const mnemonic = (0, import_warps5.getWarpWalletMnemonicFromConfig)(this.config, this.chain.name);
|
|
2457
|
+
const privateKeyHex = (0, import_warps5.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
|
|
2458
|
+
const publicKey = ed.getPublicKey(privateKey);
|
|
2459
|
+
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2460
|
+
return {
|
|
2461
|
+
provider: _MnemonicWalletProvider.PROVIDER_NAME,
|
|
2462
|
+
address,
|
|
2463
|
+
privateKey: privateKeyHex || null,
|
|
2464
|
+
mnemonic: mnemonic || null
|
|
2465
|
+
};
|
|
2466
|
+
}
|
|
2467
|
+
async generate() {
|
|
2434
2468
|
const mnemonic = bip39.generateMnemonic(import_english.wordlist);
|
|
2435
2469
|
const seed = bip39.mnemonicToSeedSync(mnemonic);
|
|
2436
2470
|
const privateKey = seed.slice(0, 32);
|
|
@@ -2499,19 +2533,47 @@ var _PrivateKeyWalletProvider = class _PrivateKeyWalletProvider {
|
|
|
2499
2533
|
const signature = ed.sign(messageBytes, privateKey);
|
|
2500
2534
|
return uint8ArrayToHex(signature);
|
|
2501
2535
|
}
|
|
2502
|
-
|
|
2536
|
+
async importFromMnemonic(mnemonic) {
|
|
2503
2537
|
const seed = bip392.mnemonicToSeedSync(mnemonic);
|
|
2504
2538
|
const privateKey = seed.slice(0, 32);
|
|
2505
2539
|
const publicKey = ed.getPublicKey(privateKey);
|
|
2506
2540
|
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2507
|
-
|
|
2541
|
+
const walletDetails = {
|
|
2508
2542
|
provider: _PrivateKeyWalletProvider.PROVIDER_NAME,
|
|
2509
2543
|
address,
|
|
2510
2544
|
privateKey: uint8ArrayToHex(privateKey),
|
|
2545
|
+
mnemonic
|
|
2546
|
+
};
|
|
2547
|
+
(0, import_warps6.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
|
|
2548
|
+
return walletDetails;
|
|
2549
|
+
}
|
|
2550
|
+
async importFromPrivateKey(privateKey) {
|
|
2551
|
+
const privateKeyBytes = hexToUint8Array(privateKey);
|
|
2552
|
+
const publicKey = ed.getPublicKey(privateKeyBytes);
|
|
2553
|
+
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2554
|
+
const walletDetails = {
|
|
2555
|
+
provider: _PrivateKeyWalletProvider.PROVIDER_NAME,
|
|
2556
|
+
address,
|
|
2557
|
+
privateKey,
|
|
2511
2558
|
mnemonic: null
|
|
2512
2559
|
};
|
|
2560
|
+
(0, import_warps6.setWarpWalletInConfig)(this.config, this.chain.name, walletDetails);
|
|
2561
|
+
return walletDetails;
|
|
2513
2562
|
}
|
|
2514
|
-
|
|
2563
|
+
async export() {
|
|
2564
|
+
const privateKey = this.getPrivateKey();
|
|
2565
|
+
const privateKeyHex = (0, import_warps6.getWarpWalletPrivateKeyFromConfig)(this.config, this.chain.name);
|
|
2566
|
+
const mnemonic = (0, import_warps6.getWarpWalletMnemonicFromConfig)(this.config, this.chain.name);
|
|
2567
|
+
const publicKey = ed.getPublicKey(privateKey);
|
|
2568
|
+
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2569
|
+
return {
|
|
2570
|
+
provider: _PrivateKeyWalletProvider.PROVIDER_NAME,
|
|
2571
|
+
address,
|
|
2572
|
+
privateKey: privateKeyHex || null,
|
|
2573
|
+
mnemonic: mnemonic || null
|
|
2574
|
+
};
|
|
2575
|
+
}
|
|
2576
|
+
async generate() {
|
|
2515
2577
|
const privateKey = ed.utils.randomSecretKey();
|
|
2516
2578
|
const publicKey = ed.getPublicKey(privateKey);
|
|
2517
2579
|
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
@@ -2554,11 +2616,19 @@ var ReadOnlyWalletProvider = class {
|
|
|
2554
2616
|
const address = await this.getAddress();
|
|
2555
2617
|
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
2556
2618
|
}
|
|
2557
|
-
|
|
2619
|
+
async importFromMnemonic(mnemonic) {
|
|
2620
|
+
const address = (0, import_warps7.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
|
|
2621
|
+
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
2622
|
+
}
|
|
2623
|
+
async importFromPrivateKey(privateKey) {
|
|
2558
2624
|
const address = (0, import_warps7.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
|
|
2559
2625
|
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
2560
2626
|
}
|
|
2561
|
-
|
|
2627
|
+
async export() {
|
|
2628
|
+
const address = (0, import_warps7.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
|
|
2629
|
+
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
2630
|
+
}
|
|
2631
|
+
async generate() {
|
|
2562
2632
|
const address = (0, import_warps7.getWarpWalletAddressFromConfig)(this.config, this.chain.name);
|
|
2563
2633
|
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
2564
2634
|
}
|
|
@@ -2602,13 +2672,21 @@ var WarpFastsetWallet = class {
|
|
|
2602
2672
|
async sendTransactions(txs) {
|
|
2603
2673
|
return Promise.all(txs.map(async (tx) => this.sendTransaction(tx)));
|
|
2604
2674
|
}
|
|
2605
|
-
|
|
2675
|
+
async importFromMnemonic(provider, mnemonic) {
|
|
2676
|
+
const walletProvider = this.createProviderForOperation(provider);
|
|
2677
|
+
return await walletProvider.importFromMnemonic(mnemonic);
|
|
2678
|
+
}
|
|
2679
|
+
async importFromPrivateKey(provider, privateKey) {
|
|
2680
|
+
const walletProvider = this.createProviderForOperation(provider);
|
|
2681
|
+
return await walletProvider.importFromPrivateKey(privateKey);
|
|
2682
|
+
}
|
|
2683
|
+
async export(provider) {
|
|
2606
2684
|
const walletProvider = this.createProviderForOperation(provider);
|
|
2607
|
-
return walletProvider.
|
|
2685
|
+
return await walletProvider.export();
|
|
2608
2686
|
}
|
|
2609
|
-
generate(provider) {
|
|
2687
|
+
async generate(provider) {
|
|
2610
2688
|
const walletProvider = this.createProviderForOperation(provider);
|
|
2611
|
-
return walletProvider.generate();
|
|
2689
|
+
return await walletProvider.generate();
|
|
2612
2690
|
}
|
|
2613
2691
|
getAddress() {
|
|
2614
2692
|
return this.cachedAddress;
|