@vleap/warps-adapter-fastset 0.1.0-beta.54 → 0.1.0-beta.56
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.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1945,7 +1945,10 @@ import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
|
1945
1945
|
import {
|
|
1946
1946
|
getWarpWalletMnemonicFromConfig,
|
|
1947
1947
|
getWarpWalletPrivateKeyFromConfig,
|
|
1948
|
-
|
|
1948
|
+
normalizeAndValidateMnemonic,
|
|
1949
|
+
normalizeMnemonic,
|
|
1950
|
+
setWarpWalletInConfig,
|
|
1951
|
+
validateMnemonicLength
|
|
1949
1952
|
} from "@vleap/warps";
|
|
1950
1953
|
|
|
1951
1954
|
// src/sdk/ed25519-setup.ts
|
|
@@ -2406,7 +2409,8 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
|
|
|
2406
2409
|
return uint8ArrayToHex(signature);
|
|
2407
2410
|
}
|
|
2408
2411
|
async importFromMnemonic(mnemonic) {
|
|
2409
|
-
const
|
|
2412
|
+
const trimmedMnemonic = normalizeAndValidateMnemonic(mnemonic);
|
|
2413
|
+
const seed = bip39.mnemonicToSeedSync(trimmedMnemonic);
|
|
2410
2414
|
const privateKey = seed.slice(0, 32);
|
|
2411
2415
|
const publicKey = ed.getPublicKey(privateKey);
|
|
2412
2416
|
const address = FastsetClient.encodeBech32Address(publicKey);
|
|
@@ -2414,7 +2418,7 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
|
|
|
2414
2418
|
provider: _MnemonicWalletProvider.PROVIDER_NAME,
|
|
2415
2419
|
address,
|
|
2416
2420
|
privateKey: uint8ArrayToHex(privateKey),
|
|
2417
|
-
mnemonic
|
|
2421
|
+
mnemonic: trimmedMnemonic
|
|
2418
2422
|
};
|
|
2419
2423
|
setWarpWalletInConfig(this.config, this.chain.name, walletDetails);
|
|
2420
2424
|
return walletDetails;
|
|
@@ -2446,7 +2450,9 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
|
|
|
2446
2450
|
};
|
|
2447
2451
|
}
|
|
2448
2452
|
async generate() {
|
|
2449
|
-
const
|
|
2453
|
+
const mnemonicRaw = bip39.generateMnemonic(wordlist, 256);
|
|
2454
|
+
const mnemonic = normalizeMnemonic(mnemonicRaw);
|
|
2455
|
+
validateMnemonicLength(mnemonic);
|
|
2450
2456
|
const seed = bip39.mnemonicToSeedSync(mnemonic);
|
|
2451
2457
|
const privateKey = seed.slice(0, 32);
|
|
2452
2458
|
const publicKey = ed.getPublicKey(privateKey);
|