@argonprotocol/localchain 1.2.0 → 1.3.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.
- package/index.d.ts +440 -387
- package/package.json +9 -8
package/index.d.ts
CHANGED
|
@@ -1,373 +1,427 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export class AccountStore {
|
|
4
|
-
getDepositAccount(notaryId?: number | undefined | null): Promise<LocalAccount
|
|
5
|
-
getTaxAccount(notaryId?: number | undefined | null): Promise<LocalAccount
|
|
6
|
-
get(address: string, accountType: AccountType, notaryId: number): Promise<LocalAccount
|
|
7
|
-
getById(id: number): Promise<LocalAccount
|
|
8
|
-
hasAccount(address: string, accountType: AccountType, notaryId: number): Promise<boolean
|
|
4
|
+
getDepositAccount(notaryId?: number | undefined | null): Promise<LocalAccount>;
|
|
5
|
+
getTaxAccount(notaryId?: number | undefined | null): Promise<LocalAccount>;
|
|
6
|
+
get(address: string, accountType: AccountType, notaryId: number): Promise<LocalAccount>;
|
|
7
|
+
getById(id: number): Promise<LocalAccount>;
|
|
8
|
+
hasAccount(address: string, accountType: AccountType, notaryId: number): Promise<boolean>;
|
|
9
9
|
/** Finds an account with no balance that is not waiting for a send claim */
|
|
10
|
-
findIdleJumpAccount(accountType: AccountType, notaryId: number): Promise<LocalAccount | null
|
|
11
|
-
insert(
|
|
12
|
-
|
|
10
|
+
findIdleJumpAccount(accountType: AccountType, notaryId: number): Promise<LocalAccount | null>;
|
|
11
|
+
insert(
|
|
12
|
+
address: string,
|
|
13
|
+
accountType: AccountType,
|
|
14
|
+
notaryId: number,
|
|
15
|
+
hdPath?: string | undefined | null,
|
|
16
|
+
): Promise<LocalAccount>;
|
|
17
|
+
list(includeJumpAccounts?: boolean | undefined | null): Promise<Array<LocalAccount>>;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
export class BalanceChange {
|
|
16
|
-
id: number
|
|
17
|
-
accountId: number
|
|
18
|
-
changeNumber: number
|
|
19
|
-
balance: string
|
|
20
|
-
netBalanceChange: string
|
|
21
|
-
channelHoldNoteJson?: string
|
|
22
|
-
notaryId: number
|
|
23
|
-
notesJson: string
|
|
24
|
-
proofJson?: string
|
|
25
|
-
finalizedBlockNumber?: number
|
|
26
|
-
status: BalanceChangeStatus
|
|
27
|
-
transactionId?: number
|
|
28
|
-
notarizationId?: number
|
|
29
|
-
}
|
|
30
|
-
export type BalanceChangeRow = BalanceChange
|
|
21
|
+
id: number;
|
|
22
|
+
accountId: number;
|
|
23
|
+
changeNumber: number;
|
|
24
|
+
balance: string;
|
|
25
|
+
netBalanceChange: string;
|
|
26
|
+
channelHoldNoteJson?: string;
|
|
27
|
+
notaryId: number;
|
|
28
|
+
notesJson: string;
|
|
29
|
+
proofJson?: string;
|
|
30
|
+
finalizedBlockNumber?: number;
|
|
31
|
+
status: BalanceChangeStatus;
|
|
32
|
+
transactionId?: number;
|
|
33
|
+
notarizationId?: number;
|
|
34
|
+
}
|
|
35
|
+
export type BalanceChangeRow = BalanceChange;
|
|
31
36
|
|
|
32
37
|
export class BalanceChangeBuilder {
|
|
33
|
-
accountType: AccountType
|
|
34
|
-
address: string
|
|
35
|
-
localAccountId: number
|
|
36
|
-
changeNumber: number
|
|
37
|
-
syncStatus?: BalanceChangeStatus
|
|
38
|
-
static newAccount(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
accountType: AccountType;
|
|
39
|
+
address: string;
|
|
40
|
+
localAccountId: number;
|
|
41
|
+
changeNumber: number;
|
|
42
|
+
syncStatus?: BalanceChangeStatus;
|
|
43
|
+
static newAccount(
|
|
44
|
+
address: string,
|
|
45
|
+
localAccountId: number,
|
|
46
|
+
accountType: AccountType,
|
|
47
|
+
): BalanceChangeBuilder;
|
|
48
|
+
isEmptySignature(): Promise<boolean>;
|
|
49
|
+
get balance(): Promise<bigint>;
|
|
50
|
+
get accountId32(): Promise<Uint8Array>;
|
|
51
|
+
isPendingClaim(): Promise<boolean>;
|
|
52
|
+
send(amount: bigint, restrictToAddresses?: Array<string> | undefined | null): Promise<void>;
|
|
53
|
+
claim(amount: bigint): Promise<ClaimResult>;
|
|
54
|
+
claimChannelHold(amount: bigint): Promise<ClaimResult>;
|
|
55
|
+
claimFromMainchain(transfer: LocalchainTransfer): Promise<void>;
|
|
56
|
+
sendToMainchain(amount: bigint): Promise<void>;
|
|
57
|
+
createChannelHold(
|
|
58
|
+
amount: bigint,
|
|
59
|
+
paymentAddress: string,
|
|
60
|
+
domain?: string | undefined | null,
|
|
61
|
+
delegatedSignerAddress?: string | undefined | null,
|
|
62
|
+
): Promise<void>;
|
|
63
|
+
sendToVote(amount: bigint): Promise<void>;
|
|
50
64
|
/** Lease a Domain. Domain leases are converted in full to tax. */
|
|
51
|
-
leaseDomain(): Promise<bigint
|
|
65
|
+
leaseDomain(): Promise<bigint>;
|
|
52
66
|
/** Create scale encoded signature message for the balance change. */
|
|
53
|
-
static toSigningMessage(balanceChangeJson: string): Uint8Array
|
|
67
|
+
static toSigningMessage(balanceChangeJson: string): Uint8Array;
|
|
54
68
|
}
|
|
55
69
|
|
|
56
70
|
export class BalanceChangeStore {
|
|
57
|
-
allForAccount(accountId: number): Promise<Array<BalanceChange
|
|
58
|
-
getLatestForAccount(accountId: number): Promise<BalanceChange | null
|
|
59
|
-
cancel(id: number): Promise<void
|
|
60
|
-
getById(id: number): Promise<BalanceChange
|
|
61
|
-
findUnsettled(): Promise<Array<BalanceChange
|
|
71
|
+
allForAccount(accountId: number): Promise<Array<BalanceChange>>;
|
|
72
|
+
getLatestForAccount(accountId: number): Promise<BalanceChange | null>;
|
|
73
|
+
cancel(id: number): Promise<void>;
|
|
74
|
+
getById(id: number): Promise<BalanceChange>;
|
|
75
|
+
findUnsettled(): Promise<Array<BalanceChange>>;
|
|
62
76
|
}
|
|
63
77
|
|
|
64
78
|
export class BalanceSync {
|
|
65
|
-
constructor(localchain: Localchain)
|
|
66
|
-
sync(options?: VoteCreationOptions | undefined | null): Promise<BalanceSyncResult
|
|
67
|
-
consolidateJumpAccounts(): Promise<Array<NotarizationTracker
|
|
68
|
-
syncUnsettledBalances(): Promise<Array<BalanceChange
|
|
69
|
-
syncMainchainTransfers(): Promise<Array<NotarizationTracker
|
|
70
|
-
convertTaxToVotes(options: VoteCreationOptions): Promise<Array<NotarizationTracker
|
|
71
|
-
syncBalanceChange(balanceChange: BalanceChange): Promise<BalanceChange
|
|
72
|
-
processPendingChannelHolds(): Promise<ChannelHoldResult
|
|
79
|
+
constructor(localchain: Localchain);
|
|
80
|
+
sync(options?: VoteCreationOptions | undefined | null): Promise<BalanceSyncResult>;
|
|
81
|
+
consolidateJumpAccounts(): Promise<Array<NotarizationTracker>>;
|
|
82
|
+
syncUnsettledBalances(): Promise<Array<BalanceChange>>;
|
|
83
|
+
syncMainchainTransfers(): Promise<Array<NotarizationTracker>>;
|
|
84
|
+
convertTaxToVotes(options: VoteCreationOptions): Promise<Array<NotarizationTracker>>;
|
|
85
|
+
syncBalanceChange(balanceChange: BalanceChange): Promise<BalanceChange>;
|
|
86
|
+
processPendingChannelHolds(): Promise<ChannelHoldResult>;
|
|
73
87
|
}
|
|
74
88
|
|
|
75
89
|
export class BalanceSyncResult {
|
|
76
|
-
get balanceChanges(): Array<BalanceChange
|
|
77
|
-
get channelHoldNotarizations(): Array<NotarizationTracker
|
|
78
|
-
get channelHoldsUpdated(): Array<ChannelHold
|
|
79
|
-
get mainchainTransfers(): Array<NotarizationTracker
|
|
80
|
-
get jumpAccountConsolidations(): Array<NotarizationTracker
|
|
81
|
-
get blockVotes(): Array<NotarizationTracker
|
|
90
|
+
get balanceChanges(): Array<BalanceChange>;
|
|
91
|
+
get channelHoldNotarizations(): Array<NotarizationTracker>;
|
|
92
|
+
get channelHoldsUpdated(): Array<ChannelHold>;
|
|
93
|
+
get mainchainTransfers(): Array<NotarizationTracker>;
|
|
94
|
+
get jumpAccountConsolidations(): Array<NotarizationTracker>;
|
|
95
|
+
get blockVotes(): Array<NotarizationTracker>;
|
|
82
96
|
}
|
|
83
97
|
|
|
84
98
|
export class BalanceTipResult {
|
|
85
|
-
balanceTip: Uint8Array
|
|
86
|
-
notebookNumber: number
|
|
87
|
-
tick: number
|
|
99
|
+
balanceTip: Uint8Array;
|
|
100
|
+
notebookNumber: number;
|
|
101
|
+
tick: number;
|
|
88
102
|
}
|
|
89
103
|
|
|
90
104
|
export class ChannelHold {
|
|
91
|
-
id: string
|
|
92
|
-
initialBalanceChangeJson: string
|
|
93
|
-
notaryId: number
|
|
94
|
-
fromAddress: string
|
|
95
|
-
delegatedSignerAddress?: string
|
|
96
|
-
toAddress: string
|
|
97
|
-
domainHash?: Array<number
|
|
98
|
-
expirationTick: number
|
|
99
|
-
balanceChangeNumber: number
|
|
100
|
-
notarizationId?: number
|
|
101
|
-
isClient: boolean
|
|
102
|
-
missedClaimWindow: boolean
|
|
103
|
-
get holdAmount(): bigint
|
|
104
|
-
get settledAmount(): bigint
|
|
105
|
-
get settledSignature(): Uint8Array
|
|
106
|
-
isPastClaimPeriod(currentTick: number): boolean
|
|
105
|
+
id: string;
|
|
106
|
+
initialBalanceChangeJson: string;
|
|
107
|
+
notaryId: number;
|
|
108
|
+
fromAddress: string;
|
|
109
|
+
delegatedSignerAddress?: string;
|
|
110
|
+
toAddress: string;
|
|
111
|
+
domainHash?: Array<number>;
|
|
112
|
+
expirationTick: number;
|
|
113
|
+
balanceChangeNumber: number;
|
|
114
|
+
notarizationId?: number;
|
|
115
|
+
isClient: boolean;
|
|
116
|
+
missedClaimWindow: boolean;
|
|
117
|
+
get holdAmount(): bigint;
|
|
118
|
+
get settledAmount(): bigint;
|
|
119
|
+
get settledSignature(): Uint8Array;
|
|
120
|
+
isPastClaimPeriod(currentTick: number): boolean;
|
|
107
121
|
}
|
|
108
122
|
|
|
109
123
|
export class ChannelHoldResult {
|
|
110
|
-
get channelHoldNotarizations(): Array<NotarizationTracker
|
|
111
|
-
get channelHoldsUpdated(): Array<ChannelHold
|
|
124
|
+
get channelHoldNotarizations(): Array<NotarizationTracker>;
|
|
125
|
+
get channelHoldsUpdated(): Array<ChannelHold>;
|
|
112
126
|
}
|
|
113
127
|
|
|
114
128
|
export class DomainLease {
|
|
115
|
-
id: number
|
|
116
|
-
name: string
|
|
117
|
-
topLevel: string
|
|
118
|
-
registeredToAddress: string
|
|
119
|
-
notarizationId: number
|
|
120
|
-
registeredAtTick: number
|
|
129
|
+
id: number;
|
|
130
|
+
name: string;
|
|
131
|
+
topLevel: string;
|
|
132
|
+
registeredToAddress: string;
|
|
133
|
+
notarizationId: number;
|
|
134
|
+
registeredAtTick: number;
|
|
121
135
|
}
|
|
122
|
-
export type DomainRow = DomainLease
|
|
136
|
+
export type DomainRow = DomainLease;
|
|
123
137
|
|
|
124
138
|
export class DomainStore {
|
|
125
|
-
static tldFromString(topLevel: string): DomainTopLevel
|
|
126
|
-
get list(): Promise<Array<DomainLease
|
|
127
|
-
hashDomain(domain: JsDomain): Uint8Array
|
|
128
|
-
static getHash(domain: string): Uint8Array
|
|
129
|
-
static parse(domain: string): Domain
|
|
130
|
-
get(id: number): Promise<DomainLease
|
|
139
|
+
static tldFromString(topLevel: string): DomainTopLevel;
|
|
140
|
+
get list(): Promise<Array<DomainLease>>;
|
|
141
|
+
hashDomain(domain: JsDomain): Uint8Array;
|
|
142
|
+
static getHash(domain: string): Uint8Array;
|
|
143
|
+
static parse(domain: string): Domain;
|
|
144
|
+
get(id: number): Promise<DomainLease>;
|
|
131
145
|
}
|
|
132
146
|
|
|
133
147
|
export class Keystore {
|
|
134
|
-
useExternal(
|
|
148
|
+
useExternal(
|
|
149
|
+
defaultAddress: string,
|
|
150
|
+
sign: (address: string, signatureMessage: Uint8Array) => Promise<Uint8Array>,
|
|
151
|
+
derive: (hdPath: string) => Promise<string>,
|
|
152
|
+
): Promise<void>;
|
|
135
153
|
/** Bootstrap this localchain with a new key. Must be empty or will throw an error! Defaults to SR25519 if no scheme is provided. */
|
|
136
|
-
bootstrap(
|
|
154
|
+
bootstrap(
|
|
155
|
+
scheme?: CryptoScheme | undefined | null,
|
|
156
|
+
passwordOption?: KeystorePasswordOption | undefined | null,
|
|
157
|
+
): Promise<string>;
|
|
137
158
|
/** Import a known keypair into the embedded keystore. */
|
|
138
|
-
importSuri(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
159
|
+
importSuri(
|
|
160
|
+
suri: string,
|
|
161
|
+
scheme: CryptoScheme,
|
|
162
|
+
passwordOption?: KeystorePasswordOption | undefined | null,
|
|
163
|
+
): Promise<string>;
|
|
164
|
+
unlock(passwordOption?: KeystorePasswordOption | undefined | null): Promise<void>;
|
|
165
|
+
lock(): Promise<void>;
|
|
166
|
+
isUnlocked(): Promise<boolean>;
|
|
167
|
+
deriveAccountId(hdPath: string): Promise<string>;
|
|
168
|
+
sign(address: string, message: Uint8Array): Promise<Uint8Array>;
|
|
144
169
|
}
|
|
145
170
|
|
|
146
171
|
export class LocalAccount {
|
|
147
|
-
id: number
|
|
148
|
-
address: string
|
|
149
|
-
hdPath?: string
|
|
150
|
-
accountId32: string
|
|
151
|
-
notaryId: number
|
|
152
|
-
accountType: AccountType
|
|
153
|
-
createdAt: number
|
|
154
|
-
updatedAt: number
|
|
155
|
-
origin?: NotaryAccountOrigin
|
|
172
|
+
id: number;
|
|
173
|
+
address: string;
|
|
174
|
+
hdPath?: string;
|
|
175
|
+
accountId32: string;
|
|
176
|
+
notaryId: number;
|
|
177
|
+
accountType: AccountType;
|
|
178
|
+
createdAt: number;
|
|
179
|
+
updatedAt: number;
|
|
180
|
+
origin?: NotaryAccountOrigin;
|
|
156
181
|
}
|
|
157
182
|
|
|
158
183
|
export class Localchain {
|
|
159
|
-
path: string
|
|
160
|
-
static load(config: LocalchainConfig): Promise<Localchain
|
|
161
|
-
static loadWithoutMainchain(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
get
|
|
174
|
-
get
|
|
175
|
-
get
|
|
176
|
-
|
|
177
|
-
get
|
|
178
|
-
get
|
|
179
|
-
get
|
|
180
|
-
get
|
|
181
|
-
get
|
|
182
|
-
get
|
|
183
|
-
get
|
|
184
|
-
|
|
184
|
+
path: string;
|
|
185
|
+
static load(config: LocalchainConfig): Promise<Localchain>;
|
|
186
|
+
static loadWithoutMainchain(
|
|
187
|
+
path: string,
|
|
188
|
+
tickerConfig: TickerConfig,
|
|
189
|
+
keystorePassword?: KeystorePasswordOption | undefined | null,
|
|
190
|
+
): Promise<Localchain>;
|
|
191
|
+
attachMainchain(mainchainClient: MainchainClient): Promise<void>;
|
|
192
|
+
updateTicker(ntpSyncPoolUrl?: string | undefined | null): Promise<void>;
|
|
193
|
+
close(): Promise<void>;
|
|
194
|
+
accountOverview(): Promise<LocalchainOverview>;
|
|
195
|
+
static getDefaultDir(): string;
|
|
196
|
+
static setDefaultDir(value: string): void;
|
|
197
|
+
static getDefaultPath(): string;
|
|
198
|
+
get address(): Promise<string>;
|
|
199
|
+
get name(): string;
|
|
200
|
+
get currentTick(): number;
|
|
201
|
+
durationToNextTick(): bigint;
|
|
202
|
+
get ticker(): TickerRef;
|
|
203
|
+
get keystore(): Keystore;
|
|
204
|
+
get mainchainClient(): Promise<MainchainClient | null>;
|
|
205
|
+
get mainchainTransfers(): MainchainTransferStore;
|
|
206
|
+
get notaryClients(): NotaryClients;
|
|
207
|
+
get accounts(): AccountStore;
|
|
208
|
+
get balanceChanges(): BalanceChangeStore;
|
|
209
|
+
get domains(): DomainStore;
|
|
210
|
+
get openChannelHolds(): OpenChannelHoldsStore;
|
|
211
|
+
get balanceSync(): BalanceSync;
|
|
212
|
+
get transactions(): Transactions;
|
|
213
|
+
beginChange(): NotarizationBuilder;
|
|
185
214
|
}
|
|
186
215
|
|
|
187
216
|
export class MainchainClient {
|
|
188
|
-
host: string
|
|
189
|
-
close(): Promise<void
|
|
190
|
-
static connect(host: string, timeoutMillis: number): Promise<MainchainClient
|
|
191
|
-
getTicker(): Promise<Ticker
|
|
192
|
-
getChainIdentity(): Promise<ChainIdentity
|
|
193
|
-
getBestBlockHash(): Promise<Uint8Array
|
|
194
|
-
getVoteBlockHash(currentTick: number): Promise<BestBlockForVote | null
|
|
195
|
-
getDomainRegistration(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
217
|
+
host: string;
|
|
218
|
+
close(): Promise<void>;
|
|
219
|
+
static connect(host: string, timeoutMillis: number): Promise<MainchainClient>;
|
|
220
|
+
getTicker(): Promise<Ticker>;
|
|
221
|
+
getChainIdentity(): Promise<ChainIdentity>;
|
|
222
|
+
getBestBlockHash(): Promise<Uint8Array>;
|
|
223
|
+
getVoteBlockHash(currentTick: number): Promise<BestBlockForVote | null>;
|
|
224
|
+
getDomainRegistration(
|
|
225
|
+
domainName: string,
|
|
226
|
+
topLevel: DomainTopLevel,
|
|
227
|
+
): Promise<DomainRegistration | null>;
|
|
228
|
+
getDomainZoneRecord(domainName: string, topLevel: DomainTopLevel): Promise<ZoneRecord | null>;
|
|
229
|
+
getNotaryDetails(notaryId: number): Promise<NotaryDetails | null>;
|
|
230
|
+
getAccount(address: string): Promise<AccountInfo>;
|
|
231
|
+
getOwnership(address: string): Promise<BalancesAccountData>;
|
|
232
|
+
getTransferToLocalchainFinalizedBlock(transferId: number): Promise<number | null>;
|
|
233
|
+
waitForLocalchainTransfer(transferId: number): Promise<LocalchainTransfer | null>;
|
|
234
|
+
getAccountChangesRoot(notaryId: number, notebookNumber: number): Promise<Uint8Array | null>;
|
|
235
|
+
latestFinalizedNumber(): Promise<number>;
|
|
236
|
+
waitForNotebookImmortalized(notaryId: number, notebookNumber: number): Promise<number>;
|
|
205
237
|
}
|
|
206
238
|
|
|
207
239
|
export class MainchainTransferStore {
|
|
208
|
-
sendToLocalchain(
|
|
240
|
+
sendToLocalchain(
|
|
241
|
+
amount: bigint,
|
|
242
|
+
notaryId?: number | undefined | null,
|
|
243
|
+
): Promise<LocalchainTransfer>;
|
|
209
244
|
}
|
|
210
245
|
|
|
211
246
|
export class NotarizationBuilder {
|
|
212
|
-
set notaryId(notaryId: number)
|
|
213
|
-
get notaryId(): Promise<number
|
|
214
|
-
set transaction(transaction: LocalchainTransaction)
|
|
215
|
-
get transaction(): Promise<LocalchainTransaction | null
|
|
216
|
-
get isFinalized(): Promise<boolean
|
|
217
|
-
get unclaimedTax(): Promise<bigint
|
|
218
|
-
get channelHolds(): Promise<Array<ChannelHold
|
|
219
|
-
get accounts(): Promise<Array<LocalAccount
|
|
220
|
-
get balanceChangeBuilders(): Promise<Array<BalanceChangeBuilder
|
|
221
|
-
get unusedVoteFunds(): Promise<bigint
|
|
222
|
-
get unusedDomainFunds(): Promise<bigint
|
|
223
|
-
get unclaimedDeposits(): Promise<bigint
|
|
224
|
-
getBalanceChange(account: LocalAccount): Promise<BalanceChangeBuilder
|
|
225
|
-
addAccount(
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
247
|
+
set notaryId(notaryId: number);
|
|
248
|
+
get notaryId(): Promise<number>;
|
|
249
|
+
set transaction(transaction: LocalchainTransaction);
|
|
250
|
+
get transaction(): Promise<LocalchainTransaction | null>;
|
|
251
|
+
get isFinalized(): Promise<boolean>;
|
|
252
|
+
get unclaimedTax(): Promise<bigint>;
|
|
253
|
+
get channelHolds(): Promise<Array<ChannelHold>>;
|
|
254
|
+
get accounts(): Promise<Array<LocalAccount>>;
|
|
255
|
+
get balanceChangeBuilders(): Promise<Array<BalanceChangeBuilder>>;
|
|
256
|
+
get unusedVoteFunds(): Promise<bigint>;
|
|
257
|
+
get unusedDomainFunds(): Promise<bigint>;
|
|
258
|
+
get unclaimedDeposits(): Promise<bigint>;
|
|
259
|
+
getBalanceChange(account: LocalAccount): Promise<BalanceChangeBuilder>;
|
|
260
|
+
addAccount(
|
|
261
|
+
address: string,
|
|
262
|
+
accountType: AccountType,
|
|
263
|
+
notaryId: number,
|
|
264
|
+
): Promise<BalanceChangeBuilder>;
|
|
265
|
+
addAccountById(localAccountId: number): Promise<BalanceChangeBuilder>;
|
|
266
|
+
getJumpAccount(accountType: AccountType): Promise<BalanceChangeBuilder>;
|
|
267
|
+
defaultDepositAccount(): Promise<BalanceChangeBuilder>;
|
|
268
|
+
defaultTaxAccount(): Promise<BalanceChangeBuilder>;
|
|
269
|
+
loadAccount(account: LocalAccount): Promise<BalanceChangeBuilder>;
|
|
270
|
+
canAddChannelHold(channelHold: OpenChannelHold): Promise<boolean>;
|
|
271
|
+
cancelChannelHold(openChannelHold: OpenChannelHold): Promise<void>;
|
|
272
|
+
claimChannelHold(openChannelHold: OpenChannelHold): Promise<void>;
|
|
273
|
+
addVote(vote: BlockVote): Promise<void>;
|
|
274
|
+
leaseDomain(domain: string, registerToAddress: string): Promise<void>;
|
|
236
275
|
/** Calculates the transfer tax on the given amount */
|
|
237
|
-
getTransferTaxAmount(amount: bigint): bigint
|
|
276
|
+
getTransferTaxAmount(amount: bigint): bigint;
|
|
238
277
|
/** Calculates the total needed to end up with the given balance */
|
|
239
|
-
getTotalForAfterTaxBalance(finalBalance: bigint): bigint
|
|
240
|
-
getChannelHoldTaxAmount(amount: bigint): bigint
|
|
241
|
-
claimFromMainchain(transfer: LocalchainTransfer): Promise<BalanceChangeBuilder
|
|
242
|
-
claimAndPayTax(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
278
|
+
getTotalForAfterTaxBalance(finalBalance: bigint): bigint;
|
|
279
|
+
getChannelHoldTaxAmount(amount: bigint): bigint;
|
|
280
|
+
claimFromMainchain(transfer: LocalchainTransfer): Promise<BalanceChangeBuilder>;
|
|
281
|
+
claimAndPayTax(
|
|
282
|
+
microgonsPlusTax: bigint,
|
|
283
|
+
depositAccountId: number | undefined | null,
|
|
284
|
+
useDefaultTaxAccount: boolean,
|
|
285
|
+
): Promise<BalanceChangeBuilder>;
|
|
286
|
+
fundJumpAccount(microgons: bigint): Promise<BalanceChangeBuilder>;
|
|
287
|
+
acceptArgonFileRequest(argonFileJson: string): Promise<void>;
|
|
288
|
+
importArgonFile(argonFileJson: string): Promise<void>;
|
|
246
289
|
/**
|
|
247
290
|
* Exports an argon file from this notarization builder with the intention that these will be sent to another
|
|
248
291
|
* user (who will import into their own localchain).
|
|
249
292
|
*/
|
|
250
|
-
exportAsFile(fileType: ArgonFileType): Promise<string
|
|
251
|
-
toJSON(): Promise<string
|
|
252
|
-
notarizeAndWaitForNotebook(): Promise<NotarizationTracker
|
|
253
|
-
notarize(): Promise<NotarizationTracker
|
|
254
|
-
verify(): Promise<void
|
|
255
|
-
sign(): Promise<void
|
|
293
|
+
exportAsFile(fileType: ArgonFileType): Promise<string>;
|
|
294
|
+
toJSON(): Promise<string>;
|
|
295
|
+
notarizeAndWaitForNotebook(): Promise<NotarizationTracker>;
|
|
296
|
+
notarize(): Promise<NotarizationTracker>;
|
|
297
|
+
verify(): Promise<void>;
|
|
298
|
+
sign(): Promise<void>;
|
|
256
299
|
}
|
|
257
300
|
|
|
258
301
|
export class NotarizationTracker {
|
|
259
|
-
notebookNumber: number
|
|
260
|
-
tick: number
|
|
261
|
-
notaryId: number
|
|
262
|
-
notarizationId: number
|
|
263
|
-
notarizedBalanceChanges: number
|
|
264
|
-
notarizedVotes: number
|
|
302
|
+
notebookNumber: number;
|
|
303
|
+
tick: number;
|
|
304
|
+
notaryId: number;
|
|
305
|
+
notarizationId: number;
|
|
306
|
+
notarizedBalanceChanges: number;
|
|
307
|
+
notarizedVotes: number;
|
|
265
308
|
/** Returns the balance changes that were submitted to the notary indexed by the stringified account id (napi doesn't allow numbers as keys) */
|
|
266
|
-
get balanceChangesByAccountId(): Promise<Record<string, BalanceChange
|
|
267
|
-
waitForNotebook(): Promise<void
|
|
268
|
-
get channelHolds(): Promise<Array<ChannelHold
|
|
309
|
+
get balanceChangesByAccountId(): Promise<Record<string, BalanceChange>>;
|
|
310
|
+
waitForNotebook(): Promise<void>;
|
|
311
|
+
get channelHolds(): Promise<Array<ChannelHold>>;
|
|
269
312
|
/** Asks the notary for proof the transaction was included in a notebook header. If this notebook has not been finalized yet, it will return an error. */
|
|
270
|
-
getNotebookProof(): Promise<Array<NotebookProof
|
|
313
|
+
getNotebookProof(): Promise<Array<NotebookProof>>;
|
|
271
314
|
/** Confirms the root added to the mainchain */
|
|
272
|
-
waitForImmortalized(mainchainClient: MainchainClient): Promise<ImmortalizedBlock
|
|
315
|
+
waitForImmortalized(mainchainClient: MainchainClient): Promise<ImmortalizedBlock>;
|
|
273
316
|
}
|
|
274
317
|
|
|
275
318
|
export class NotaryClient {
|
|
276
|
-
notaryId: number
|
|
277
|
-
autoVerifyHeaderSignatures: boolean
|
|
278
|
-
isConnected(): Promise<boolean
|
|
279
|
-
static connect(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
319
|
+
notaryId: number;
|
|
320
|
+
autoVerifyHeaderSignatures: boolean;
|
|
321
|
+
isConnected(): Promise<boolean>;
|
|
322
|
+
static connect(
|
|
323
|
+
notaryId: number,
|
|
324
|
+
publicKey: Uint8Array,
|
|
325
|
+
host: string,
|
|
326
|
+
autoVerifyHeaderSignatures: boolean,
|
|
327
|
+
): Promise<NotaryClient>;
|
|
328
|
+
getBalanceTip(address: string, accountType: AccountType): Promise<BalanceTipResult>;
|
|
329
|
+
subscribeHeaders(callback: (arg0: NotebookNumber, arg1: Tick) => any): Promise<Subscription>;
|
|
330
|
+
get metadata(): Promise<NotebookMeta>;
|
|
283
331
|
}
|
|
284
332
|
|
|
285
333
|
export class NotaryClients {
|
|
286
|
-
static new(mainchainClient: MainchainClient): NotaryClients
|
|
287
|
-
close(): Promise<void
|
|
288
|
-
useClient(client: NotaryClient): Promise<void
|
|
289
|
-
get(notaryId: number): Promise<NotaryClient
|
|
334
|
+
static new(mainchainClient: MainchainClient): NotaryClients;
|
|
335
|
+
close(): Promise<void>;
|
|
336
|
+
useClient(client: NotaryClient): Promise<void>;
|
|
337
|
+
get(notaryId: number): Promise<NotaryClient>;
|
|
290
338
|
}
|
|
291
339
|
|
|
292
340
|
export class OpenChannelHold {
|
|
293
|
-
get channelHold(): Promise<ChannelHold
|
|
294
|
-
sign(settledAmount: bigint): Promise<SignatureResult
|
|
295
|
-
exportForSend(): Promise<string
|
|
296
|
-
recordUpdatedSettlement(microgons: bigint, signature: Uint8Array): Promise<void
|
|
341
|
+
get channelHold(): Promise<ChannelHold>;
|
|
342
|
+
sign(settledAmount: bigint): Promise<SignatureResult>;
|
|
343
|
+
exportForSend(): Promise<string>;
|
|
344
|
+
recordUpdatedSettlement(microgons: bigint, signature: Uint8Array): Promise<void>;
|
|
297
345
|
}
|
|
298
346
|
|
|
299
347
|
export class OpenChannelHoldsStore {
|
|
300
|
-
get(id: string): Promise<OpenChannelHold
|
|
301
|
-
open(channelHold: ChannelHold): OpenChannelHold
|
|
302
|
-
getClaimable(): Promise<Array<OpenChannelHold
|
|
348
|
+
get(id: string): Promise<OpenChannelHold>;
|
|
349
|
+
open(channelHold: ChannelHold): OpenChannelHold;
|
|
350
|
+
getClaimable(): Promise<Array<OpenChannelHold>>;
|
|
303
351
|
/** Import a channel_hold from a JSON string. Verifies with the notary that the channel hold is valid. */
|
|
304
|
-
importChannelHold(channelHoldJson: string): Promise<OpenChannelHold
|
|
352
|
+
importChannelHold(channelHoldJson: string): Promise<OpenChannelHold>;
|
|
305
353
|
/** Create a new channel_hold as a client. You must first notarize a channel hold note to the notary for the `client_address`. */
|
|
306
|
-
openClientChannelHold(accountId: number): Promise<OpenChannelHold
|
|
354
|
+
openClientChannelHold(accountId: number): Promise<OpenChannelHold>;
|
|
307
355
|
}
|
|
308
356
|
|
|
309
357
|
export class OverviewStore {
|
|
310
|
-
get(): Promise<LocalchainOverview
|
|
358
|
+
get(): Promise<LocalchainOverview>;
|
|
311
359
|
}
|
|
312
360
|
|
|
313
361
|
export class Subscription {
|
|
314
362
|
/** Cancels the subscription. */
|
|
315
|
-
cancel(): Promise<void
|
|
363
|
+
cancel(): Promise<void>;
|
|
316
364
|
}
|
|
317
365
|
|
|
318
366
|
export class TickerRef {
|
|
319
|
-
get current(): number
|
|
320
|
-
tickForTime(timestampMillis: number): bigint
|
|
321
|
-
timeForTick(tick: number): number
|
|
322
|
-
millisToNextTick(): number
|
|
323
|
-
get channelHoldExpirationTicks(): number
|
|
367
|
+
get current(): number;
|
|
368
|
+
tickForTime(timestampMillis: number): bigint;
|
|
369
|
+
timeForTick(tick: number): number;
|
|
370
|
+
millisToNextTick(): number;
|
|
371
|
+
get channelHoldExpirationTicks(): number;
|
|
324
372
|
}
|
|
325
373
|
|
|
326
374
|
export class Transactions {
|
|
327
|
-
create(transactionType: TransactionType): Promise<LocalchainTransaction
|
|
328
|
-
request(microgons: bigint): Promise<string
|
|
329
|
-
createChannelHold(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
375
|
+
create(transactionType: TransactionType): Promise<LocalchainTransaction>;
|
|
376
|
+
request(microgons: bigint): Promise<string>;
|
|
377
|
+
createChannelHold(
|
|
378
|
+
channelHoldMicrogons: bigint,
|
|
379
|
+
recipientAddress: string,
|
|
380
|
+
domain?: string | undefined | null,
|
|
381
|
+
notaryId?: number | undefined | null,
|
|
382
|
+
delegatedSignerAddress?: string | undefined | null,
|
|
383
|
+
): Promise<OpenChannelHold>;
|
|
384
|
+
send(microgons: bigint, to?: Array<string> | undefined | null): Promise<string>;
|
|
385
|
+
importArgons(argonFile: string): Promise<NotarizationTracker>;
|
|
386
|
+
acceptArgonRequest(argonFile: string): Promise<NotarizationTracker>;
|
|
333
387
|
}
|
|
334
388
|
|
|
335
389
|
export interface AccountInfo {
|
|
336
|
-
nonce: number
|
|
337
|
-
consumers: number
|
|
338
|
-
providers: number
|
|
339
|
-
sufficients: number
|
|
340
|
-
data: BalancesAccountData
|
|
390
|
+
nonce: number;
|
|
391
|
+
consumers: number;
|
|
392
|
+
providers: number;
|
|
393
|
+
sufficients: number;
|
|
394
|
+
data: BalancesAccountData;
|
|
341
395
|
}
|
|
342
396
|
|
|
343
397
|
export enum AccountType {
|
|
344
398
|
Tax = 'tax',
|
|
345
|
-
Deposit = 'deposit'
|
|
399
|
+
Deposit = 'deposit',
|
|
346
400
|
}
|
|
347
401
|
|
|
348
|
-
export const ADDRESS_PREFIX: number
|
|
402
|
+
export const ADDRESS_PREFIX: number;
|
|
349
403
|
|
|
350
404
|
/** The version of the Argon file format. */
|
|
351
|
-
export const ARGON_FILE_VERSION: string
|
|
405
|
+
export const ARGON_FILE_VERSION: string;
|
|
352
406
|
|
|
353
407
|
export enum ArgonFileType {
|
|
354
408
|
Send = 0,
|
|
355
|
-
Request = 1
|
|
409
|
+
Request = 1,
|
|
356
410
|
}
|
|
357
411
|
|
|
358
412
|
export interface BalanceChangeGroup {
|
|
359
|
-
netBalanceChange: bigint
|
|
360
|
-
netTax: bigint
|
|
361
|
-
heldBalance: bigint
|
|
362
|
-
timestamp: number
|
|
363
|
-
notes: Array<string
|
|
364
|
-
finalizedBlockNumber?: number
|
|
365
|
-
status: BalanceChangeStatus
|
|
366
|
-
notarizationId?: number
|
|
367
|
-
transactionId?: number
|
|
368
|
-
transactionType?: TransactionType
|
|
369
|
-
balanceChanges: Array<BalanceChangeSummary
|
|
370
|
-
notebookNumber?: number
|
|
413
|
+
netBalanceChange: bigint;
|
|
414
|
+
netTax: bigint;
|
|
415
|
+
heldBalance: bigint;
|
|
416
|
+
timestamp: number;
|
|
417
|
+
notes: Array<string>;
|
|
418
|
+
finalizedBlockNumber?: number;
|
|
419
|
+
status: BalanceChangeStatus;
|
|
420
|
+
notarizationId?: number;
|
|
421
|
+
transactionId?: number;
|
|
422
|
+
transactionType?: TransactionType;
|
|
423
|
+
balanceChanges: Array<BalanceChangeSummary>;
|
|
424
|
+
notebookNumber?: number;
|
|
371
425
|
}
|
|
372
426
|
|
|
373
427
|
export enum BalanceChangeStatus {
|
|
@@ -382,125 +436,125 @@ export enum BalanceChangeStatus {
|
|
|
382
436
|
/** A balance change has been sent to another user to claim. Keep checking until it is claimed. */
|
|
383
437
|
WaitingForSendClaim = 'WaitingForSendClaim',
|
|
384
438
|
/** A pending balance change that was canceled before being claimed by another user (channel_hold or send). */
|
|
385
|
-
Canceled = 'Canceled'
|
|
439
|
+
Canceled = 'Canceled',
|
|
386
440
|
}
|
|
387
441
|
|
|
388
442
|
export interface BalanceChangeSummary {
|
|
389
|
-
id: number
|
|
390
|
-
finalBalance: bigint
|
|
391
|
-
holdBalance: bigint
|
|
392
|
-
netBalanceChange: bigint
|
|
393
|
-
changeNumber: number
|
|
394
|
-
accountId: number
|
|
395
|
-
accountType: AccountType
|
|
396
|
-
isJumpAccount: boolean
|
|
397
|
-
notes: Array<string
|
|
398
|
-
status: BalanceChangeStatus
|
|
399
|
-
notebookNumber?: number
|
|
400
|
-
finalizedBlockNumber?: number
|
|
443
|
+
id: number;
|
|
444
|
+
finalBalance: bigint;
|
|
445
|
+
holdBalance: bigint;
|
|
446
|
+
netBalanceChange: bigint;
|
|
447
|
+
changeNumber: number;
|
|
448
|
+
accountId: number;
|
|
449
|
+
accountType: AccountType;
|
|
450
|
+
isJumpAccount: boolean;
|
|
451
|
+
notes: Array<string>;
|
|
452
|
+
status: BalanceChangeStatus;
|
|
453
|
+
notebookNumber?: number;
|
|
454
|
+
finalizedBlockNumber?: number;
|
|
401
455
|
}
|
|
402
456
|
|
|
403
457
|
export interface BalancesAccountData {
|
|
404
|
-
free: bigint
|
|
405
|
-
reserved: bigint
|
|
406
|
-
frozen: bigint
|
|
407
|
-
flags: bigint
|
|
458
|
+
free: bigint;
|
|
459
|
+
reserved: bigint;
|
|
460
|
+
frozen: bigint;
|
|
461
|
+
flags: bigint;
|
|
408
462
|
}
|
|
409
463
|
|
|
410
464
|
export interface BestBlockForVote {
|
|
411
|
-
blockHash: Uint8Array
|
|
412
|
-
voteMinimum: bigint
|
|
465
|
+
blockHash: Uint8Array;
|
|
466
|
+
voteMinimum: bigint;
|
|
413
467
|
}
|
|
414
468
|
|
|
415
469
|
export interface BlockVote {
|
|
416
470
|
/** The creator of the seal */
|
|
417
|
-
address: string
|
|
471
|
+
address: string;
|
|
418
472
|
/** The block hash being voted on. Must be in last 2 ticks. */
|
|
419
|
-
blockHash: Array<number
|
|
473
|
+
blockHash: Array<number>;
|
|
420
474
|
/** A unique index per account for this notebook */
|
|
421
|
-
index: number
|
|
475
|
+
index: number;
|
|
422
476
|
/** The voting power of this vote, determined from the amount of tax */
|
|
423
|
-
power: bigint
|
|
477
|
+
power: bigint;
|
|
424
478
|
/** The tick where a vote was intended */
|
|
425
|
-
tick: number
|
|
479
|
+
tick: number;
|
|
426
480
|
/** The domain used to create this vote */
|
|
427
|
-
domainHash: Array<number
|
|
481
|
+
domainHash: Array<number>;
|
|
428
482
|
/** The domain payment address used to create this vote */
|
|
429
|
-
domainAddress: string
|
|
483
|
+
domainAddress: string;
|
|
430
484
|
/** The mainchain address where rewards will be sent */
|
|
431
|
-
blockRewardsAddress: string
|
|
485
|
+
blockRewardsAddress: string;
|
|
432
486
|
/** A signature of the vote by the account_id */
|
|
433
|
-
signature: Array<number
|
|
487
|
+
signature: Array<number>;
|
|
434
488
|
}
|
|
435
489
|
|
|
436
490
|
export enum Chain {
|
|
437
491
|
Mainnet = 'mainnet',
|
|
438
492
|
Testnet = 'testnet',
|
|
439
493
|
LocalTestnet = 'local-testnet',
|
|
440
|
-
Devnet = 'devnet'
|
|
494
|
+
Devnet = 'devnet',
|
|
441
495
|
}
|
|
442
496
|
|
|
443
497
|
export interface ChainIdentity {
|
|
444
|
-
chain: Chain
|
|
445
|
-
genesis: Buffer
|
|
498
|
+
chain: Chain;
|
|
499
|
+
genesis: Buffer;
|
|
446
500
|
}
|
|
447
501
|
|
|
448
502
|
export interface ChainIdentity {
|
|
449
|
-
chain: Chain
|
|
450
|
-
genesisHash: string
|
|
503
|
+
chain: Chain;
|
|
504
|
+
genesisHash: string;
|
|
451
505
|
}
|
|
452
506
|
|
|
453
507
|
/** Number of ticks past the expiration of a channel_hold that a recipient has to claim. After this point, sender can recoup the channel_holded funds */
|
|
454
|
-
export const CHANNEL_HOLD_CLAWBACK_TICKS: number
|
|
508
|
+
export const CHANNEL_HOLD_CLAWBACK_TICKS: number;
|
|
455
509
|
|
|
456
510
|
/** Minimum amount that can be settled in a channel_hold */
|
|
457
|
-
export const CHANNEL_HOLD_MINIMUM_SETTLEMENT: bigint
|
|
511
|
+
export const CHANNEL_HOLD_MINIMUM_SETTLEMENT: bigint;
|
|
458
512
|
|
|
459
513
|
export interface ChannelHold {
|
|
460
|
-
id: string
|
|
461
|
-
fromAddress: string
|
|
462
|
-
toAddress: string
|
|
463
|
-
balanceChangeNumber: number
|
|
464
|
-
expirationTick: number
|
|
465
|
-
isClient: boolean
|
|
466
|
-
initialBalanceChangeJson: string
|
|
467
|
-
notaryId: number
|
|
468
|
-
holdAmount: bigint
|
|
469
|
-
delegatedSignerAddress?: string
|
|
470
|
-
domainHash?: Buffer
|
|
471
|
-
notarizationId?: number
|
|
472
|
-
missedClaimWindow: boolean
|
|
473
|
-
settledAmount: bigint
|
|
514
|
+
id: string;
|
|
515
|
+
fromAddress: string;
|
|
516
|
+
toAddress: string;
|
|
517
|
+
balanceChangeNumber: number;
|
|
518
|
+
expirationTick: number;
|
|
519
|
+
isClient: boolean;
|
|
520
|
+
initialBalanceChangeJson: string;
|
|
521
|
+
notaryId: number;
|
|
522
|
+
holdAmount: bigint;
|
|
523
|
+
delegatedSignerAddress?: string;
|
|
524
|
+
domainHash?: Buffer;
|
|
525
|
+
notarizationId?: number;
|
|
526
|
+
missedClaimWindow: boolean;
|
|
527
|
+
settledAmount: bigint;
|
|
474
528
|
}
|
|
475
529
|
|
|
476
530
|
export interface ClaimResult {
|
|
477
|
-
claimed: bigint
|
|
478
|
-
tax: bigint
|
|
531
|
+
claimed: bigint;
|
|
532
|
+
tax: bigint;
|
|
479
533
|
}
|
|
480
534
|
|
|
481
535
|
export enum CryptoScheme {
|
|
482
536
|
Ed25519 = 0,
|
|
483
537
|
Sr25519 = 1,
|
|
484
|
-
Ecdsa = 2
|
|
538
|
+
Ecdsa = 2,
|
|
485
539
|
}
|
|
486
540
|
|
|
487
541
|
/** Max versions that can be in a datastore zone record */
|
|
488
|
-
export const DATASTORE_MAX_VERSIONS: number
|
|
542
|
+
export const DATASTORE_MAX_VERSIONS: number;
|
|
489
543
|
|
|
490
544
|
export interface Domain {
|
|
491
|
-
name: string
|
|
492
|
-
topLevel: DomainTopLevel
|
|
545
|
+
name: string;
|
|
546
|
+
topLevel: DomainTopLevel;
|
|
493
547
|
}
|
|
494
548
|
|
|
495
549
|
/** Cost to lease a domain for 1 year */
|
|
496
|
-
export const DOMAIN_LEASE_COST: bigint
|
|
550
|
+
export const DOMAIN_LEASE_COST: bigint;
|
|
497
551
|
|
|
498
552
|
/** Minimum domain name length */
|
|
499
|
-
export const DOMAIN_MIN_NAME_LENGTH: number
|
|
553
|
+
export const DOMAIN_MIN_NAME_LENGTH: number;
|
|
500
554
|
|
|
501
555
|
export interface DomainRegistration {
|
|
502
|
-
registeredToAddress: string
|
|
503
|
-
registeredAtTick: number
|
|
556
|
+
registeredToAddress: string;
|
|
557
|
+
registeredAtTick: number;
|
|
504
558
|
}
|
|
505
559
|
|
|
506
560
|
export enum DomainTopLevel {
|
|
@@ -523,12 +577,12 @@ export enum DomainTopLevel {
|
|
|
523
577
|
Sports = 16,
|
|
524
578
|
Transportation = 17,
|
|
525
579
|
Travel = 18,
|
|
526
|
-
Weather = 19
|
|
580
|
+
Weather = 19,
|
|
527
581
|
}
|
|
528
582
|
|
|
529
583
|
export interface ImmortalizedBlock {
|
|
530
|
-
immortalizedBlock: number
|
|
531
|
-
accountChangesMerkleRoot: Uint8Array
|
|
584
|
+
immortalizedBlock: number;
|
|
585
|
+
accountChangesMerkleRoot: Uint8Array;
|
|
532
586
|
}
|
|
533
587
|
|
|
534
588
|
/**
|
|
@@ -537,146 +591,145 @@ export interface ImmortalizedBlock {
|
|
|
537
591
|
*/
|
|
538
592
|
export interface KeystorePasswordOption {
|
|
539
593
|
/** Provides a password directly for the keystore. Converted to a SecretString inside Rust, but not cleared out in javascript or napi. */
|
|
540
|
-
password?: Buffer
|
|
594
|
+
password?: Buffer;
|
|
541
595
|
/** Initiate a prompt from the cli to load the password. */
|
|
542
|
-
interactiveCli?: boolean
|
|
596
|
+
interactiveCli?: boolean;
|
|
543
597
|
/** Load the password from a file. */
|
|
544
|
-
passwordFile?: string
|
|
598
|
+
passwordFile?: string;
|
|
545
599
|
}
|
|
546
600
|
|
|
547
601
|
export interface LocalchainConfig {
|
|
548
|
-
path: string
|
|
549
|
-
mainchainUrl: string
|
|
550
|
-
ntpPoolUrl?: string
|
|
551
|
-
keystorePassword?: KeystorePasswordOption
|
|
602
|
+
path: string;
|
|
603
|
+
mainchainUrl: string;
|
|
604
|
+
ntpPoolUrl?: string;
|
|
605
|
+
keystorePassword?: KeystorePasswordOption;
|
|
552
606
|
}
|
|
553
607
|
|
|
554
608
|
export interface LocalchainOverview {
|
|
555
609
|
/** The name of this localchain */
|
|
556
|
-
name: string
|
|
610
|
+
name: string;
|
|
557
611
|
/** The primary localchain address */
|
|
558
|
-
address: string
|
|
612
|
+
address: string;
|
|
559
613
|
/** The current account balance */
|
|
560
|
-
balance: bigint
|
|
614
|
+
balance: bigint;
|
|
561
615
|
/** The net pending balance change acceptance/confirmation */
|
|
562
|
-
pendingBalanceChange: bigint
|
|
616
|
+
pendingBalanceChange: bigint;
|
|
563
617
|
/** Balance held in channel_hold */
|
|
564
|
-
heldBalance: bigint
|
|
618
|
+
heldBalance: bigint;
|
|
565
619
|
/** Tax accumulated for the account */
|
|
566
|
-
tax: bigint
|
|
620
|
+
tax: bigint;
|
|
567
621
|
/** The net pending tax balance change */
|
|
568
|
-
pendingTaxChange: bigint
|
|
622
|
+
pendingTaxChange: bigint;
|
|
569
623
|
/** Changes to the account ordered from most recent to oldest */
|
|
570
|
-
changes: Array<BalanceChangeGroup
|
|
624
|
+
changes: Array<BalanceChangeGroup>;
|
|
571
625
|
/** The mainchain balance */
|
|
572
|
-
mainchainBalance: bigint
|
|
626
|
+
mainchainBalance: bigint;
|
|
573
627
|
/** The mainchain identity */
|
|
574
|
-
mainchainIdentity?: ChainIdentity
|
|
628
|
+
mainchainIdentity?: ChainIdentity;
|
|
575
629
|
/** The net pending mainchain balance pending movement in/out of the localchain */
|
|
576
|
-
processingMainchainBalanceChange: bigint
|
|
630
|
+
processingMainchainBalanceChange: bigint;
|
|
577
631
|
}
|
|
578
632
|
|
|
579
633
|
export interface LocalchainTransaction {
|
|
580
|
-
id: number
|
|
581
|
-
transactionType: TransactionType
|
|
634
|
+
id: number;
|
|
635
|
+
transactionType: TransactionType;
|
|
582
636
|
}
|
|
583
637
|
|
|
584
638
|
export interface LocalchainTransfer {
|
|
585
|
-
address: string
|
|
586
|
-
amount: bigint
|
|
587
|
-
notaryId: number
|
|
588
|
-
expirationTick: number
|
|
589
|
-
transferId: number
|
|
639
|
+
address: string;
|
|
640
|
+
amount: bigint;
|
|
641
|
+
notaryId: number;
|
|
642
|
+
expirationTick: number;
|
|
643
|
+
transferId: number;
|
|
590
644
|
}
|
|
591
645
|
|
|
592
646
|
/** Max balance changes that can be in a single notarization */
|
|
593
|
-
export const NOTARIZATION_MAX_BALANCE_CHANGES: number
|
|
647
|
+
export const NOTARIZATION_MAX_BALANCE_CHANGES: number;
|
|
594
648
|
|
|
595
649
|
/** Max notarizations that can be in a single notarization */
|
|
596
|
-
export const NOTARIZATION_MAX_BLOCK_VOTES: number
|
|
650
|
+
export const NOTARIZATION_MAX_BLOCK_VOTES: number;
|
|
597
651
|
|
|
598
652
|
/** Max domains that can be in a single notarization */
|
|
599
|
-
export const NOTARIZATION_MAX_DOMAINS: number
|
|
653
|
+
export const NOTARIZATION_MAX_DOMAINS: number;
|
|
600
654
|
|
|
601
655
|
export interface NotaryAccountOrigin {
|
|
602
|
-
notaryId: number
|
|
603
|
-
notebookNumber: number
|
|
604
|
-
accountUid: number
|
|
656
|
+
notaryId: number;
|
|
657
|
+
notebookNumber: number;
|
|
658
|
+
accountUid: number;
|
|
605
659
|
}
|
|
606
660
|
|
|
607
661
|
export interface NotaryDetails {
|
|
608
|
-
id: number
|
|
609
|
-
hosts: Array<string
|
|
610
|
-
publicKey: Uint8Array
|
|
662
|
+
id: number;
|
|
663
|
+
hosts: Array<string>;
|
|
664
|
+
publicKey: Uint8Array;
|
|
611
665
|
}
|
|
612
666
|
|
|
613
667
|
export interface NotebookMeta {
|
|
614
|
-
finalizedNotebookNumber: number
|
|
615
|
-
finalizedTick: number
|
|
668
|
+
finalizedNotebookNumber: number;
|
|
669
|
+
finalizedTick: number;
|
|
616
670
|
}
|
|
617
671
|
|
|
618
672
|
export interface NotebookProof {
|
|
619
|
-
address: string
|
|
620
|
-
accountType: AccountType
|
|
621
|
-
notebookNumber: number
|
|
622
|
-
balance: bigint
|
|
673
|
+
address: string;
|
|
674
|
+
accountType: AccountType;
|
|
675
|
+
notebookNumber: number;
|
|
676
|
+
balance: bigint;
|
|
623
677
|
/** H256 hash of the balance tip */
|
|
624
|
-
balanceTip: Uint8Array
|
|
625
|
-
changeNumber: number
|
|
626
|
-
accountOrigin: NotaryAccountOrigin
|
|
627
|
-
channelHoldNoteJson?: string
|
|
628
|
-
leafIndex: number
|
|
629
|
-
numberOfLeaves: number
|
|
630
|
-
proof: Array<Uint8Array
|
|
678
|
+
balanceTip: Uint8Array;
|
|
679
|
+
changeNumber: number;
|
|
680
|
+
accountOrigin: NotaryAccountOrigin;
|
|
681
|
+
channelHoldNoteJson?: string;
|
|
682
|
+
leafIndex: number;
|
|
683
|
+
numberOfLeaves: number;
|
|
684
|
+
proof: Array<Uint8Array>;
|
|
631
685
|
}
|
|
632
686
|
|
|
633
|
-
export declare function runCli(): Promise<void
|
|
687
|
+
export declare function runCli(): Promise<void>;
|
|
634
688
|
|
|
635
689
|
export interface SignatureResult {
|
|
636
|
-
signature: Uint8Array
|
|
637
|
-
microgons: bigint
|
|
690
|
+
signature: Uint8Array;
|
|
691
|
+
microgons: bigint;
|
|
638
692
|
}
|
|
639
693
|
|
|
640
694
|
export interface Ticker {
|
|
641
|
-
tickDurationMillis: number
|
|
642
|
-
channelHoldExpirationTicks: number
|
|
695
|
+
tickDurationMillis: number;
|
|
696
|
+
channelHoldExpirationTicks: number;
|
|
643
697
|
}
|
|
644
698
|
|
|
645
699
|
export interface TickerConfig {
|
|
646
|
-
tickDurationMillis: number
|
|
647
|
-
channelHoldExpirationTicks: number
|
|
648
|
-
ntpPoolUrl?: string
|
|
700
|
+
tickDurationMillis: number;
|
|
701
|
+
channelHoldExpirationTicks: number;
|
|
702
|
+
ntpPoolUrl?: string;
|
|
649
703
|
}
|
|
650
704
|
|
|
651
705
|
export enum TransactionType {
|
|
652
706
|
Send = 0,
|
|
653
707
|
Request = 1,
|
|
654
708
|
OpenChannelHold = 2,
|
|
655
|
-
Consolidation = 3
|
|
709
|
+
Consolidation = 3,
|
|
656
710
|
}
|
|
657
711
|
|
|
658
712
|
/** Maximum tax amount that can be charged on a transfer */
|
|
659
|
-
export const TRANSFER_TAX_CAP: bigint
|
|
713
|
+
export const TRANSFER_TAX_CAP: bigint;
|
|
660
714
|
|
|
661
715
|
export interface VersionHost {
|
|
662
716
|
/** Datastore id is a 2-50 char string that uniquely identifies a domain. */
|
|
663
|
-
datastoreId: string
|
|
717
|
+
datastoreId: string;
|
|
664
718
|
/** The host address where the domain can be accessed. */
|
|
665
|
-
host: string
|
|
719
|
+
host: string;
|
|
666
720
|
}
|
|
667
721
|
|
|
668
722
|
export interface VoteCreationOptions {
|
|
669
|
-
votesAddress?: string
|
|
723
|
+
votesAddress?: string;
|
|
670
724
|
/** What's the minimum amount of tax we should wait for before voting on blocks */
|
|
671
|
-
minimumVoteAmount?: number
|
|
725
|
+
minimumVoteAmount?: number;
|
|
672
726
|
/** How many votes to create per tick loop */
|
|
673
|
-
votesPerTick?: number
|
|
727
|
+
votesPerTick?: number;
|
|
674
728
|
}
|
|
675
729
|
|
|
676
730
|
export interface ZoneRecord {
|
|
677
|
-
paymentAddress: string
|
|
678
|
-
notaryId: number
|
|
731
|
+
paymentAddress: string;
|
|
732
|
+
notaryId: number;
|
|
679
733
|
/** A mapping of versions to host addresses. */
|
|
680
|
-
versions: Record<string, VersionHost
|
|
734
|
+
versions: Record<string, VersionHost>;
|
|
681
735
|
}
|
|
682
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argonprotocol/localchain",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "A nodejs binding to the Argon Localchain",
|
|
5
5
|
"bin": "cli.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"prepublishOnly": "napi prepublish -t npm",
|
|
19
19
|
"pretest": "npm run build:debug",
|
|
20
20
|
"test": "npm run pretest && vitest run --typecheck --disableConsoleIntercept",
|
|
21
|
+
"test:ci": "vitest run --typecheck --disableConsoleIntercept",
|
|
21
22
|
"version": "napi version"
|
|
22
23
|
},
|
|
23
24
|
"license": "MIT",
|
|
@@ -40,8 +41,8 @@
|
|
|
40
41
|
]
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@argonprotocol/mainchain": "1.
|
|
44
|
-
"@argonprotocol/testing": "1.
|
|
44
|
+
"@argonprotocol/mainchain": "1.3.1",
|
|
45
|
+
"@argonprotocol/testing": "1.3.1",
|
|
45
46
|
"@napi-rs/cli": "3.0.0-alpha.55",
|
|
46
47
|
"shx": "^0.3.4",
|
|
47
48
|
"typescript": "^5.8.3",
|
|
@@ -52,10 +53,10 @@
|
|
|
52
53
|
},
|
|
53
54
|
"packageManager": "yarn@4.1.0",
|
|
54
55
|
"optionalDependencies": {
|
|
55
|
-
"@argonprotocol/localchain-darwin-x64": "1.
|
|
56
|
-
"@argonprotocol/localchain-darwin-arm64": "1.
|
|
57
|
-
"@argonprotocol/localchain-win32-x64-msvc": "1.
|
|
58
|
-
"@argonprotocol/localchain-linux-x64-gnu": "1.
|
|
59
|
-
"@argonprotocol/localchain-linux-arm64-gnu": "1.
|
|
56
|
+
"@argonprotocol/localchain-darwin-x64": "1.3.1",
|
|
57
|
+
"@argonprotocol/localchain-darwin-arm64": "1.3.1",
|
|
58
|
+
"@argonprotocol/localchain-win32-x64-msvc": "1.3.1",
|
|
59
|
+
"@argonprotocol/localchain-linux-x64-gnu": "1.3.1",
|
|
60
|
+
"@argonprotocol/localchain-linux-arm64-gnu": "1.3.1"
|
|
60
61
|
}
|
|
61
62
|
}
|