@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.mjs
CHANGED
|
@@ -1484,7 +1484,10 @@ var FastsetTokens = [
|
|
|
1484
1484
|
name: "Ethereum",
|
|
1485
1485
|
symbol: "ETH",
|
|
1486
1486
|
decimals: 18,
|
|
1487
|
-
logoUrl:
|
|
1487
|
+
logoUrl: {
|
|
1488
|
+
light: "https://joai.ai/images/tokens/eth-white.svg",
|
|
1489
|
+
dark: "https://joai.ai/images/tokens/eth-black.svg"
|
|
1490
|
+
},
|
|
1488
1491
|
amount: 0n
|
|
1489
1492
|
},
|
|
1490
1493
|
{
|
|
@@ -1502,7 +1505,7 @@ var FastsetTokens = [
|
|
|
1502
1505
|
name: "Solana",
|
|
1503
1506
|
symbol: "SOL",
|
|
1504
1507
|
decimals: 9,
|
|
1505
|
-
logoUrl: "https://
|
|
1508
|
+
logoUrl: "https://joai.ai/images/tokens/sol.svg",
|
|
1506
1509
|
amount: 0n
|
|
1507
1510
|
},
|
|
1508
1511
|
{
|
|
@@ -1520,7 +1523,10 @@ var FastsetTokens = [
|
|
|
1520
1523
|
name: "Wrapped SET",
|
|
1521
1524
|
symbol: "WSET",
|
|
1522
1525
|
decimals: 18,
|
|
1523
|
-
logoUrl:
|
|
1526
|
+
logoUrl: {
|
|
1527
|
+
light: "https://joai.ai/images/tokens/set-white.svg",
|
|
1528
|
+
dark: "https://joai.ai/images/tokens/set-black.svg"
|
|
1529
|
+
},
|
|
1524
1530
|
amount: 0n
|
|
1525
1531
|
}
|
|
1526
1532
|
];
|
|
@@ -1571,7 +1577,7 @@ var WarpFastsetDataLoader = class {
|
|
|
1571
1577
|
symbol: assetInfo.symbol,
|
|
1572
1578
|
name: assetInfo.name,
|
|
1573
1579
|
decimals: assetInfo.decimals,
|
|
1574
|
-
logoUrl: assetInfo.logoUrl
|
|
1580
|
+
logoUrl: assetInfo.logoUrl,
|
|
1575
1581
|
amount
|
|
1576
1582
|
});
|
|
1577
1583
|
}
|
|
@@ -1592,7 +1598,7 @@ var WarpFastsetDataLoader = class {
|
|
|
1592
1598
|
symbol: assetInfo.symbol,
|
|
1593
1599
|
name: assetInfo.name,
|
|
1594
1600
|
decimals: assetInfo.decimals,
|
|
1595
|
-
logoUrl: assetInfo.logoUrl
|
|
1601
|
+
logoUrl: assetInfo.logoUrl,
|
|
1596
1602
|
amount: 0n
|
|
1597
1603
|
};
|
|
1598
1604
|
}
|
|
@@ -1936,7 +1942,11 @@ import {
|
|
|
1936
1942
|
// src/providers/MnemonicWalletProvider.ts
|
|
1937
1943
|
import * as bip39 from "@scure/bip39";
|
|
1938
1944
|
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
1939
|
-
import {
|
|
1945
|
+
import {
|
|
1946
|
+
getWarpWalletMnemonicFromConfig,
|
|
1947
|
+
getWarpWalletPrivateKeyFromConfig,
|
|
1948
|
+
setWarpWalletInConfig
|
|
1949
|
+
} from "@vleap/warps";
|
|
1940
1950
|
|
|
1941
1951
|
// src/sdk/ed25519-setup.ts
|
|
1942
1952
|
import * as ed25519 from "@noble/ed25519";
|
|
@@ -2395,19 +2405,47 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
|
|
|
2395
2405
|
const signature = ed.sign(messageBytes, privateKey);
|
|
2396
2406
|
return uint8ArrayToHex(signature);
|
|
2397
2407
|
}
|
|
2398
|
-
|
|
2408
|
+
async importFromMnemonic(mnemonic) {
|
|
2399
2409
|
const seed = bip39.mnemonicToSeedSync(mnemonic);
|
|
2400
2410
|
const privateKey = seed.slice(0, 32);
|
|
2401
2411
|
const publicKey = ed.getPublicKey(privateKey);
|
|
2402
2412
|
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2403
|
-
|
|
2413
|
+
const walletDetails = {
|
|
2404
2414
|
provider: _MnemonicWalletProvider.PROVIDER_NAME,
|
|
2405
2415
|
address,
|
|
2406
|
-
privateKey:
|
|
2416
|
+
privateKey: uint8ArrayToHex(privateKey),
|
|
2407
2417
|
mnemonic
|
|
2408
2418
|
};
|
|
2419
|
+
setWarpWalletInConfig(this.config, this.chain.name, walletDetails);
|
|
2420
|
+
return walletDetails;
|
|
2421
|
+
}
|
|
2422
|
+
async importFromPrivateKey(privateKey) {
|
|
2423
|
+
const privateKeyBytes = Buffer.from(privateKey, "hex");
|
|
2424
|
+
const publicKey = ed.getPublicKey(new Uint8Array(privateKeyBytes));
|
|
2425
|
+
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2426
|
+
const walletDetails = {
|
|
2427
|
+
provider: _MnemonicWalletProvider.PROVIDER_NAME,
|
|
2428
|
+
address,
|
|
2429
|
+
privateKey,
|
|
2430
|
+
mnemonic: null
|
|
2431
|
+
};
|
|
2432
|
+
setWarpWalletInConfig(this.config, this.chain.name, walletDetails);
|
|
2433
|
+
return walletDetails;
|
|
2409
2434
|
}
|
|
2410
|
-
|
|
2435
|
+
async export() {
|
|
2436
|
+
const privateKey = this.getPrivateKey();
|
|
2437
|
+
const mnemonic = getWarpWalletMnemonicFromConfig(this.config, this.chain.name);
|
|
2438
|
+
const privateKeyHex = getWarpWalletPrivateKeyFromConfig(this.config, this.chain.name);
|
|
2439
|
+
const publicKey = ed.getPublicKey(privateKey);
|
|
2440
|
+
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2441
|
+
return {
|
|
2442
|
+
provider: _MnemonicWalletProvider.PROVIDER_NAME,
|
|
2443
|
+
address,
|
|
2444
|
+
privateKey: privateKeyHex || null,
|
|
2445
|
+
mnemonic: mnemonic || null
|
|
2446
|
+
};
|
|
2447
|
+
}
|
|
2448
|
+
async generate() {
|
|
2411
2449
|
const mnemonic = bip39.generateMnemonic(wordlist);
|
|
2412
2450
|
const seed = bip39.mnemonicToSeedSync(mnemonic);
|
|
2413
2451
|
const privateKey = seed.slice(0, 32);
|
|
@@ -2433,7 +2471,11 @@ _MnemonicWalletProvider.PROVIDER_NAME = "mnemonic";
|
|
|
2433
2471
|
var MnemonicWalletProvider = _MnemonicWalletProvider;
|
|
2434
2472
|
|
|
2435
2473
|
// src/providers/PrivateKeyWalletProvider.ts
|
|
2436
|
-
import {
|
|
2474
|
+
import {
|
|
2475
|
+
getWarpWalletMnemonicFromConfig as getWarpWalletMnemonicFromConfig2,
|
|
2476
|
+
getWarpWalletPrivateKeyFromConfig as getWarpWalletPrivateKeyFromConfig2,
|
|
2477
|
+
setWarpWalletInConfig as setWarpWalletInConfig2
|
|
2478
|
+
} from "@vleap/warps";
|
|
2437
2479
|
import * as bip392 from "@scure/bip39";
|
|
2438
2480
|
var _PrivateKeyWalletProvider = class _PrivateKeyWalletProvider {
|
|
2439
2481
|
constructor(config, chain2) {
|
|
@@ -2476,19 +2518,47 @@ var _PrivateKeyWalletProvider = class _PrivateKeyWalletProvider {
|
|
|
2476
2518
|
const signature = ed.sign(messageBytes, privateKey);
|
|
2477
2519
|
return uint8ArrayToHex(signature);
|
|
2478
2520
|
}
|
|
2479
|
-
|
|
2521
|
+
async importFromMnemonic(mnemonic) {
|
|
2480
2522
|
const seed = bip392.mnemonicToSeedSync(mnemonic);
|
|
2481
2523
|
const privateKey = seed.slice(0, 32);
|
|
2482
2524
|
const publicKey = ed.getPublicKey(privateKey);
|
|
2483
2525
|
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2484
|
-
|
|
2526
|
+
const walletDetails = {
|
|
2485
2527
|
provider: _PrivateKeyWalletProvider.PROVIDER_NAME,
|
|
2486
2528
|
address,
|
|
2487
2529
|
privateKey: uint8ArrayToHex(privateKey),
|
|
2530
|
+
mnemonic
|
|
2531
|
+
};
|
|
2532
|
+
setWarpWalletInConfig2(this.config, this.chain.name, walletDetails);
|
|
2533
|
+
return walletDetails;
|
|
2534
|
+
}
|
|
2535
|
+
async importFromPrivateKey(privateKey) {
|
|
2536
|
+
const privateKeyBytes = hexToUint8Array(privateKey);
|
|
2537
|
+
const publicKey = ed.getPublicKey(privateKeyBytes);
|
|
2538
|
+
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2539
|
+
const walletDetails = {
|
|
2540
|
+
provider: _PrivateKeyWalletProvider.PROVIDER_NAME,
|
|
2541
|
+
address,
|
|
2542
|
+
privateKey,
|
|
2488
2543
|
mnemonic: null
|
|
2489
2544
|
};
|
|
2545
|
+
setWarpWalletInConfig2(this.config, this.chain.name, walletDetails);
|
|
2546
|
+
return walletDetails;
|
|
2490
2547
|
}
|
|
2491
|
-
|
|
2548
|
+
async export() {
|
|
2549
|
+
const privateKey = this.getPrivateKey();
|
|
2550
|
+
const privateKeyHex = getWarpWalletPrivateKeyFromConfig2(this.config, this.chain.name);
|
|
2551
|
+
const mnemonic = getWarpWalletMnemonicFromConfig2(this.config, this.chain.name);
|
|
2552
|
+
const publicKey = ed.getPublicKey(privateKey);
|
|
2553
|
+
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
2554
|
+
return {
|
|
2555
|
+
provider: _PrivateKeyWalletProvider.PROVIDER_NAME,
|
|
2556
|
+
address,
|
|
2557
|
+
privateKey: privateKeyHex || null,
|
|
2558
|
+
mnemonic: mnemonic || null
|
|
2559
|
+
};
|
|
2560
|
+
}
|
|
2561
|
+
async generate() {
|
|
2492
2562
|
const privateKey = ed.utils.randomSecretKey();
|
|
2493
2563
|
const publicKey = ed.getPublicKey(privateKey);
|
|
2494
2564
|
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
@@ -2501,7 +2571,7 @@ var _PrivateKeyWalletProvider = class _PrivateKeyWalletProvider {
|
|
|
2501
2571
|
}
|
|
2502
2572
|
getPrivateKey() {
|
|
2503
2573
|
if (this.privateKey) return this.privateKey;
|
|
2504
|
-
const privateKeyHex =
|
|
2574
|
+
const privateKeyHex = getWarpWalletPrivateKeyFromConfig2(this.config, this.chain.name);
|
|
2505
2575
|
if (!privateKeyHex) throw new Error("No private key provided");
|
|
2506
2576
|
this.privateKey = hexToUint8Array(privateKeyHex);
|
|
2507
2577
|
return this.privateKey;
|
|
@@ -2531,11 +2601,19 @@ var ReadOnlyWalletProvider = class {
|
|
|
2531
2601
|
const address = await this.getAddress();
|
|
2532
2602
|
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
2533
2603
|
}
|
|
2534
|
-
|
|
2604
|
+
async importFromMnemonic(mnemonic) {
|
|
2605
|
+
const address = getWarpWalletAddressFromConfig3(this.config, this.chain.name);
|
|
2606
|
+
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
2607
|
+
}
|
|
2608
|
+
async importFromPrivateKey(privateKey) {
|
|
2609
|
+
const address = getWarpWalletAddressFromConfig3(this.config, this.chain.name);
|
|
2610
|
+
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
2611
|
+
}
|
|
2612
|
+
async export() {
|
|
2535
2613
|
const address = getWarpWalletAddressFromConfig3(this.config, this.chain.name);
|
|
2536
2614
|
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
2537
2615
|
}
|
|
2538
|
-
generate() {
|
|
2616
|
+
async generate() {
|
|
2539
2617
|
const address = getWarpWalletAddressFromConfig3(this.config, this.chain.name);
|
|
2540
2618
|
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
2541
2619
|
}
|
|
@@ -2579,13 +2657,21 @@ var WarpFastsetWallet = class {
|
|
|
2579
2657
|
async sendTransactions(txs) {
|
|
2580
2658
|
return Promise.all(txs.map(async (tx) => this.sendTransaction(tx)));
|
|
2581
2659
|
}
|
|
2582
|
-
|
|
2660
|
+
async importFromMnemonic(provider, mnemonic) {
|
|
2661
|
+
const walletProvider = this.createProviderForOperation(provider);
|
|
2662
|
+
return await walletProvider.importFromMnemonic(mnemonic);
|
|
2663
|
+
}
|
|
2664
|
+
async importFromPrivateKey(provider, privateKey) {
|
|
2665
|
+
const walletProvider = this.createProviderForOperation(provider);
|
|
2666
|
+
return await walletProvider.importFromPrivateKey(privateKey);
|
|
2667
|
+
}
|
|
2668
|
+
async export(provider) {
|
|
2583
2669
|
const walletProvider = this.createProviderForOperation(provider);
|
|
2584
|
-
return walletProvider.
|
|
2670
|
+
return await walletProvider.export();
|
|
2585
2671
|
}
|
|
2586
|
-
generate(provider) {
|
|
2672
|
+
async generate(provider) {
|
|
2587
2673
|
const walletProvider = this.createProviderForOperation(provider);
|
|
2588
|
-
return walletProvider.generate();
|
|
2674
|
+
return await walletProvider.generate();
|
|
2589
2675
|
}
|
|
2590
2676
|
getAddress() {
|
|
2591
2677
|
return this.cachedAddress;
|