@lucid-evolution/wallet 0.1.21 → 0.1.23
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 +8 -15
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -15
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -44,14 +44,13 @@ var import_utils = require("@lucid-evolution/utils");
|
|
|
44
44
|
var import_core_utils = require("@lucid-evolution/core-utils");
|
|
45
45
|
|
|
46
46
|
// src/core.ts
|
|
47
|
-
var CML = __toESM(require("@
|
|
47
|
+
var CML = __toESM(require("@anastasia-labs/cardano-multiplatform-lib-nodejs"), 1);
|
|
48
48
|
|
|
49
49
|
// src/wallet.ts
|
|
50
50
|
var import_bip39 = require("@lucid-evolution/bip39");
|
|
51
51
|
function walletFromSeed(seed, options = { addressType: "Base", accountIndex: 0, network: "Mainnet" }) {
|
|
52
52
|
function harden(num) {
|
|
53
|
-
if (typeof num !== "number")
|
|
54
|
-
throw new Error("Type number required here!");
|
|
53
|
+
if (typeof num !== "number") throw new Error("Type number required here!");
|
|
55
54
|
return 2147483648 + num;
|
|
56
55
|
}
|
|
57
56
|
const entropy = (0, import_bip39.mnemonicToEntropy)(seed);
|
|
@@ -103,8 +102,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
103
102
|
const txBody = tx.body();
|
|
104
103
|
function keyHashFromCert(txBody2) {
|
|
105
104
|
const certs = txBody2.certs();
|
|
106
|
-
if (!certs)
|
|
107
|
-
return;
|
|
105
|
+
if (!certs) return;
|
|
108
106
|
for (let i = 0; i < certs.len(); i++) {
|
|
109
107
|
const cert = certs.get(i);
|
|
110
108
|
switch (cert.kind()) {
|
|
@@ -133,8 +131,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
133
131
|
case 3: {
|
|
134
132
|
const poolParams = cert.as_pool_registration()?.pool_params();
|
|
135
133
|
const owners = poolParams?.pool_owners();
|
|
136
|
-
if (!owners)
|
|
137
|
-
break;
|
|
134
|
+
if (!owners) break;
|
|
138
135
|
for (let i2 = 0; i2 < owners.len(); i2++) {
|
|
139
136
|
const keyHash = owners.get(i2).to_hex();
|
|
140
137
|
usedKeyHashes.push(keyHash);
|
|
@@ -160,8 +157,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
160
157
|
}
|
|
161
158
|
}
|
|
162
159
|
}
|
|
163
|
-
if (txBody.certs())
|
|
164
|
-
keyHashFromCert(txBody);
|
|
160
|
+
if (txBody.certs()) keyHashFromCert(txBody);
|
|
165
161
|
const withdrawals = txBody.withdrawals();
|
|
166
162
|
function keyHashFromWithdrawal(withdrawals2) {
|
|
167
163
|
const rewardAddresses = withdrawals2.keys();
|
|
@@ -177,8 +173,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
177
173
|
}
|
|
178
174
|
}
|
|
179
175
|
}
|
|
180
|
-
if (withdrawals)
|
|
181
|
-
keyHashFromWithdrawal(withdrawals);
|
|
176
|
+
if (withdrawals) keyHashFromWithdrawal(withdrawals);
|
|
182
177
|
const scripts = tx.witness_set().native_scripts();
|
|
183
178
|
function keyHashFromScript(scripts2) {
|
|
184
179
|
for (let i = 0; i < scripts2.len(); i++) {
|
|
@@ -201,8 +196,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
201
196
|
}
|
|
202
197
|
}
|
|
203
198
|
}
|
|
204
|
-
if (scripts)
|
|
205
|
-
keyHashFromScript(scripts);
|
|
199
|
+
if (scripts) keyHashFromScript(scripts);
|
|
206
200
|
const requiredSigners = txBody.required_signers();
|
|
207
201
|
if (requiredSigners) {
|
|
208
202
|
for (let i = 0; i < requiredSigners.len(); i++) {
|
|
@@ -352,8 +346,7 @@ var makeWalletFromPrivateKey = (provider, network, privateKey) => {
|
|
|
352
346
|
var makeWalletFromAPI = (provider, api) => {
|
|
353
347
|
const getAddressHex = async () => {
|
|
354
348
|
const [addressHex] = await api.getUsedAddresses();
|
|
355
|
-
if (addressHex)
|
|
356
|
-
return addressHex;
|
|
349
|
+
if (addressHex) return addressHex;
|
|
357
350
|
const [unusedAddressHex] = await api.getUnusedAddresses();
|
|
358
351
|
return unusedAddressHex;
|
|
359
352
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Network, KeyHash, UTxO, Address, RewardAddress, PrivateKey, Provider, Wallet, WalletApi } from '@lucid-evolution/core-types';
|
|
2
|
-
import * as CML from '@
|
|
2
|
+
import * as CML from '@anastasia-labs/cardano-multiplatform-lib-nodejs';
|
|
3
3
|
|
|
4
4
|
type FromSeed = {
|
|
5
5
|
address: Address;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Network, KeyHash, UTxO, Address, RewardAddress, PrivateKey, Provider, Wallet, WalletApi } from '@lucid-evolution/core-types';
|
|
2
|
-
import * as CML from '@
|
|
2
|
+
import * as CML from '@anastasia-labs/cardano-multiplatform-lib-nodejs';
|
|
3
3
|
|
|
4
4
|
type FromSeed = {
|
|
5
5
|
address: Address;
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,13 @@ import { getAddressDetails } from "@lucid-evolution/utils";
|
|
|
3
3
|
import { fromHex } from "@lucid-evolution/core-utils";
|
|
4
4
|
|
|
5
5
|
// src/core.ts
|
|
6
|
-
import * as CML from "@
|
|
6
|
+
import * as CML from "@anastasia-labs/cardano-multiplatform-lib-nodejs";
|
|
7
7
|
|
|
8
8
|
// src/wallet.ts
|
|
9
9
|
import { mnemonicToEntropy } from "@lucid-evolution/bip39";
|
|
10
10
|
function walletFromSeed(seed, options = { addressType: "Base", accountIndex: 0, network: "Mainnet" }) {
|
|
11
11
|
function harden(num) {
|
|
12
|
-
if (typeof num !== "number")
|
|
13
|
-
throw new Error("Type number required here!");
|
|
12
|
+
if (typeof num !== "number") throw new Error("Type number required here!");
|
|
14
13
|
return 2147483648 + num;
|
|
15
14
|
}
|
|
16
15
|
const entropy = mnemonicToEntropy(seed);
|
|
@@ -62,8 +61,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
62
61
|
const txBody = tx.body();
|
|
63
62
|
function keyHashFromCert(txBody2) {
|
|
64
63
|
const certs = txBody2.certs();
|
|
65
|
-
if (!certs)
|
|
66
|
-
return;
|
|
64
|
+
if (!certs) return;
|
|
67
65
|
for (let i = 0; i < certs.len(); i++) {
|
|
68
66
|
const cert = certs.get(i);
|
|
69
67
|
switch (cert.kind()) {
|
|
@@ -92,8 +90,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
92
90
|
case 3: {
|
|
93
91
|
const poolParams = cert.as_pool_registration()?.pool_params();
|
|
94
92
|
const owners = poolParams?.pool_owners();
|
|
95
|
-
if (!owners)
|
|
96
|
-
break;
|
|
93
|
+
if (!owners) break;
|
|
97
94
|
for (let i2 = 0; i2 < owners.len(); i2++) {
|
|
98
95
|
const keyHash = owners.get(i2).to_hex();
|
|
99
96
|
usedKeyHashes.push(keyHash);
|
|
@@ -119,8 +116,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
|
-
if (txBody.certs())
|
|
123
|
-
keyHashFromCert(txBody);
|
|
119
|
+
if (txBody.certs()) keyHashFromCert(txBody);
|
|
124
120
|
const withdrawals = txBody.withdrawals();
|
|
125
121
|
function keyHashFromWithdrawal(withdrawals2) {
|
|
126
122
|
const rewardAddresses = withdrawals2.keys();
|
|
@@ -136,8 +132,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
136
132
|
}
|
|
137
133
|
}
|
|
138
134
|
}
|
|
139
|
-
if (withdrawals)
|
|
140
|
-
keyHashFromWithdrawal(withdrawals);
|
|
135
|
+
if (withdrawals) keyHashFromWithdrawal(withdrawals);
|
|
141
136
|
const scripts = tx.witness_set().native_scripts();
|
|
142
137
|
function keyHashFromScript(scripts2) {
|
|
143
138
|
for (let i = 0; i < scripts2.len(); i++) {
|
|
@@ -160,8 +155,7 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
|
|
|
160
155
|
}
|
|
161
156
|
}
|
|
162
157
|
}
|
|
163
|
-
if (scripts)
|
|
164
|
-
keyHashFromScript(scripts);
|
|
158
|
+
if (scripts) keyHashFromScript(scripts);
|
|
165
159
|
const requiredSigners = txBody.required_signers();
|
|
166
160
|
if (requiredSigners) {
|
|
167
161
|
for (let i = 0; i < requiredSigners.len(); i++) {
|
|
@@ -317,8 +311,7 @@ var makeWalletFromPrivateKey = (provider, network, privateKey) => {
|
|
|
317
311
|
var makeWalletFromAPI = (provider, api) => {
|
|
318
312
|
const getAddressHex = async () => {
|
|
319
313
|
const [addressHex] = await api.getUsedAddresses();
|
|
320
|
-
if (addressHex)
|
|
321
|
-
return addressHex;
|
|
314
|
+
if (addressHex) return addressHex;
|
|
322
315
|
const [unusedAddressHex] = await api.getUnusedAddresses();
|
|
323
316
|
return unusedAddressHex;
|
|
324
317
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucid-evolution/wallet",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"browser": {
|
|
25
|
-
"@
|
|
25
|
+
"@anastasia-labs/cardano-multiplatform-lib-nodejs": "@anastasia-labs/cardano-multiplatform-lib-browser"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@lucid-evolution/bip39": "0.2.
|
|
30
|
-
"@lucid-evolution/core-types": "0.1.
|
|
31
|
-
"@lucid-evolution/core-utils": "0.1.
|
|
32
|
-
"@lucid-evolution/sign_data": "0.1.
|
|
33
|
-
"@lucid-evolution/utils": "0.1.
|
|
28
|
+
"@anastasia-labs/cardano-multiplatform-lib-nodejs": "^5.3.1-2",
|
|
29
|
+
"@lucid-evolution/bip39": "0.2.8",
|
|
30
|
+
"@lucid-evolution/core-types": "0.1.8",
|
|
31
|
+
"@lucid-evolution/core-utils": "0.1.7",
|
|
32
|
+
"@lucid-evolution/sign_data": "0.1.8",
|
|
33
|
+
"@lucid-evolution/utils": "0.1.21"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^20.12.8",
|