@lucid-evolution/wallet 0.1.16 → 0.1.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/dist/index.cjs +22 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +22 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
discoverOwnUsedTxKeyHashes: () => discoverOwnUsedTxKeyHashes,
|
|
34
34
|
makeWalletFromAPI: () => makeWalletFromAPI,
|
|
35
|
+
makeWalletFromAddress: () => makeWalletFromAddress,
|
|
35
36
|
makeWalletFromPrivateKey: () => makeWalletFromPrivateKey,
|
|
36
37
|
makeWalletFromSeed: () => makeWalletFromSeed,
|
|
37
38
|
walletFromSeed: () => walletFromSeed
|
|
@@ -392,10 +393,31 @@ var makeWalletFromAPI = (provider, api) => {
|
|
|
392
393
|
}
|
|
393
394
|
};
|
|
394
395
|
};
|
|
396
|
+
var makeWalletFromAddress = (provider, network, address, utxos) => {
|
|
397
|
+
const { stakeCredential } = (0, import_utils2.getAddressDetails)(address);
|
|
398
|
+
const rewardAddress = stakeCredential ? (0, import_utils2.credentialToRewardAddress)(network, stakeCredential) : null;
|
|
399
|
+
return {
|
|
400
|
+
address: async () => address,
|
|
401
|
+
rewardAddress: async () => rewardAddress,
|
|
402
|
+
getUtxos: async () => utxos,
|
|
403
|
+
getUtxosCore: async () => utxos.map(import_utils2.utxoToCore),
|
|
404
|
+
getDelegation: async () => rewardAddress ? provider.getDelegation(rewardAddress) : { poolId: null, rewards: 0n },
|
|
405
|
+
signTx: async (_tx) => {
|
|
406
|
+
throw new Error("Not implemented");
|
|
407
|
+
},
|
|
408
|
+
signMessage: async (_address, _payload) => {
|
|
409
|
+
throw new Error("Not implemented");
|
|
410
|
+
},
|
|
411
|
+
submitTx: async (_tx) => {
|
|
412
|
+
throw new Error("Not implemented");
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
};
|
|
395
416
|
// Annotate the CommonJS export names for ESM import in node:
|
|
396
417
|
0 && (module.exports = {
|
|
397
418
|
discoverOwnUsedTxKeyHashes,
|
|
398
419
|
makeWalletFromAPI,
|
|
420
|
+
makeWalletFromAddress,
|
|
399
421
|
makeWalletFromPrivateKey,
|
|
400
422
|
makeWalletFromSeed,
|
|
401
423
|
walletFromSeed
|
package/dist/index.d.cts
CHANGED
|
@@ -26,5 +26,6 @@ declare const makeWalletFromSeed: (provider: Provider, network: Network, seed: s
|
|
|
26
26
|
*/
|
|
27
27
|
declare const makeWalletFromPrivateKey: (provider: Provider, network: Network, privateKey: PrivateKey) => Wallet;
|
|
28
28
|
declare const makeWalletFromAPI: (provider: Provider, api: WalletApi) => Wallet;
|
|
29
|
+
declare const makeWalletFromAddress: (provider: Provider, network: Network, address: string, utxos: UTxO[]) => Wallet;
|
|
29
30
|
|
|
30
|
-
export { discoverOwnUsedTxKeyHashes, makeWalletFromAPI, makeWalletFromPrivateKey, makeWalletFromSeed, walletFromSeed };
|
|
31
|
+
export { discoverOwnUsedTxKeyHashes, makeWalletFromAPI, makeWalletFromAddress, makeWalletFromPrivateKey, makeWalletFromSeed, walletFromSeed };
|
package/dist/index.d.ts
CHANGED
|
@@ -26,5 +26,6 @@ declare const makeWalletFromSeed: (provider: Provider, network: Network, seed: s
|
|
|
26
26
|
*/
|
|
27
27
|
declare const makeWalletFromPrivateKey: (provider: Provider, network: Network, privateKey: PrivateKey) => Wallet;
|
|
28
28
|
declare const makeWalletFromAPI: (provider: Provider, api: WalletApi) => Wallet;
|
|
29
|
+
declare const makeWalletFromAddress: (provider: Provider, network: Network, address: string, utxos: UTxO[]) => Wallet;
|
|
29
30
|
|
|
30
|
-
export { discoverOwnUsedTxKeyHashes, makeWalletFromAPI, makeWalletFromPrivateKey, makeWalletFromSeed, walletFromSeed };
|
|
31
|
+
export { discoverOwnUsedTxKeyHashes, makeWalletFromAPI, makeWalletFromAddress, makeWalletFromPrivateKey, makeWalletFromSeed, walletFromSeed };
|
package/dist/index.js
CHANGED
|
@@ -190,6 +190,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
190
190
|
import { fromHex as fromHex2, toHex } from "@lucid-evolution/core-utils";
|
|
191
191
|
import {
|
|
192
192
|
coreToUtxo,
|
|
193
|
+
credentialToRewardAddress,
|
|
193
194
|
getAddressDetails as getAddressDetails2,
|
|
194
195
|
paymentCredentialOf,
|
|
195
196
|
utxoToCore
|
|
@@ -357,9 +358,30 @@ var makeWalletFromAPI = (provider, api) => {
|
|
|
357
358
|
}
|
|
358
359
|
};
|
|
359
360
|
};
|
|
361
|
+
var makeWalletFromAddress = (provider, network, address, utxos) => {
|
|
362
|
+
const { stakeCredential } = getAddressDetails2(address);
|
|
363
|
+
const rewardAddress = stakeCredential ? credentialToRewardAddress(network, stakeCredential) : null;
|
|
364
|
+
return {
|
|
365
|
+
address: async () => address,
|
|
366
|
+
rewardAddress: async () => rewardAddress,
|
|
367
|
+
getUtxos: async () => utxos,
|
|
368
|
+
getUtxosCore: async () => utxos.map(utxoToCore),
|
|
369
|
+
getDelegation: async () => rewardAddress ? provider.getDelegation(rewardAddress) : { poolId: null, rewards: 0n },
|
|
370
|
+
signTx: async (_tx) => {
|
|
371
|
+
throw new Error("Not implemented");
|
|
372
|
+
},
|
|
373
|
+
signMessage: async (_address, _payload) => {
|
|
374
|
+
throw new Error("Not implemented");
|
|
375
|
+
},
|
|
376
|
+
submitTx: async (_tx) => {
|
|
377
|
+
throw new Error("Not implemented");
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
};
|
|
360
381
|
export {
|
|
361
382
|
discoverOwnUsedTxKeyHashes,
|
|
362
383
|
makeWalletFromAPI,
|
|
384
|
+
makeWalletFromAddress,
|
|
363
385
|
makeWalletFromPrivateKey,
|
|
364
386
|
makeWalletFromSeed,
|
|
365
387
|
walletFromSeed
|