@midnightntwrk/wallet-sdk-dust-wallet 4.2.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 +106 -0
- package/dist/DustWallet.d.ts +101 -0
- package/dist/DustWallet.js +192 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -0
- package/dist/v1/CoinsAndBalances.d.ts +47 -0
- package/dist/v1/CoinsAndBalances.js +102 -0
- package/dist/v1/CoreWallet.d.ts +31 -0
- package/dist/v1/CoreWallet.js +105 -0
- package/dist/v1/Keys.d.ts +8 -0
- package/dist/v1/Keys.js +11 -0
- package/dist/v1/RunningV1Variant.d.ts +47 -0
- package/dist/v1/RunningV1Variant.js +143 -0
- package/dist/v1/Serialization.d.ts +9 -0
- package/dist/v1/Serialization.js +75 -0
- package/dist/v1/Sync.d.ts +96 -0
- package/dist/v1/Sync.js +218 -0
- package/dist/v1/Transacting.d.ts +97 -0
- package/dist/v1/Transacting.js +327 -0
- package/dist/v1/TransactionHistory.d.ts +69 -0
- package/dist/v1/TransactionHistory.js +106 -0
- package/dist/v1/Utils.d.ts +14 -0
- package/dist/v1/Utils.js +26 -0
- package/dist/v1/V1Builder.d.ts +91 -0
- package/dist/v1/V1Builder.js +166 -0
- package/dist/v1/WalletError.d.ts +43 -0
- package/dist/v1/WalletError.js +23 -0
- package/dist/v1/index.d.ts +12 -0
- package/dist/v1/index.js +24 -0
- package/dist/v1/types/Dust.d.ts +39 -0
- package/dist/v1/types/Dust.js +1 -0
- package/dist/v1/types/index.d.ts +3 -0
- package/dist/v1/types/index.js +15 -0
- package/dist/v1/types/ledger.d.ts +4 -0
- package/dist/v1/types/ledger.js +1 -0
- package/dist/v1/types/transaction.d.ts +4 -0
- package/dist/v1/types/transaction.js +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { TransactionHistoryStorage } from '@midnightntwrk/wallet-sdk-abstractions';
|
|
2
|
+
import type * as ledger from '@midnight-ntwrk/ledger-v8';
|
|
3
|
+
import { Effect, Schema } from 'effect';
|
|
4
|
+
import { TransactionHistoryError } from './WalletError.js';
|
|
5
|
+
export declare const DustUtxoInfoSchema: Schema.Struct<{
|
|
6
|
+
initialValue: typeof Schema.BigInt;
|
|
7
|
+
nonce: typeof Schema.BigInt;
|
|
8
|
+
seq: typeof Schema.Number;
|
|
9
|
+
backingNight: typeof Schema.String;
|
|
10
|
+
mtIndex: typeof Schema.BigInt;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const DustSectionSchema: Schema.Struct<{
|
|
13
|
+
receivedUtxos: Schema.Array$<Schema.Struct<{
|
|
14
|
+
initialValue: typeof Schema.BigInt;
|
|
15
|
+
nonce: typeof Schema.BigInt;
|
|
16
|
+
seq: typeof Schema.Number;
|
|
17
|
+
backingNight: typeof Schema.String;
|
|
18
|
+
mtIndex: typeof Schema.BigInt;
|
|
19
|
+
}>>;
|
|
20
|
+
spentUtxos: Schema.Array$<Schema.Struct<{
|
|
21
|
+
initialValue: typeof Schema.BigInt;
|
|
22
|
+
nonce: typeof Schema.BigInt;
|
|
23
|
+
seq: typeof Schema.Number;
|
|
24
|
+
backingNight: typeof Schema.String;
|
|
25
|
+
mtIndex: typeof Schema.BigInt;
|
|
26
|
+
}>>;
|
|
27
|
+
}>;
|
|
28
|
+
type DustSection = Schema.Schema.Type<typeof DustSectionSchema>;
|
|
29
|
+
export declare const DustTransactionHistoryEntrySchema: Schema.Struct<{
|
|
30
|
+
hash: typeof Schema.String;
|
|
31
|
+
protocolVersion: typeof Schema.Number;
|
|
32
|
+
status: Schema.Literal<["SUCCESS", "FAILURE", "PARTIAL_SUCCESS"]>;
|
|
33
|
+
dust: Schema.Struct<{
|
|
34
|
+
receivedUtxos: Schema.Array$<Schema.Struct<{
|
|
35
|
+
initialValue: typeof Schema.BigInt;
|
|
36
|
+
nonce: typeof Schema.BigInt;
|
|
37
|
+
seq: typeof Schema.Number;
|
|
38
|
+
backingNight: typeof Schema.String;
|
|
39
|
+
mtIndex: typeof Schema.BigInt;
|
|
40
|
+
}>>;
|
|
41
|
+
spentUtxos: Schema.Array$<Schema.Struct<{
|
|
42
|
+
initialValue: typeof Schema.BigInt;
|
|
43
|
+
nonce: typeof Schema.BigInt;
|
|
44
|
+
seq: typeof Schema.Number;
|
|
45
|
+
backingNight: typeof Schema.String;
|
|
46
|
+
mtIndex: typeof Schema.BigInt;
|
|
47
|
+
}>>;
|
|
48
|
+
}>;
|
|
49
|
+
}>;
|
|
50
|
+
export type DustTransactionHistoryEntry = Schema.Schema.Type<typeof DustTransactionHistoryEntrySchema>;
|
|
51
|
+
export type DefaultTransactionHistoryConfiguration = {
|
|
52
|
+
txHistoryStorage: TransactionHistoryStorage.TransactionHistoryStorage<TransactionHistoryStorage.TransactionHistoryEntryWithHash>;
|
|
53
|
+
indexerClientConnection: {
|
|
54
|
+
indexerHttpUrl: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export type TransactionDetails = {
|
|
58
|
+
hash: string;
|
|
59
|
+
timestamp: number;
|
|
60
|
+
status: 'SUCCESS' | 'FAILURE' | 'PARTIAL_SUCCESS';
|
|
61
|
+
};
|
|
62
|
+
export type TransactionHistoryService = {
|
|
63
|
+
put(changes: ledger.DustStateChanges, metadata: TransactionDetails, protocolVersion: number): Effect.Effect<void, TransactionHistoryError>;
|
|
64
|
+
getTransactionDetails(hash: TransactionHistoryStorage.TransactionHash): Effect.Effect<TransactionDetails, TransactionHistoryError>;
|
|
65
|
+
};
|
|
66
|
+
export declare const mergeDustSections: (existing: DustSection, incoming: DustSection) => DustSection;
|
|
67
|
+
export declare const makeDefaultTransactionHistoryService: (config: DefaultTransactionHistoryConfiguration, _getContext: () => unknown) => TransactionHistoryService;
|
|
68
|
+
export declare const makeSimulatorTransactionHistoryService: (config: DefaultTransactionHistoryConfiguration, _getContext: () => unknown) => TransactionHistoryService;
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// This file is part of MIDNIGHT-WALLET-SDK.
|
|
2
|
+
// Copyright (C) Midnight Foundation
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// You may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { TransactionHistoryStorage } from '@midnightntwrk/wallet-sdk-abstractions';
|
|
14
|
+
import { Duration, Array as EArray, Effect, Schedule, Schema } from 'effect';
|
|
15
|
+
import { TransactionHistoryDetail } from '@midnightntwrk/wallet-sdk-indexer-client';
|
|
16
|
+
import { HttpQueryClient } from '@midnightntwrk/wallet-sdk-indexer-client/effect';
|
|
17
|
+
import { TransactionHistoryError } from './WalletError.js';
|
|
18
|
+
export const DustUtxoInfoSchema = Schema.Struct({
|
|
19
|
+
initialValue: Schema.BigInt,
|
|
20
|
+
nonce: Schema.BigInt,
|
|
21
|
+
seq: Schema.Number,
|
|
22
|
+
backingNight: Schema.String,
|
|
23
|
+
mtIndex: Schema.BigInt,
|
|
24
|
+
});
|
|
25
|
+
export const DustSectionSchema = Schema.Struct({
|
|
26
|
+
receivedUtxos: Schema.Array(DustUtxoInfoSchema),
|
|
27
|
+
spentUtxos: Schema.Array(DustUtxoInfoSchema),
|
|
28
|
+
});
|
|
29
|
+
export const DustTransactionHistoryEntrySchema = Schema.Struct({
|
|
30
|
+
hash: TransactionHistoryStorage.TransactionHashSchema,
|
|
31
|
+
protocolVersion: Schema.Number,
|
|
32
|
+
status: TransactionHistoryStorage.TransactionHistoryStatusSchema,
|
|
33
|
+
dust: DustSectionSchema,
|
|
34
|
+
});
|
|
35
|
+
const utxoEquals = Schema.equivalence(DustUtxoInfoSchema);
|
|
36
|
+
export const mergeDustSections = (existing, incoming) => ({
|
|
37
|
+
receivedUtxos: EArray.unionWith(existing.receivedUtxos, incoming.receivedUtxos, utxoEquals),
|
|
38
|
+
spentUtxos: EArray.unionWith(existing.spentUtxos, incoming.spentUtxos, utxoEquals),
|
|
39
|
+
});
|
|
40
|
+
const convertQualifiedDustOutput = (utxo) => ({
|
|
41
|
+
initialValue: utxo.initialValue,
|
|
42
|
+
nonce: utxo.nonce,
|
|
43
|
+
seq: utxo.seq,
|
|
44
|
+
backingNight: utxo.backingNight,
|
|
45
|
+
mtIndex: utxo.mtIndex,
|
|
46
|
+
});
|
|
47
|
+
const convertUpdateToStorageEntry = (changes, metadata, protocolVersion) => ({
|
|
48
|
+
hash: changes.source,
|
|
49
|
+
protocolVersion,
|
|
50
|
+
status: metadata.status,
|
|
51
|
+
dust: {
|
|
52
|
+
receivedUtxos: changes.receivedUtxos.map(convertQualifiedDustOutput),
|
|
53
|
+
spentUtxos: changes.spentUtxos.map(convertQualifiedDustOutput),
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const upsertDustEntry = (txHistoryStorage, entry) => Effect.tryPromise({
|
|
57
|
+
try: () => txHistoryStorage.upsert(entry),
|
|
58
|
+
catch: (e) => new TransactionHistoryError({ message: `Failed to upsert history entry for ${entry.hash}`, cause: e }),
|
|
59
|
+
});
|
|
60
|
+
export const makeDefaultTransactionHistoryService = (config, _getContext) => {
|
|
61
|
+
const txHistoryStorage = config.txHistoryStorage;
|
|
62
|
+
const queryClientLayer = HttpQueryClient.layer({ url: config.indexerClientConnection.indexerHttpUrl });
|
|
63
|
+
return {
|
|
64
|
+
put: (changes, metadata, protocolVersion) => {
|
|
65
|
+
const entry = convertUpdateToStorageEntry(changes, metadata, protocolVersion);
|
|
66
|
+
return upsertDustEntry(txHistoryStorage, entry);
|
|
67
|
+
},
|
|
68
|
+
getTransactionDetails: (hash) => Effect.gen(function* () {
|
|
69
|
+
const statusQuery = yield* TransactionHistoryDetail;
|
|
70
|
+
const result = yield* statusQuery({ transactionHash: hash });
|
|
71
|
+
const tx = result.transactions[0];
|
|
72
|
+
const rawStatus = tx.__typename === 'RegularTransaction' ? tx.transactionResult.status : undefined;
|
|
73
|
+
const status = rawStatus === 'FAILURE' || rawStatus === 'PARTIAL_SUCCESS' ? rawStatus : 'SUCCESS';
|
|
74
|
+
return {
|
|
75
|
+
hash: tx.hash,
|
|
76
|
+
timestamp: tx.block.timestamp,
|
|
77
|
+
status,
|
|
78
|
+
};
|
|
79
|
+
}).pipe(Effect.provide(queryClientLayer), Effect.scoped, Effect.retry(Schedule.exponential(Duration.seconds(1)).pipe(Schedule.compose(Schedule.recurs(3)))), Effect.mapError((cause) => new TransactionHistoryError({
|
|
80
|
+
message: `Failed to fetch transaction metadata for ${hash}`,
|
|
81
|
+
cause,
|
|
82
|
+
}))),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export const makeSimulatorTransactionHistoryService = (config, _getContext) => {
|
|
86
|
+
const txHistoryStorage = config.txHistoryStorage;
|
|
87
|
+
return {
|
|
88
|
+
put: (changes, metadata, protocolVersion) => {
|
|
89
|
+
const entry = convertUpdateToStorageEntry(changes, metadata, protocolVersion);
|
|
90
|
+
return upsertDustEntry(txHistoryStorage, {
|
|
91
|
+
...entry,
|
|
92
|
+
timestamp: new Date(metadata.timestamp),
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
getTransactionDetails: (hash) => Effect.tryPromise({
|
|
96
|
+
try: () => txHistoryStorage.get(hash),
|
|
97
|
+
catch: (e) => new TransactionHistoryError({ message: `Failed to get transaction details for ${hash}`, cause: e }),
|
|
98
|
+
}).pipe(Effect.flatMap((entry) => entry
|
|
99
|
+
? Effect.succeed({
|
|
100
|
+
hash: entry.hash,
|
|
101
|
+
timestamp: entry.timestamp ? entry.timestamp.getTime() : Date.now(),
|
|
102
|
+
status: entry.status,
|
|
103
|
+
})
|
|
104
|
+
: Effect.fail(new TransactionHistoryError({ message: `No transaction found in storage for hash: ${hash}` })))),
|
|
105
|
+
};
|
|
106
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const SignatureMarker: {
|
|
2
|
+
readonly signature: "signature";
|
|
3
|
+
readonly signatureErased: "signature-erased";
|
|
4
|
+
};
|
|
5
|
+
export declare const ProofMarker: {
|
|
6
|
+
readonly proof: "proof";
|
|
7
|
+
readonly preProof: "pre-proof";
|
|
8
|
+
readonly noProof: "no-proof";
|
|
9
|
+
};
|
|
10
|
+
export declare const BindingMarker: {
|
|
11
|
+
readonly binding: "binding";
|
|
12
|
+
readonly preBinding: "pre-binding";
|
|
13
|
+
readonly noBinding: "no-binding";
|
|
14
|
+
};
|
package/dist/v1/Utils.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// This file is part of MIDNIGHT-WALLET-SDK.
|
|
2
|
+
// Copyright (C) Midnight Foundation
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// You may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export const SignatureMarker = {
|
|
14
|
+
signature: 'signature',
|
|
15
|
+
signatureErased: 'signature-erased',
|
|
16
|
+
};
|
|
17
|
+
export const ProofMarker = {
|
|
18
|
+
proof: 'proof',
|
|
19
|
+
preProof: 'pre-proof',
|
|
20
|
+
noProof: 'no-proof',
|
|
21
|
+
};
|
|
22
|
+
export const BindingMarker = {
|
|
23
|
+
binding: 'binding',
|
|
24
|
+
preBinding: 'pre-binding',
|
|
25
|
+
noBinding: 'no-binding',
|
|
26
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type Types, type Either } from 'effect';
|
|
2
|
+
import { type DustSecretKey, type FinalizedTransaction } from '@midnight-ntwrk/ledger-v8';
|
|
3
|
+
import { type VariantBuilder, type Variant } from '@midnightntwrk/wallet-sdk-runtime/abstractions';
|
|
4
|
+
import { type WalletError } from './WalletError.js';
|
|
5
|
+
import { type SyncService, type SyncCapability, type ChangesResult, type DefaultSyncConfiguration, type WalletSyncUpdate } from './Sync.js';
|
|
6
|
+
import { type DefaultTransactionHistoryConfiguration, type TransactionHistoryService } from './TransactionHistory.js';
|
|
7
|
+
import { RunningV1Variant, V1Tag } from './RunningV1Variant.js';
|
|
8
|
+
import { type CoreWallet } from './CoreWallet.js';
|
|
9
|
+
import { type KeysCapability } from './Keys.js';
|
|
10
|
+
import { type CoinsAndBalancesCapability, type CoinSelection, type DefaultCoinsAndBalancesContext } from './CoinsAndBalances.js';
|
|
11
|
+
import { type DefaultTransactingConfiguration, type DefaultTransactingContext, type TransactingCapability } from './Transacting.js';
|
|
12
|
+
import { type NetworkId } from './types/ledger.js';
|
|
13
|
+
import { type SerializationCapability } from './Serialization.js';
|
|
14
|
+
import { type TotalCostParameters } from './types/transaction.js';
|
|
15
|
+
export type BaseV1Configuration = {
|
|
16
|
+
networkId: NetworkId;
|
|
17
|
+
costParameters: TotalCostParameters;
|
|
18
|
+
};
|
|
19
|
+
export type DefaultV1Configuration = BaseV1Configuration & DefaultTransactionHistoryConfiguration;
|
|
20
|
+
declare const V1BuilderSymbol: {
|
|
21
|
+
readonly typeId: unique symbol;
|
|
22
|
+
};
|
|
23
|
+
export type DefaultV1Variant = V1Variant<string, WalletSyncUpdate, FinalizedTransaction, DustSecretKey>;
|
|
24
|
+
export type V1Variant<TSerialized, TSyncUpdate, TTransaction, TAuxData> = Variant.Variant<typeof V1Tag, CoreWallet, CoreWallet, // null,
|
|
25
|
+
RunningV1Variant<TSerialized, TSyncUpdate, TTransaction, TAuxData>> & {
|
|
26
|
+
deserializeState: (serialized: TSerialized) => Either.Either<CoreWallet, WalletError>;
|
|
27
|
+
coinsAndBalances: CoinsAndBalancesCapability<CoreWallet>;
|
|
28
|
+
keys: KeysCapability<CoreWallet>;
|
|
29
|
+
serialization: SerializationCapability<CoreWallet, null, TSerialized>;
|
|
30
|
+
transactionHistory: TransactionHistoryService;
|
|
31
|
+
};
|
|
32
|
+
export type DefaultV1Builder = V1Builder<DefaultV1Configuration, RunningV1Variant.Context<string, WalletSyncUpdate, FinalizedTransaction, DustSecretKey>, string, WalletSyncUpdate, FinalizedTransaction>;
|
|
33
|
+
export declare class V1Builder<TConfig extends BaseV1Configuration = BaseV1Configuration, TContext extends Partial<RunningV1Variant.AnyContext> = object, TSerialized = never, TSyncUpdate = never, TTransaction = never, TStartAux extends object = object> implements VariantBuilder.VariantBuilder<V1Variant<TSerialized, TSyncUpdate, TTransaction, TStartAux>, TConfig> {
|
|
34
|
+
#private;
|
|
35
|
+
constructor(buildState?: V1Builder.PartialBuildState<TConfig, TContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>);
|
|
36
|
+
withDefaults(): DefaultV1Builder;
|
|
37
|
+
withTransactionType<Transaction>(): V1Builder<TConfig, TContext, TSerialized, TSyncUpdate, Transaction, TStartAux>;
|
|
38
|
+
withDefaultTransactionType(): V1Builder<TConfig, TContext, TSerialized, TSyncUpdate, FinalizedTransaction, TStartAux>;
|
|
39
|
+
withSyncDefaults(): V1Builder<TConfig & DefaultSyncConfiguration, TContext, TSerialized, WalletSyncUpdate, TTransaction, DustSecretKey>;
|
|
40
|
+
withSync<TSyncConfig, TSyncContext extends Partial<RunningV1Variant.AnyContext>, TSyncUpdate, TStartAux extends object>(syncService: (configuration: TSyncConfig, getContext: () => TSyncContext) => SyncService<CoreWallet, TStartAux, TSyncUpdate>, syncCapability: (configuration: TSyncConfig, getContext: () => TSyncContext) => SyncCapability<CoreWallet, TSyncUpdate, ChangesResult>): V1Builder<TConfig & TSyncConfig, TContext & TSyncContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
41
|
+
withSerializationDefaults(): V1Builder<TConfig, TContext, string, TSyncUpdate, TTransaction, TStartAux>;
|
|
42
|
+
withSerialization<TSerializationConfig, TSerializationContext extends Partial<RunningV1Variant.AnyContext>, TSerialized>(serializationCapability: (configuration: TSerializationConfig, getContext: () => TSerializationContext) => SerializationCapability<CoreWallet, null, TSerialized>): V1Builder<TConfig & TSerializationConfig, TContext & TSerializationContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
43
|
+
withTransactingDefaults(this: V1Builder<TConfig, TContext, TSerialized, TSyncUpdate, FinalizedTransaction, TStartAux>): V1Builder<TConfig & DefaultTransactingConfiguration, TContext & DefaultTransactingContext, TSerialized, TSyncUpdate, FinalizedTransaction, TStartAux>;
|
|
44
|
+
withTransacting<TTransactingConfig, TTransactingContext extends Partial<RunningV1Variant.AnyContext>>(transactingCapability: (config: TTransactingConfig, getContext: () => TTransactingContext) => TransactingCapability<DustSecretKey, CoreWallet, TTransaction>): V1Builder<TConfig & TTransactingConfig, TContext & TTransactingContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
45
|
+
withCoinSelection<TCoinSelectionConfig, TCoinSelectionContext extends Partial<RunningV1Variant.AnyContext>>(coinSelection: (config: TCoinSelectionConfig, getContext: () => TCoinSelectionContext) => CoinSelection): V1Builder<TConfig & TCoinSelectionConfig, TContext & TCoinSelectionContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
46
|
+
withCoinSelectionDefaults(): V1Builder<TConfig, TContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
47
|
+
withCoinsAndBalancesDefaults(): V1Builder<TConfig, TContext & DefaultCoinsAndBalancesContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
48
|
+
withCoinsAndBalances<TBalancesConfig, TBalancesContext extends Partial<RunningV1Variant.AnyContext>>(coinsAndBalancesCapability: (configuration: TBalancesConfig, getContext: () => TBalancesContext) => CoinsAndBalancesCapability<CoreWallet>): V1Builder<TConfig & TBalancesConfig, TContext & TBalancesContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
49
|
+
withTransactionHistoryDefaults(this: V1Builder<TConfig, TContext, TSerialized, TSyncUpdate, FinalizedTransaction, TStartAux>): V1Builder<TConfig & DefaultTransactionHistoryConfiguration, TContext, TSerialized, TSyncUpdate, FinalizedTransaction, TStartAux>;
|
|
50
|
+
withTransactionHistory<TTransactionHistoryConfig, TTransactionHistoryContext extends Partial<RunningV1Variant.AnyContext>>(transactionHistoryService: (configuration: TTransactionHistoryConfig, getContext: () => TTransactionHistoryContext) => TransactionHistoryService): V1Builder<TConfig & TTransactionHistoryConfig, TContext & TTransactionHistoryContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
51
|
+
withKeysDefaults(): V1Builder<TConfig, TContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
52
|
+
withKeys<TKeysConfig, TKeysContext extends Partial<RunningV1Variant.AnyContext>>(keysCapability: (configuration: TKeysConfig, getContext: () => TKeysContext) => KeysCapability<CoreWallet>): V1Builder<TConfig & TKeysConfig, TContext & TKeysContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
53
|
+
build(this: V1Builder<TConfig, RunningV1Variant.Context<TSerialized, TSyncUpdate, TTransaction, TStartAux>, TSerialized, TSyncUpdate, TTransaction, TStartAux>, configuration: TConfig): V1Variant<TSerialized, TSyncUpdate, TTransaction, TStartAux>;
|
|
54
|
+
}
|
|
55
|
+
/** @internal */
|
|
56
|
+
declare namespace V1Builder {
|
|
57
|
+
type HasSync<TConfig, TContext, TSyncUpdate, TStartAux> = {
|
|
58
|
+
readonly syncService: (configuration: TConfig, getContext: () => TContext) => SyncService<CoreWallet, TStartAux, TSyncUpdate>;
|
|
59
|
+
readonly syncCapability: (configuration: TConfig, getContext: () => TContext) => SyncCapability<CoreWallet, TSyncUpdate, ChangesResult>;
|
|
60
|
+
};
|
|
61
|
+
type HasTransacting<TConfig, TContext, TTransaction> = {
|
|
62
|
+
readonly transactingCapability: (configuration: TConfig, getContext: () => TContext) => TransactingCapability<DustSecretKey, CoreWallet, TTransaction>;
|
|
63
|
+
};
|
|
64
|
+
type HasSerialization<TConfig, TContext, TSerialized> = {
|
|
65
|
+
readonly serializationCapability: (configuration: TConfig, getContext: () => TContext) => SerializationCapability<CoreWallet, null, TSerialized>;
|
|
66
|
+
};
|
|
67
|
+
type HasCoinSelection<TConfig, TContext> = {
|
|
68
|
+
readonly coinSelection: (configuration: TConfig, getContext: () => TContext) => CoinSelection;
|
|
69
|
+
};
|
|
70
|
+
type HasCoinsAndBalances<TConfig, TContext> = {
|
|
71
|
+
readonly coinsAndBalancesCapability: (configuration: TConfig, getContext: () => TContext) => CoinsAndBalancesCapability<CoreWallet>;
|
|
72
|
+
};
|
|
73
|
+
type HasTransactionHistory<TConfig, TContext> = {
|
|
74
|
+
readonly transactionHistoryService: (configuration: TConfig, getContext: () => TContext) => TransactionHistoryService;
|
|
75
|
+
};
|
|
76
|
+
type HasKeys<TConfig, TContext> = {
|
|
77
|
+
readonly keysCapability: (configuration: TConfig, getContext: () => TContext) => KeysCapability<CoreWallet>;
|
|
78
|
+
};
|
|
79
|
+
/** The internal build state of {@link V1Builder}. */
|
|
80
|
+
type FullBuildState<TConfig, TContext, TSerialized, TSyncUpdate, TTransaction, TStartAux> = Types.Simplify<HasSync<TConfig, TContext, TSyncUpdate, TStartAux> & HasSerialization<TConfig, TContext, TSerialized> & HasTransacting<TConfig, TContext, TTransaction> & HasCoinSelection<TConfig, TContext> & HasCoinsAndBalances<TConfig, TContext> & HasKeys<TConfig, TContext> & HasTransactionHistory<TConfig, TContext>>;
|
|
81
|
+
type PartialBuildState<TConfig = object, TContext = object, TSerialized = never, TSyncUpdate = never, TTransaction = never, TStartAux = object> = {
|
|
82
|
+
[K in keyof FullBuildState<never, never, never, never, never, never>]?: FullBuildState<TConfig, TContext, TSerialized, TSyncUpdate, TTransaction, TStartAux>[K] | undefined;
|
|
83
|
+
};
|
|
84
|
+
/** Utility interface that manages the type variance of {@link V1Builder}. */
|
|
85
|
+
interface Variance<R> {
|
|
86
|
+
readonly [V1BuilderSymbol.typeId]: {
|
|
87
|
+
readonly _R: Types.Covariant<R>;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// This file is part of MIDNIGHT-WALLET-SDK.
|
|
2
|
+
// Copyright (C) Midnight Foundation
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// You may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { Effect, Scope } from 'effect';
|
|
14
|
+
import { makeDefaultSyncCapability, makeDefaultSyncService, } from './Sync.js';
|
|
15
|
+
import { makeDefaultTransactionHistoryService, } from './TransactionHistory.js';
|
|
16
|
+
import { RunningV1Variant, V1Tag } from './RunningV1Variant.js';
|
|
17
|
+
import { makeDefaultKeysCapability } from './Keys.js';
|
|
18
|
+
import { chooseCoin, makeDefaultCoinsAndBalancesCapability, } from './CoinsAndBalances.js';
|
|
19
|
+
import { makeDefaultTransactingCapability, } from './Transacting.js';
|
|
20
|
+
import { makeDefaultV1SerializationCapability } from './Serialization.js';
|
|
21
|
+
const V1BuilderSymbol = {
|
|
22
|
+
typeId: Symbol('@midnight-ntwrk/dustWallet#V1Builder'),
|
|
23
|
+
};
|
|
24
|
+
export class V1Builder {
|
|
25
|
+
#buildState;
|
|
26
|
+
constructor(buildState = {}) {
|
|
27
|
+
this.#buildState = buildState;
|
|
28
|
+
}
|
|
29
|
+
withDefaults() {
|
|
30
|
+
return this.withDefaultTransactionType()
|
|
31
|
+
.withSyncDefaults()
|
|
32
|
+
.withSerializationDefaults()
|
|
33
|
+
.withTransactingDefaults()
|
|
34
|
+
.withCoinsAndBalancesDefaults()
|
|
35
|
+
.withTransactionHistoryDefaults()
|
|
36
|
+
.withKeysDefaults()
|
|
37
|
+
.withCoinSelectionDefaults();
|
|
38
|
+
}
|
|
39
|
+
withTransactionType() {
|
|
40
|
+
return new V1Builder({
|
|
41
|
+
...this.#buildState,
|
|
42
|
+
transactingCapability: undefined,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
withDefaultTransactionType() {
|
|
46
|
+
return this.withTransactionType();
|
|
47
|
+
}
|
|
48
|
+
withSyncDefaults() {
|
|
49
|
+
return this.withSync(makeDefaultSyncService, makeDefaultSyncCapability);
|
|
50
|
+
}
|
|
51
|
+
withSync(syncService, syncCapability) {
|
|
52
|
+
return new V1Builder({
|
|
53
|
+
...this.#buildState,
|
|
54
|
+
syncService,
|
|
55
|
+
syncCapability,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
withSerializationDefaults() {
|
|
59
|
+
return this.withSerialization(makeDefaultV1SerializationCapability);
|
|
60
|
+
}
|
|
61
|
+
withSerialization(serializationCapability) {
|
|
62
|
+
return new V1Builder({
|
|
63
|
+
...this.#buildState,
|
|
64
|
+
serializationCapability,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
withTransactingDefaults() {
|
|
68
|
+
return this.withTransacting(makeDefaultTransactingCapability);
|
|
69
|
+
}
|
|
70
|
+
withTransacting(transactingCapability) {
|
|
71
|
+
return new V1Builder({
|
|
72
|
+
...this.#buildState,
|
|
73
|
+
transactingCapability,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
withCoinSelection(coinSelection) {
|
|
77
|
+
return new V1Builder({
|
|
78
|
+
...this.#buildState,
|
|
79
|
+
coinSelection,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
withCoinSelectionDefaults() {
|
|
83
|
+
return this.withCoinSelection(() => chooseCoin);
|
|
84
|
+
}
|
|
85
|
+
withCoinsAndBalancesDefaults() {
|
|
86
|
+
return this.withCoinsAndBalances(makeDefaultCoinsAndBalancesCapability);
|
|
87
|
+
}
|
|
88
|
+
withCoinsAndBalances(coinsAndBalancesCapability) {
|
|
89
|
+
return new V1Builder({
|
|
90
|
+
...this.#buildState,
|
|
91
|
+
coinsAndBalancesCapability,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
withTransactionHistoryDefaults() {
|
|
95
|
+
return this.withTransactionHistory(makeDefaultTransactionHistoryService);
|
|
96
|
+
}
|
|
97
|
+
withTransactionHistory(transactionHistoryService) {
|
|
98
|
+
return new V1Builder({
|
|
99
|
+
...this.#buildState,
|
|
100
|
+
transactionHistoryService,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
withKeysDefaults() {
|
|
104
|
+
return this.withKeys(makeDefaultKeysCapability);
|
|
105
|
+
}
|
|
106
|
+
withKeys(keysCapability) {
|
|
107
|
+
return new V1Builder({
|
|
108
|
+
...this.#buildState,
|
|
109
|
+
keysCapability,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
build(configuration) {
|
|
113
|
+
const v1Context = this.#buildContextFromBuildState(configuration);
|
|
114
|
+
return {
|
|
115
|
+
__polyTag__: V1Tag,
|
|
116
|
+
coinsAndBalances: v1Context.coinsAndBalancesCapability,
|
|
117
|
+
keys: v1Context.keysCapability,
|
|
118
|
+
serialization: v1Context.serializationCapability,
|
|
119
|
+
transactionHistory: v1Context.transactionHistoryService,
|
|
120
|
+
start(context) {
|
|
121
|
+
return Effect.gen(function* () {
|
|
122
|
+
const scope = yield* Scope.Scope;
|
|
123
|
+
return new RunningV1Variant(scope, context, v1Context);
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
migrateState(prevState) {
|
|
127
|
+
// TODO: re-implement
|
|
128
|
+
return Effect.succeed(prevState);
|
|
129
|
+
},
|
|
130
|
+
deserializeState: (serialized) => {
|
|
131
|
+
return v1Context.serializationCapability.deserialize(null, serialized);
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
#buildContextFromBuildState(configuration) {
|
|
136
|
+
if (!isBuildStateFull(this.#buildState)) {
|
|
137
|
+
throw new Error('Not all components are configured in V1 Builder');
|
|
138
|
+
}
|
|
139
|
+
const { syncCapability, syncService, transactingCapability, serializationCapability, coinSelection, coinsAndBalancesCapability, keysCapability, transactionHistoryService, } = this.#buildState;
|
|
140
|
+
const getContext = () => context;
|
|
141
|
+
const context = {
|
|
142
|
+
serializationCapability: serializationCapability(configuration, getContext),
|
|
143
|
+
syncCapability: syncCapability(configuration, getContext),
|
|
144
|
+
syncService: syncService(configuration, getContext),
|
|
145
|
+
transactingCapability: transactingCapability(configuration, getContext),
|
|
146
|
+
coinsAndBalancesCapability: coinsAndBalancesCapability(configuration, getContext),
|
|
147
|
+
keysCapability: keysCapability(configuration, getContext),
|
|
148
|
+
coinSelection: coinSelection(configuration, getContext),
|
|
149
|
+
transactionHistoryService: transactionHistoryService(configuration, getContext),
|
|
150
|
+
};
|
|
151
|
+
return context;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const isBuildStateFull = (buildState) => {
|
|
155
|
+
const allBuildStateKeys = [
|
|
156
|
+
'syncService',
|
|
157
|
+
'syncCapability',
|
|
158
|
+
'transactingCapability',
|
|
159
|
+
'coinSelection',
|
|
160
|
+
'serializationCapability',
|
|
161
|
+
'coinsAndBalancesCapability',
|
|
162
|
+
'keysCapability',
|
|
163
|
+
'transactionHistoryService',
|
|
164
|
+
];
|
|
165
|
+
return allBuildStateKeys.every((key) => typeof buildState[key] == 'function');
|
|
166
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type LedgerOps } from '@midnightntwrk/wallet-sdk-utilities';
|
|
2
|
+
declare const OtherWalletError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
3
|
+
readonly _tag: "Wallet.Other";
|
|
4
|
+
} & Readonly<A>;
|
|
5
|
+
export declare class OtherWalletError extends OtherWalletError_base<{
|
|
6
|
+
message: string;
|
|
7
|
+
cause?: unknown;
|
|
8
|
+
}> {
|
|
9
|
+
}
|
|
10
|
+
declare const SyncWalletError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
11
|
+
readonly _tag: "Wallet.Sync";
|
|
12
|
+
} & Readonly<A>;
|
|
13
|
+
export declare class SyncWalletError extends SyncWalletError_base<{
|
|
14
|
+
message: string;
|
|
15
|
+
cause?: unknown;
|
|
16
|
+
}> {
|
|
17
|
+
}
|
|
18
|
+
declare const TransactingError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
19
|
+
readonly _tag: "Wallet.Transacting";
|
|
20
|
+
} & Readonly<A>;
|
|
21
|
+
export declare class TransactingError extends TransactingError_base<{
|
|
22
|
+
message: string;
|
|
23
|
+
cause?: unknown;
|
|
24
|
+
}> {
|
|
25
|
+
}
|
|
26
|
+
declare const InsufficientFundsError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
27
|
+
readonly _tag: "Wallet.InsufficientFunds";
|
|
28
|
+
} & Readonly<A>;
|
|
29
|
+
export declare class InsufficientFundsError extends InsufficientFundsError_base<{
|
|
30
|
+
message: string;
|
|
31
|
+
tokenType: string;
|
|
32
|
+
}> {
|
|
33
|
+
}
|
|
34
|
+
declare const TransactionHistoryError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
35
|
+
readonly _tag: "Wallet.TransactionHistory";
|
|
36
|
+
} & Readonly<A>;
|
|
37
|
+
export declare class TransactionHistoryError extends TransactionHistoryError_base<{
|
|
38
|
+
message: string;
|
|
39
|
+
cause?: unknown;
|
|
40
|
+
}> {
|
|
41
|
+
}
|
|
42
|
+
export type WalletError = OtherWalletError | SyncWalletError | TransactingError | InsufficientFundsError | TransactionHistoryError | LedgerOps.LedgerError;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// This file is part of MIDNIGHT-WALLET-SDK.
|
|
2
|
+
// Copyright (C) Midnight Foundation
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// You may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { Data } from 'effect';
|
|
14
|
+
export class OtherWalletError extends Data.TaggedError('Wallet.Other') {
|
|
15
|
+
}
|
|
16
|
+
export class SyncWalletError extends Data.TaggedError('Wallet.Sync') {
|
|
17
|
+
}
|
|
18
|
+
export class TransactingError extends Data.TaggedError('Wallet.Transacting') {
|
|
19
|
+
}
|
|
20
|
+
export class InsufficientFundsError extends Data.TaggedError('Wallet.InsufficientFunds') {
|
|
21
|
+
}
|
|
22
|
+
export class TransactionHistoryError extends Data.TaggedError('Wallet.TransactionHistory') {
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './CoreWallet.js';
|
|
2
|
+
export * from '../DustWallet.js';
|
|
3
|
+
export * as Keys from './Keys.js';
|
|
4
|
+
export * as Simulator from '@midnightntwrk/wallet-sdk-capabilities/simulation';
|
|
5
|
+
export * as SyncService from './Sync.js';
|
|
6
|
+
export * as Transacting from './Transacting.js';
|
|
7
|
+
export * from './RunningV1Variant.js';
|
|
8
|
+
export * from './V1Builder.js';
|
|
9
|
+
export * from './types/index.js';
|
|
10
|
+
export * as CoinsAndBalances from './CoinsAndBalances.js';
|
|
11
|
+
export * as TransactionHistory from './TransactionHistory.js';
|
|
12
|
+
export * as WalletError from './WalletError.js';
|
package/dist/v1/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// This file is part of MIDNIGHT-WALLET-SDK.
|
|
2
|
+
// Copyright (C) Midnight Foundation
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// You may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './CoreWallet.js';
|
|
14
|
+
export * from '../DustWallet.js';
|
|
15
|
+
export * as Keys from './Keys.js';
|
|
16
|
+
export * as Simulator from '@midnightntwrk/wallet-sdk-capabilities/simulation';
|
|
17
|
+
export * as SyncService from './Sync.js';
|
|
18
|
+
export * as Transacting from './Transacting.js';
|
|
19
|
+
export * from './RunningV1Variant.js';
|
|
20
|
+
export * from './V1Builder.js';
|
|
21
|
+
export * from './types/index.js';
|
|
22
|
+
export * as CoinsAndBalances from './CoinsAndBalances.js';
|
|
23
|
+
export * as TransactionHistory from './TransactionHistory.js';
|
|
24
|
+
export * as WalletError from './WalletError.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type DustInitialNonce, type DustNullifier, type DustNonce, type DustPublicKey, type Utxo } from '@midnight-ntwrk/ledger-v8';
|
|
2
|
+
export type Dust = {
|
|
3
|
+
initialValue: bigint;
|
|
4
|
+
owner: DustPublicKey;
|
|
5
|
+
nonce: DustNonce;
|
|
6
|
+
seq: number;
|
|
7
|
+
ctime: Date;
|
|
8
|
+
backingNight: DustInitialNonce;
|
|
9
|
+
mtIndex: bigint;
|
|
10
|
+
};
|
|
11
|
+
export type DustWithNullifier = Dust & {
|
|
12
|
+
nullifier: DustNullifier;
|
|
13
|
+
};
|
|
14
|
+
export type DustFullInfo = DustGenerationDetails & {
|
|
15
|
+
token: Dust;
|
|
16
|
+
};
|
|
17
|
+
/** Details of Dust generation/decay */
|
|
18
|
+
export type DustGenerationDetails = {
|
|
19
|
+
/** When the backing Night UTxO was spent */
|
|
20
|
+
dtime: Date | undefined;
|
|
21
|
+
/** Maximum capacity (in Specks) `gen.value * night_dust_ratio` */
|
|
22
|
+
maxCap: bigint;
|
|
23
|
+
/** When the maximum capacity is reached. `ctime + timeToCapSeconds` */
|
|
24
|
+
maxCapReachedAt: Date;
|
|
25
|
+
/** Current amount of Dust available (in Specks) */
|
|
26
|
+
generatedNow: bigint;
|
|
27
|
+
/** The slope of generation and decay for this specific Dust UTxO (`gen.value * generation_decay_rate`) */
|
|
28
|
+
rate: bigint;
|
|
29
|
+
};
|
|
30
|
+
export type DustGenerationInfo = {
|
|
31
|
+
value: bigint;
|
|
32
|
+
owner: DustPublicKey;
|
|
33
|
+
nonce: DustInitialNonce;
|
|
34
|
+
dtime: Date | undefined;
|
|
35
|
+
};
|
|
36
|
+
export type UtxoWithMeta = Utxo & {
|
|
37
|
+
ctime: Date;
|
|
38
|
+
registeredForDustGeneration: boolean;
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// This file is part of MIDNIGHT-WALLET-SDK.
|
|
2
|
+
// Copyright (C) Midnight Foundation
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// You may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './Dust.js';
|
|
14
|
+
export * from './ledger.js';
|
|
15
|
+
export * from './transaction.js';
|