@midnight-ntwrk/wallet-sdk-facade 2.0.0-rc.2 → 2.0.0
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/README.md +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +11 -3
- package/dist/transaction.js +1 -1
- package/package.json +11 -18
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ The Wallet Facade provides a high-level unified interface that aggregates the fu
|
|
|
14
14
|
(shielded, unshielded, and dust). It simplifies wallet operations by providing:
|
|
15
15
|
|
|
16
16
|
- Combined state management across all wallet types
|
|
17
|
-
- Unified transaction balancing for shielded, unshielded, and dust
|
|
17
|
+
- Unified transaction balancing for shielded, unshielded, and dust
|
|
18
18
|
- Coordinated transfer and swap operations
|
|
19
19
|
- Simplified transaction finalization flow
|
|
20
20
|
- Dust registration management
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as ledger from '@midnight-ntwrk/ledger-v7';
|
|
2
2
|
import { type DefaultSubmissionConfiguration, type SubmissionService } from '@midnight-ntwrk/wallet-sdk-capabilities';
|
|
3
3
|
import { type DefaultProvingConfiguration, type ProvingService, type UnboundTransaction } from '@midnight-ntwrk/wallet-sdk-capabilities/proving';
|
|
4
|
-
import { type
|
|
4
|
+
import { type DefaultDustConfiguration, type DustWalletAPI, type DustWalletState } from '@midnight-ntwrk/wallet-sdk-dust-wallet';
|
|
5
|
+
import { type AnyTransaction, type CoinsAndBalances as DustCoinsAndBalances } from '@midnight-ntwrk/wallet-sdk-dust-wallet/v1';
|
|
5
6
|
import { type DefaultShieldedConfiguration, type ShieldedWalletAPI, type ShieldedWalletState } from '@midnight-ntwrk/wallet-sdk-shielded';
|
|
6
7
|
import type { DefaultUnshieldedConfiguration, UnshieldedWalletAPI } from '@midnight-ntwrk/wallet-sdk-unshielded-wallet';
|
|
7
8
|
import { type UnshieldedWalletState } from '@midnight-ntwrk/wallet-sdk-unshielded-wallet';
|
|
@@ -61,6 +62,7 @@ export type UtxoWithMeta = {
|
|
|
61
62
|
utxo: ledger.Utxo;
|
|
62
63
|
meta: {
|
|
63
64
|
ctime: Date;
|
|
65
|
+
registeredForDustGeneration: boolean;
|
|
64
66
|
};
|
|
65
67
|
};
|
|
66
68
|
export declare class FacadeState {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is part of MIDNIGHT-WALLET-SDK.
|
|
2
|
-
// Copyright (C)
|
|
2
|
+
// Copyright (C) Midnight Foundation
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
// You may not use this file except in compliance with the License.
|
|
@@ -132,7 +132,11 @@ export class WalletFacade {
|
|
|
132
132
|
}
|
|
133
133
|
async createDustActionTransaction(action, nightUtxos, nightVerifyingKey, signDustRegistration) {
|
|
134
134
|
const ttl = this.defaultTtl();
|
|
135
|
-
const transaction = await this.dust.createDustGenerationTransaction(undefined, ttl, nightUtxos.map(({ utxo, meta }) => ({
|
|
135
|
+
const transaction = await this.dust.createDustGenerationTransaction(undefined, ttl, nightUtxos.map(({ utxo, meta }) => ({
|
|
136
|
+
...utxo,
|
|
137
|
+
ctime: meta.ctime,
|
|
138
|
+
registeredForDustGeneration: meta.registeredForDustGeneration,
|
|
139
|
+
})), nightVerifyingKey, action.type === 'registration' ? action.dustReceiverAddress : undefined);
|
|
136
140
|
const intent = transaction.intents?.get(1);
|
|
137
141
|
if (!intent) {
|
|
138
142
|
throw Error('Dust generation transaction is missing intent segment 1.');
|
|
@@ -365,7 +369,11 @@ export class WalletFacade {
|
|
|
365
369
|
async estimateRegistration(nightUtxos) {
|
|
366
370
|
const now = new Date();
|
|
367
371
|
const dustState = await this.dust.waitForSyncedState();
|
|
368
|
-
const dustGenerationEstimations = pipe(nightUtxos, Arr.map(({ utxo, meta }) => ({
|
|
372
|
+
const dustGenerationEstimations = pipe(nightUtxos, Arr.map(({ utxo, meta }) => ({
|
|
373
|
+
...utxo,
|
|
374
|
+
ctime: meta.ctime,
|
|
375
|
+
registeredForDustGeneration: meta.registeredForDustGeneration,
|
|
376
|
+
})), (utxosWithMeta) => dustState.estimateDustGeneration(utxosWithMeta, now), (estimatedUtxos) => dustState.capabilities.coinsAndBalances.splitNightUtxos(estimatedUtxos), (split) => split.guaranteed);
|
|
369
377
|
const fakeSigningKey = ledger.sampleSigningKey();
|
|
370
378
|
const fakeVerifyingKey = ledger.signatureVerifyingKey(fakeSigningKey);
|
|
371
379
|
const fakeRegistrationRecipe = await this.registerNightUtxosForDustGeneration(nightUtxos, fakeVerifyingKey, (payload) => ledger.signData(fakeSigningKey, payload), dustState.address);
|
package/dist/transaction.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* This file is part of MIDNIGHT-WALLET-SDK.
|
|
3
|
-
* Copyright (C)
|
|
3
|
+
* Copyright (C) Midnight Foundation
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* You may not use this file except in compliance with the License.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midnight-ntwrk/wallet-sdk-facade",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -24,25 +24,18 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@midnight-ntwrk/ledger-v7": "^7.0.
|
|
28
|
-
"@midnight-ntwrk/wallet-sdk-address-format": "^3.0.
|
|
29
|
-
"@midnight-ntwrk/wallet-sdk-capabilities": "^3.1.0
|
|
30
|
-
"@midnight-ntwrk/wallet-sdk-dust-wallet": "^2.0.0
|
|
31
|
-
"@midnight-ntwrk/wallet-sdk-shielded": "^2.0.0
|
|
32
|
-
"@midnight-ntwrk/wallet-sdk-unshielded-wallet": "^2.0.0
|
|
33
|
-
"rxjs": "^7.
|
|
27
|
+
"@midnight-ntwrk/ledger-v7": "^7.0.2",
|
|
28
|
+
"@midnight-ntwrk/wallet-sdk-address-format": "^3.0.1",
|
|
29
|
+
"@midnight-ntwrk/wallet-sdk-capabilities": "^3.1.0",
|
|
30
|
+
"@midnight-ntwrk/wallet-sdk-dust-wallet": "^2.0.0",
|
|
31
|
+
"@midnight-ntwrk/wallet-sdk-shielded": "^2.0.0",
|
|
32
|
+
"@midnight-ntwrk/wallet-sdk-unshielded-wallet": "^2.0.0",
|
|
33
|
+
"rxjs": "^7.8.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@midnight-ntwrk/wallet-sdk-abstractions": "^2.0.0
|
|
37
|
-
"@midnight-ntwrk/wallet-sdk-hd": "^3.0.
|
|
38
|
-
"@midnight-ntwrk/wallet-sdk-
|
|
39
|
-
"eslint": "^9.37.0",
|
|
40
|
-
"prettier": "^3.7.0",
|
|
41
|
-
"publint": "~0.3.14",
|
|
42
|
-
"rimraf": "^6.0.1",
|
|
43
|
-
"testcontainers": "^11.10.0",
|
|
44
|
-
"typescript": "^5.9.3",
|
|
45
|
-
"vitest": "^4.0.16"
|
|
36
|
+
"@midnight-ntwrk/wallet-sdk-abstractions": "^2.0.0",
|
|
37
|
+
"@midnight-ntwrk/wallet-sdk-hd": "^3.0.1",
|
|
38
|
+
"@midnight-ntwrk/wallet-sdk-utilities": "1.0.1"
|
|
46
39
|
},
|
|
47
40
|
"scripts": {
|
|
48
41
|
"typecheck": "tsc -b ./tsconfig.json --noEmit --force",
|