@onekeyfe/cardano-coin-selection-asmjs 1.1.0 → 1.1.1
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.
|
@@ -72,7 +72,6 @@ const generateKeys = (keys, xpub) => {
|
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
74
|
const outputsToOneKey = (outputs, changeAddress) => {
|
|
75
|
-
var _a, _b;
|
|
76
75
|
const onekeyOutputs = [];
|
|
77
76
|
for (let i = 0; i < outputs.len(); i++) {
|
|
78
77
|
const output = outputs.get(i);
|
|
@@ -147,15 +146,15 @@ const outputsToOneKey = (outputs, changeAddress) => {
|
|
|
147
146
|
: {
|
|
148
147
|
address: outputAddressHuman,
|
|
149
148
|
};
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
// https://github.com/dcSpark/cardano-multiplatform-lib/blob/c6a6d110065e98ed50640c7380d12748856608cf/chain/rust/src/transaction/mod.rs#L87
|
|
150
|
+
// https://github.com/dcSpark/cardano-multiplatform-lib/blob/c6a6d110065e98ed50640c7380d12748856608cf/chain/rust/src/transaction/mod.rs#L117-L136
|
|
151
|
+
// data_hash : kind = 0
|
|
152
|
+
// plutus_data : kind = 1
|
|
153
|
+
const datumHash = output.has_data_hash()
|
|
153
154
|
? output.data_hash().to_hex()
|
|
154
155
|
: null;
|
|
155
|
-
const inlineDatum = output.
|
|
156
|
-
output.
|
|
157
|
-
((_b = output.plutus_data()) === null || _b === void 0 ? void 0 : _b.kind()) === 1
|
|
158
|
-
? output.data_hash().to_hex()
|
|
156
|
+
const inlineDatum = output.has_plutus_data()
|
|
157
|
+
? output.plutus_data().to_hex()
|
|
159
158
|
: null;
|
|
160
159
|
// const datumHash =
|
|
161
160
|
// output.datum() && output.datum().kind() === 0
|
|
@@ -169,7 +168,11 @@ const outputsToOneKey = (outputs, changeAddress) => {
|
|
|
169
168
|
? Buffer.from(output.script_ref().get().to_bytes()).toString('hex')
|
|
170
169
|
: null;
|
|
171
170
|
const outputRes = Object.assign({ amount: output.amount().coin().to_str(), tokenBundle,
|
|
172
|
-
datumHash,
|
|
171
|
+
datumHash,
|
|
172
|
+
// https://github.com/input-output-hk/nami/commit/a5f5a9357da81307bff9bc77ef2476f1746c134a#diff-1c7110974e24c349d96acac1989fe76c94b0031ab0f5a114e10823e5d74549deR421-R423
|
|
173
|
+
format: Buffer.from(output.to_bytes()).toString('hex').startsWith('a')
|
|
174
|
+
? 1
|
|
175
|
+
: 0, inlineDatum,
|
|
173
176
|
referenceScript }, destination);
|
|
174
177
|
if (!tokenBundle)
|
|
175
178
|
delete outputRes.tokenBundle;
|
|
@@ -427,6 +430,12 @@ const txToOneKey = async (rawTx, network, initKeys, xpub, changeAddress) => {
|
|
|
427
430
|
keyPath: keys.payment.path,
|
|
428
431
|
});
|
|
429
432
|
}
|
|
433
|
+
else if (signer === keys.stake.hash) {
|
|
434
|
+
// https://github.com/input-output-hk/nami/commit/a5f5a9357da81307bff9bc77ef2476f1746c134a#diff-1c7110974e24c349d96acac1989fe76c94b0031ab0f5a114e10823e5d74549deR421-R423
|
|
435
|
+
requiredSigners.push({
|
|
436
|
+
keyPath: keys.stake.path,
|
|
437
|
+
});
|
|
438
|
+
}
|
|
430
439
|
else {
|
|
431
440
|
requiredSigners.push({
|
|
432
441
|
keyHash: signer,
|
|
@@ -46,7 +46,6 @@ const generateKeys = (keys, xpub) => {
|
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
const outputsToOneKey = (outputs, changeAddress) => {
|
|
49
|
-
var _a, _b;
|
|
50
49
|
const onekeyOutputs = [];
|
|
51
50
|
for (let i = 0; i < outputs.len(); i++) {
|
|
52
51
|
const output = outputs.get(i);
|
|
@@ -121,15 +120,15 @@ const outputsToOneKey = (outputs, changeAddress) => {
|
|
|
121
120
|
: {
|
|
122
121
|
address: outputAddressHuman,
|
|
123
122
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
// https://github.com/dcSpark/cardano-multiplatform-lib/blob/c6a6d110065e98ed50640c7380d12748856608cf/chain/rust/src/transaction/mod.rs#L87
|
|
124
|
+
// https://github.com/dcSpark/cardano-multiplatform-lib/blob/c6a6d110065e98ed50640c7380d12748856608cf/chain/rust/src/transaction/mod.rs#L117-L136
|
|
125
|
+
// data_hash : kind = 0
|
|
126
|
+
// plutus_data : kind = 1
|
|
127
|
+
const datumHash = output.has_data_hash()
|
|
127
128
|
? output.data_hash().to_hex()
|
|
128
129
|
: null;
|
|
129
|
-
const inlineDatum = output.
|
|
130
|
-
output.
|
|
131
|
-
((_b = output.plutus_data()) === null || _b === void 0 ? void 0 : _b.kind()) === 1
|
|
132
|
-
? output.data_hash().to_hex()
|
|
130
|
+
const inlineDatum = output.has_plutus_data()
|
|
131
|
+
? output.plutus_data().to_hex()
|
|
133
132
|
: null;
|
|
134
133
|
// const datumHash =
|
|
135
134
|
// output.datum() && output.datum().kind() === 0
|
|
@@ -143,7 +142,11 @@ const outputsToOneKey = (outputs, changeAddress) => {
|
|
|
143
142
|
? Buffer.from(output.script_ref().get().to_bytes()).toString('hex')
|
|
144
143
|
: null;
|
|
145
144
|
const outputRes = Object.assign({ amount: output.amount().coin().to_str(), tokenBundle,
|
|
146
|
-
datumHash,
|
|
145
|
+
datumHash,
|
|
146
|
+
// https://github.com/input-output-hk/nami/commit/a5f5a9357da81307bff9bc77ef2476f1746c134a#diff-1c7110974e24c349d96acac1989fe76c94b0031ab0f5a114e10823e5d74549deR421-R423
|
|
147
|
+
format: Buffer.from(output.to_bytes()).toString('hex').startsWith('a')
|
|
148
|
+
? 1
|
|
149
|
+
: 0, inlineDatum,
|
|
147
150
|
referenceScript }, destination);
|
|
148
151
|
if (!tokenBundle)
|
|
149
152
|
delete outputRes.tokenBundle;
|
|
@@ -401,6 +404,12 @@ export const txToOneKey = async (rawTx, network, initKeys, xpub, changeAddress)
|
|
|
401
404
|
keyPath: keys.payment.path,
|
|
402
405
|
});
|
|
403
406
|
}
|
|
407
|
+
else if (signer === keys.stake.hash) {
|
|
408
|
+
// https://github.com/input-output-hk/nami/commit/a5f5a9357da81307bff9bc77ef2476f1746c134a#diff-1c7110974e24c349d96acac1989fe76c94b0031ab0f5a114e10823e5d74549deR421-R423
|
|
409
|
+
requiredSigners.push({
|
|
410
|
+
keyPath: keys.stake.path,
|
|
411
|
+
});
|
|
412
|
+
}
|
|
404
413
|
else {
|
|
405
414
|
requiredSigners.push({
|
|
406
415
|
keyHash: signer,
|