@dynamic-labs-wallet/midnight 1.0.91 → 1.0.92
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/index.cjs.js +133 -4
- package/index.esm.js +133 -4
- package/package.json +2 -2
- package/src/client/client.d.ts +33 -2
- package/src/client/client.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -664,6 +664,33 @@ function _object_spread_props(target, source) {
|
|
|
664
664
|
}
|
|
665
665
|
return target;
|
|
666
666
|
}
|
|
667
|
+
function _object_without_properties(source, excluded) {
|
|
668
|
+
if (source == null) return {};
|
|
669
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
670
|
+
var key, i;
|
|
671
|
+
if (Object.getOwnPropertySymbols) {
|
|
672
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
673
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
674
|
+
key = sourceSymbolKeys[i];
|
|
675
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
676
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
677
|
+
target[key] = source[key];
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
return target;
|
|
681
|
+
}
|
|
682
|
+
function _object_without_properties_loose(source, excluded) {
|
|
683
|
+
if (source == null) return {};
|
|
684
|
+
var target = {};
|
|
685
|
+
var sourceKeys = Object.keys(source);
|
|
686
|
+
var key, i;
|
|
687
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
688
|
+
key = sourceKeys[i];
|
|
689
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
690
|
+
target[key] = source[key];
|
|
691
|
+
}
|
|
692
|
+
return target;
|
|
693
|
+
}
|
|
667
694
|
function _possible_constructor_return(self, call) {
|
|
668
695
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
669
696
|
return call;
|
|
@@ -810,7 +837,12 @@ function _ts_values(o) {
|
|
|
810
837
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
811
838
|
}
|
|
812
839
|
/** Whether a sub-wallet side has finished syncing. `highestRelevantIndex`
|
|
813
|
-
* is 0 during sync, so `isStrictlyComplete()` is the authoritative signal. */
|
|
840
|
+
* is 0 during sync, so `isStrictlyComplete()` is the authoritative signal. */ /** Strict base64 (with optional padding) — used to validate host-supplied
|
|
841
|
+
* serialized transactions before they reach the ledger WASM deserializer. */ var BASE64_PATTERN = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
842
|
+
/** Upper bound on a serialized Midnight transaction the iframe will decode.
|
|
843
|
+
* Generous next to real transactions, small enough that a bad or hostile
|
|
844
|
+
* payload is rejected before any WASM work happens. */ var MAX_SERIALIZED_TRANSACTION_BYTES = 4 * 1024 * 1024;
|
|
845
|
+
var isSideSynced = function(side) {
|
|
814
846
|
var _side_state;
|
|
815
847
|
var _side_progress;
|
|
816
848
|
var p = (_side_progress = side === null || side === void 0 ? void 0 : side.progress) !== null && _side_progress !== void 0 ? _side_progress : side === null || side === void 0 ? void 0 : (_side_state = side.state) === null || _side_state === void 0 ? void 0 : _side_state.progress;
|
|
@@ -2681,7 +2713,7 @@ var DynamicMidnightWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
2681
2713
|
var accountAddress = param.accountAddress, transaction = param.transaction, _param_waitForBalance = param.waitForBalance, waitForBalance = _param_waitForBalance === void 0 ? false : _param_waitForBalance, tokenType = param.tokenType, balanceBefore = param.balanceBefore, password = param.password, signedSessionId = param.signedSessionId, mfaToken = param.mfaToken, elevatedAccessToken = param.elevatedAccessToken, networkId = param.networkId;
|
|
2682
2714
|
var _this = this;
|
|
2683
2715
|
return _async_to_generator(function() {
|
|
2684
|
-
var _updatedState_unshielded_balances, _updatedState_unshielded, wallet, txBytes, finalized, txIdentifier, txHash, canonicalHash, balanceBeforeBig, updatedState, _updatedState_unshielded_balances_tokenType, balanceAfter;
|
|
2716
|
+
var _updatedState_unshielded_balances, _updatedState_unshielded, wallet, txBytes, finalized, txIdentifier, submissionIdentifier, txHash, canonicalHash, balanceBeforeBig, updatedState, _updatedState_unshielded_balances_tokenType, balanceAfter;
|
|
2685
2717
|
return _ts_generator(this, function(_state) {
|
|
2686
2718
|
switch(_state.label){
|
|
2687
2719
|
case 0:
|
|
@@ -2710,7 +2742,12 @@ var DynamicMidnightWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
2710
2742
|
// but the block explorer indexes by the canonical transaction hash. Derive
|
|
2711
2743
|
// that hash from the finalized ledger transaction so explorer links resolve;
|
|
2712
2744
|
// fall back to the identifier if the hash can't be computed.
|
|
2713
|
-
txHash
|
|
2745
|
+
// Returned alongside txHash: midnight-js polls
|
|
2746
|
+
// `transactions(offset: { identifier })` to observe inclusion, so a caller
|
|
2747
|
+
// handed only the canonical hash waits forever on a transaction that
|
|
2748
|
+
// actually succeeded.
|
|
2749
|
+
submissionIdentifier = DynamicMidnightWalletClient.toTxHashString(txIdentifier);
|
|
2750
|
+
txHash = submissionIdentifier;
|
|
2714
2751
|
try {
|
|
2715
2752
|
canonicalHash = DynamicMidnightWalletClient.toTxHashString(finalized.transactionHash());
|
|
2716
2753
|
if (canonicalHash) txHash = canonicalHash;
|
|
@@ -2723,7 +2760,8 @@ var DynamicMidnightWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
2723
2760
|
return [
|
|
2724
2761
|
2,
|
|
2725
2762
|
{
|
|
2726
|
-
txHash: txHash
|
|
2763
|
+
txHash: txHash,
|
|
2764
|
+
txIdentifier: submissionIdentifier
|
|
2727
2765
|
}
|
|
2728
2766
|
];
|
|
2729
2767
|
}
|
|
@@ -2774,6 +2812,7 @@ var DynamicMidnightWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
2774
2812
|
2,
|
|
2775
2813
|
{
|
|
2776
2814
|
txHash: txHash,
|
|
2815
|
+
txIdentifier: submissionIdentifier,
|
|
2777
2816
|
balanceAfter: balanceAfter.toString()
|
|
2778
2817
|
}
|
|
2779
2818
|
];
|
|
@@ -3286,6 +3325,96 @@ var DynamicMidnightWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
3286
3325
|
})();
|
|
3287
3326
|
}
|
|
3288
3327
|
},
|
|
3328
|
+
{
|
|
3329
|
+
key: "getWalletProviderPublicKeys",
|
|
3330
|
+
value: /**
|
|
3331
|
+
* Initializes the iframe-resident wallet provider and returns only its public
|
|
3332
|
+
* keys. Secret wallet state never crosses the iframe transport boundary.
|
|
3333
|
+
*/ function getWalletProviderPublicKeys(params) {
|
|
3334
|
+
var _this = this;
|
|
3335
|
+
return _async_to_generator(function() {
|
|
3336
|
+
var walletProvider;
|
|
3337
|
+
return _ts_generator(this, function(_state) {
|
|
3338
|
+
switch(_state.label){
|
|
3339
|
+
case 0:
|
|
3340
|
+
return [
|
|
3341
|
+
4,
|
|
3342
|
+
_this.getWalletProvider(params)
|
|
3343
|
+
];
|
|
3344
|
+
case 1:
|
|
3345
|
+
walletProvider = _state.sent().walletProvider;
|
|
3346
|
+
return [
|
|
3347
|
+
2,
|
|
3348
|
+
{
|
|
3349
|
+
coinPublicKey: walletProvider.getCoinPublicKey(),
|
|
3350
|
+
encryptionPublicKey: walletProvider.getEncryptionPublicKey(),
|
|
3351
|
+
status: 'ready'
|
|
3352
|
+
}
|
|
3353
|
+
];
|
|
3354
|
+
}
|
|
3355
|
+
});
|
|
3356
|
+
})();
|
|
3357
|
+
}
|
|
3358
|
+
},
|
|
3359
|
+
{
|
|
3360
|
+
key: "balanceWalletProviderTransaction",
|
|
3361
|
+
value: /**
|
|
3362
|
+
* Balances a midnight-js UnboundTransaction inside the iframe. The host sends
|
|
3363
|
+
* only serialized transaction data; MPC, shielded, and DUST keys remain here.
|
|
3364
|
+
*/ function balanceWalletProviderTransaction(_param) {
|
|
3365
|
+
var _this = this;
|
|
3366
|
+
return _async_to_generator(function() {
|
|
3367
|
+
var transaction, ttl, providerParams, ttlDate, txBytes, unboundTransaction, walletProvider, finalizedTransaction;
|
|
3368
|
+
return _ts_generator(this, function(_state) {
|
|
3369
|
+
switch(_state.label){
|
|
3370
|
+
case 0:
|
|
3371
|
+
transaction = _param.transaction, ttl = _param.ttl, providerParams = _object_without_properties(_param, [
|
|
3372
|
+
"transaction",
|
|
3373
|
+
"ttl"
|
|
3374
|
+
]);
|
|
3375
|
+
if (!transaction) {
|
|
3376
|
+
throw new Error('balanceWalletProviderTransaction: transaction is required');
|
|
3377
|
+
}
|
|
3378
|
+
ttlDate = ttl ? new Date(ttl) : undefined;
|
|
3379
|
+
if (ttlDate && Number.isNaN(ttlDate.getTime())) {
|
|
3380
|
+
throw new Error('balanceWalletProviderTransaction: ttl must be a valid ISO-8601 date');
|
|
3381
|
+
}
|
|
3382
|
+
// Host-controlled string, so validate shape before the WASM deserializer.
|
|
3383
|
+
// `Buffer.from(..., 'base64')` silently drops invalid characters rather than
|
|
3384
|
+
// throwing, so a malformed payload would otherwise reach `deserialize` as
|
|
3385
|
+
// truncated-but-plausible bytes and fail with an opaque WASM error. The
|
|
3386
|
+
// upper bound also stops a huge body from being decoded at all.
|
|
3387
|
+
if (!BASE64_PATTERN.test(transaction)) {
|
|
3388
|
+
throw new Error('balanceWalletProviderTransaction: transaction must be base64');
|
|
3389
|
+
}
|
|
3390
|
+
txBytes = Buffer.from(transaction, 'base64');
|
|
3391
|
+
if (txBytes.length === 0 || txBytes.length > MAX_SERIALIZED_TRANSACTION_BYTES) {
|
|
3392
|
+
throw new Error("balanceWalletProviderTransaction: transaction must decode to 1..".concat(MAX_SERIALIZED_TRANSACTION_BYTES, " bytes, got ").concat(txBytes.length));
|
|
3393
|
+
}
|
|
3394
|
+
unboundTransaction = ledger__namespace.Transaction.deserialize('signature', 'proof', 'pre-binding', new Uint8Array(txBytes));
|
|
3395
|
+
return [
|
|
3396
|
+
4,
|
|
3397
|
+
_this.getWalletProvider(providerParams)
|
|
3398
|
+
];
|
|
3399
|
+
case 1:
|
|
3400
|
+
walletProvider = _state.sent().walletProvider;
|
|
3401
|
+
return [
|
|
3402
|
+
4,
|
|
3403
|
+
walletProvider.balanceTx(unboundTransaction, ttlDate)
|
|
3404
|
+
];
|
|
3405
|
+
case 2:
|
|
3406
|
+
finalizedTransaction = _state.sent();
|
|
3407
|
+
return [
|
|
3408
|
+
2,
|
|
3409
|
+
{
|
|
3410
|
+
transaction: Buffer.from(finalizedTransaction.serialize()).toString('base64')
|
|
3411
|
+
}
|
|
3412
|
+
];
|
|
3413
|
+
}
|
|
3414
|
+
});
|
|
3415
|
+
})();
|
|
3416
|
+
}
|
|
3417
|
+
},
|
|
3289
3418
|
{
|
|
3290
3419
|
key: "getWalletProvider",
|
|
3291
3420
|
value: /**
|
package/index.esm.js
CHANGED
|
@@ -643,6 +643,33 @@ function _object_spread_props(target, source) {
|
|
|
643
643
|
}
|
|
644
644
|
return target;
|
|
645
645
|
}
|
|
646
|
+
function _object_without_properties(source, excluded) {
|
|
647
|
+
if (source == null) return {};
|
|
648
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
649
|
+
var key, i;
|
|
650
|
+
if (Object.getOwnPropertySymbols) {
|
|
651
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
652
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
653
|
+
key = sourceSymbolKeys[i];
|
|
654
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
655
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
656
|
+
target[key] = source[key];
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return target;
|
|
660
|
+
}
|
|
661
|
+
function _object_without_properties_loose(source, excluded) {
|
|
662
|
+
if (source == null) return {};
|
|
663
|
+
var target = {};
|
|
664
|
+
var sourceKeys = Object.keys(source);
|
|
665
|
+
var key, i;
|
|
666
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
667
|
+
key = sourceKeys[i];
|
|
668
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
669
|
+
target[key] = source[key];
|
|
670
|
+
}
|
|
671
|
+
return target;
|
|
672
|
+
}
|
|
646
673
|
function _possible_constructor_return(self, call) {
|
|
647
674
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
648
675
|
return call;
|
|
@@ -789,7 +816,12 @@ function _ts_values(o) {
|
|
|
789
816
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
790
817
|
}
|
|
791
818
|
/** Whether a sub-wallet side has finished syncing. `highestRelevantIndex`
|
|
792
|
-
* is 0 during sync, so `isStrictlyComplete()` is the authoritative signal. */
|
|
819
|
+
* is 0 during sync, so `isStrictlyComplete()` is the authoritative signal. */ /** Strict base64 (with optional padding) — used to validate host-supplied
|
|
820
|
+
* serialized transactions before they reach the ledger WASM deserializer. */ var BASE64_PATTERN = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
821
|
+
/** Upper bound on a serialized Midnight transaction the iframe will decode.
|
|
822
|
+
* Generous next to real transactions, small enough that a bad or hostile
|
|
823
|
+
* payload is rejected before any WASM work happens. */ var MAX_SERIALIZED_TRANSACTION_BYTES = 4 * 1024 * 1024;
|
|
824
|
+
var isSideSynced = function(side) {
|
|
793
825
|
var _side_state;
|
|
794
826
|
var _side_progress;
|
|
795
827
|
var p = (_side_progress = side === null || side === void 0 ? void 0 : side.progress) !== null && _side_progress !== void 0 ? _side_progress : side === null || side === void 0 ? void 0 : (_side_state = side.state) === null || _side_state === void 0 ? void 0 : _side_state.progress;
|
|
@@ -2660,7 +2692,7 @@ var DynamicMidnightWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
2660
2692
|
var accountAddress = param.accountAddress, transaction = param.transaction, _param_waitForBalance = param.waitForBalance, waitForBalance = _param_waitForBalance === void 0 ? false : _param_waitForBalance, tokenType = param.tokenType, balanceBefore = param.balanceBefore, password = param.password, signedSessionId = param.signedSessionId, mfaToken = param.mfaToken, elevatedAccessToken = param.elevatedAccessToken, networkId = param.networkId;
|
|
2661
2693
|
var _this = this;
|
|
2662
2694
|
return _async_to_generator(function() {
|
|
2663
|
-
var _updatedState_unshielded_balances, _updatedState_unshielded, wallet, txBytes, finalized, txIdentifier, txHash, canonicalHash, balanceBeforeBig, updatedState, _updatedState_unshielded_balances_tokenType, balanceAfter;
|
|
2695
|
+
var _updatedState_unshielded_balances, _updatedState_unshielded, wallet, txBytes, finalized, txIdentifier, submissionIdentifier, txHash, canonicalHash, balanceBeforeBig, updatedState, _updatedState_unshielded_balances_tokenType, balanceAfter;
|
|
2664
2696
|
return _ts_generator(this, function(_state) {
|
|
2665
2697
|
switch(_state.label){
|
|
2666
2698
|
case 0:
|
|
@@ -2689,7 +2721,12 @@ var DynamicMidnightWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
2689
2721
|
// but the block explorer indexes by the canonical transaction hash. Derive
|
|
2690
2722
|
// that hash from the finalized ledger transaction so explorer links resolve;
|
|
2691
2723
|
// fall back to the identifier if the hash can't be computed.
|
|
2692
|
-
txHash
|
|
2724
|
+
// Returned alongside txHash: midnight-js polls
|
|
2725
|
+
// `transactions(offset: { identifier })` to observe inclusion, so a caller
|
|
2726
|
+
// handed only the canonical hash waits forever on a transaction that
|
|
2727
|
+
// actually succeeded.
|
|
2728
|
+
submissionIdentifier = DynamicMidnightWalletClient.toTxHashString(txIdentifier);
|
|
2729
|
+
txHash = submissionIdentifier;
|
|
2693
2730
|
try {
|
|
2694
2731
|
canonicalHash = DynamicMidnightWalletClient.toTxHashString(finalized.transactionHash());
|
|
2695
2732
|
if (canonicalHash) txHash = canonicalHash;
|
|
@@ -2702,7 +2739,8 @@ var DynamicMidnightWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
2702
2739
|
return [
|
|
2703
2740
|
2,
|
|
2704
2741
|
{
|
|
2705
|
-
txHash: txHash
|
|
2742
|
+
txHash: txHash,
|
|
2743
|
+
txIdentifier: submissionIdentifier
|
|
2706
2744
|
}
|
|
2707
2745
|
];
|
|
2708
2746
|
}
|
|
@@ -2753,6 +2791,7 @@ var DynamicMidnightWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
2753
2791
|
2,
|
|
2754
2792
|
{
|
|
2755
2793
|
txHash: txHash,
|
|
2794
|
+
txIdentifier: submissionIdentifier,
|
|
2756
2795
|
balanceAfter: balanceAfter.toString()
|
|
2757
2796
|
}
|
|
2758
2797
|
];
|
|
@@ -3265,6 +3304,96 @@ var DynamicMidnightWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
3265
3304
|
})();
|
|
3266
3305
|
}
|
|
3267
3306
|
},
|
|
3307
|
+
{
|
|
3308
|
+
key: "getWalletProviderPublicKeys",
|
|
3309
|
+
value: /**
|
|
3310
|
+
* Initializes the iframe-resident wallet provider and returns only its public
|
|
3311
|
+
* keys. Secret wallet state never crosses the iframe transport boundary.
|
|
3312
|
+
*/ function getWalletProviderPublicKeys(params) {
|
|
3313
|
+
var _this = this;
|
|
3314
|
+
return _async_to_generator(function() {
|
|
3315
|
+
var walletProvider;
|
|
3316
|
+
return _ts_generator(this, function(_state) {
|
|
3317
|
+
switch(_state.label){
|
|
3318
|
+
case 0:
|
|
3319
|
+
return [
|
|
3320
|
+
4,
|
|
3321
|
+
_this.getWalletProvider(params)
|
|
3322
|
+
];
|
|
3323
|
+
case 1:
|
|
3324
|
+
walletProvider = _state.sent().walletProvider;
|
|
3325
|
+
return [
|
|
3326
|
+
2,
|
|
3327
|
+
{
|
|
3328
|
+
coinPublicKey: walletProvider.getCoinPublicKey(),
|
|
3329
|
+
encryptionPublicKey: walletProvider.getEncryptionPublicKey(),
|
|
3330
|
+
status: 'ready'
|
|
3331
|
+
}
|
|
3332
|
+
];
|
|
3333
|
+
}
|
|
3334
|
+
});
|
|
3335
|
+
})();
|
|
3336
|
+
}
|
|
3337
|
+
},
|
|
3338
|
+
{
|
|
3339
|
+
key: "balanceWalletProviderTransaction",
|
|
3340
|
+
value: /**
|
|
3341
|
+
* Balances a midnight-js UnboundTransaction inside the iframe. The host sends
|
|
3342
|
+
* only serialized transaction data; MPC, shielded, and DUST keys remain here.
|
|
3343
|
+
*/ function balanceWalletProviderTransaction(_param) {
|
|
3344
|
+
var _this = this;
|
|
3345
|
+
return _async_to_generator(function() {
|
|
3346
|
+
var transaction, ttl, providerParams, ttlDate, txBytes, unboundTransaction, walletProvider, finalizedTransaction;
|
|
3347
|
+
return _ts_generator(this, function(_state) {
|
|
3348
|
+
switch(_state.label){
|
|
3349
|
+
case 0:
|
|
3350
|
+
transaction = _param.transaction, ttl = _param.ttl, providerParams = _object_without_properties(_param, [
|
|
3351
|
+
"transaction",
|
|
3352
|
+
"ttl"
|
|
3353
|
+
]);
|
|
3354
|
+
if (!transaction) {
|
|
3355
|
+
throw new Error('balanceWalletProviderTransaction: transaction is required');
|
|
3356
|
+
}
|
|
3357
|
+
ttlDate = ttl ? new Date(ttl) : undefined;
|
|
3358
|
+
if (ttlDate && Number.isNaN(ttlDate.getTime())) {
|
|
3359
|
+
throw new Error('balanceWalletProviderTransaction: ttl must be a valid ISO-8601 date');
|
|
3360
|
+
}
|
|
3361
|
+
// Host-controlled string, so validate shape before the WASM deserializer.
|
|
3362
|
+
// `Buffer.from(..., 'base64')` silently drops invalid characters rather than
|
|
3363
|
+
// throwing, so a malformed payload would otherwise reach `deserialize` as
|
|
3364
|
+
// truncated-but-plausible bytes and fail with an opaque WASM error. The
|
|
3365
|
+
// upper bound also stops a huge body from being decoded at all.
|
|
3366
|
+
if (!BASE64_PATTERN.test(transaction)) {
|
|
3367
|
+
throw new Error('balanceWalletProviderTransaction: transaction must be base64');
|
|
3368
|
+
}
|
|
3369
|
+
txBytes = Buffer.from(transaction, 'base64');
|
|
3370
|
+
if (txBytes.length === 0 || txBytes.length > MAX_SERIALIZED_TRANSACTION_BYTES) {
|
|
3371
|
+
throw new Error("balanceWalletProviderTransaction: transaction must decode to 1..".concat(MAX_SERIALIZED_TRANSACTION_BYTES, " bytes, got ").concat(txBytes.length));
|
|
3372
|
+
}
|
|
3373
|
+
unboundTransaction = ledger.Transaction.deserialize('signature', 'proof', 'pre-binding', new Uint8Array(txBytes));
|
|
3374
|
+
return [
|
|
3375
|
+
4,
|
|
3376
|
+
_this.getWalletProvider(providerParams)
|
|
3377
|
+
];
|
|
3378
|
+
case 1:
|
|
3379
|
+
walletProvider = _state.sent().walletProvider;
|
|
3380
|
+
return [
|
|
3381
|
+
4,
|
|
3382
|
+
walletProvider.balanceTx(unboundTransaction, ttlDate)
|
|
3383
|
+
];
|
|
3384
|
+
case 2:
|
|
3385
|
+
finalizedTransaction = _state.sent();
|
|
3386
|
+
return [
|
|
3387
|
+
2,
|
|
3388
|
+
{
|
|
3389
|
+
transaction: Buffer.from(finalizedTransaction.serialize()).toString('base64')
|
|
3390
|
+
}
|
|
3391
|
+
];
|
|
3392
|
+
}
|
|
3393
|
+
});
|
|
3394
|
+
})();
|
|
3395
|
+
}
|
|
3396
|
+
},
|
|
3268
3397
|
{
|
|
3269
3398
|
key: "getWalletProvider",
|
|
3270
3399
|
value: /**
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/midnight",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.92",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/browser": "1.0.
|
|
7
|
+
"@dynamic-labs-wallet/browser": "1.0.92",
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "^0.0.1093",
|
|
9
9
|
"@midnight-ntwrk/ledger-v8": "^8.1.0",
|
|
10
10
|
"@midnight-ntwrk/wallet-sdk-abstractions": "2.1.0",
|
package/src/client/client.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
|
|
|
11
11
|
* never use this client.
|
|
12
12
|
*/
|
|
13
13
|
type WalletSyncMode = 'full' | 'shielded-unshielded';
|
|
14
|
-
/** Whether a sub-wallet side has finished syncing. `highestRelevantIndex`
|
|
15
|
-
* is 0 during sync, so `isStrictlyComplete()` is the authoritative signal. */
|
|
16
14
|
export declare const isSideSynced: (side: any) => boolean;
|
|
17
15
|
/** Resolve predicate for the sync wait, per mode. */
|
|
18
16
|
export declare const isSyncResolved: (s: any, mode: WalletSyncMode) => boolean;
|
|
@@ -217,6 +215,7 @@ export declare class DynamicMidnightWalletClient extends DynamicWalletClient {
|
|
|
217
215
|
networkId?: number | string;
|
|
218
216
|
}): Promise<{
|
|
219
217
|
txHash: string;
|
|
218
|
+
txIdentifier: string;
|
|
220
219
|
balanceAfter?: string;
|
|
221
220
|
}>;
|
|
222
221
|
/**
|
|
@@ -272,6 +271,38 @@ export declare class DynamicMidnightWalletClient extends DynamicWalletClient {
|
|
|
272
271
|
* (same pattern as BTC's PSBT in per-input context).
|
|
273
272
|
*/
|
|
274
273
|
private mpcSignIntents;
|
|
274
|
+
/**
|
|
275
|
+
* Initializes the iframe-resident wallet provider and returns only its public
|
|
276
|
+
* keys. Secret wallet state never crosses the iframe transport boundary.
|
|
277
|
+
*/
|
|
278
|
+
getWalletProviderPublicKeys(params: {
|
|
279
|
+
accountAddress: string;
|
|
280
|
+
password?: string;
|
|
281
|
+
signedSessionId: string;
|
|
282
|
+
mfaToken?: string;
|
|
283
|
+
elevatedAccessToken?: string;
|
|
284
|
+
networkId?: number | string;
|
|
285
|
+
}): Promise<{
|
|
286
|
+
coinPublicKey: string;
|
|
287
|
+
encryptionPublicKey: string;
|
|
288
|
+
status: 'ready';
|
|
289
|
+
}>;
|
|
290
|
+
/**
|
|
291
|
+
* Balances a midnight-js UnboundTransaction inside the iframe. The host sends
|
|
292
|
+
* only serialized transaction data; MPC, shielded, and DUST keys remain here.
|
|
293
|
+
*/
|
|
294
|
+
balanceWalletProviderTransaction({ transaction, ttl, ...providerParams }: {
|
|
295
|
+
accountAddress: string;
|
|
296
|
+
transaction: string;
|
|
297
|
+
ttl?: string;
|
|
298
|
+
password?: string;
|
|
299
|
+
signedSessionId: string;
|
|
300
|
+
mfaToken?: string;
|
|
301
|
+
elevatedAccessToken?: string;
|
|
302
|
+
networkId?: number | string;
|
|
303
|
+
}): Promise<{
|
|
304
|
+
transaction: string;
|
|
305
|
+
}>;
|
|
275
306
|
/**
|
|
276
307
|
* Returns a Midnight.js-compatible WalletProvider for use with
|
|
277
308
|
* midnight-js-contracts. Signing goes through MPC — no private key exposed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAKnB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EACpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAsCrE;;;;;;;;;GASG;AACH,KAAK,cAAc,GAAG,MAAM,GAAG,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAKnB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EACpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAsCrE;;;;;;;;;GASG;AACH,KAAK,cAAc,GAAG,MAAM,GAAG,qBAAqB,CAAC;AAarD,eAAO,MAAM,YAAY,SAAU,GAAG,KAAG,OAOxC,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,cAAc,MAAO,GAAG,QAAQ,cAAc,KAAG,OACkC,CAAC;AAEjG,qBAAa,2BAA4B,SAAQ,mBAAmB;IAClE,QAAQ,CAAC,SAAS,cAAc;IAMhC,OAAO,CAAC,YAAY,CASJ;IAOhB,OAAO,CAAC,QAAQ,CAAC,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