@tari-project/ootle 0.18.0 → 0.19.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/dist/index.d.ts +110 -11
- package/dist/index.js +515 -450
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AllocatableAddressType } from '@tari-project/ootle-ts-bindings';
|
|
2
2
|
import { Amount } from '@tari-project/ootle-ts-bindings';
|
|
3
3
|
import { ClaimedOutputTombstoneAddress } from '@tari-project/ootle-ts-bindings';
|
|
4
|
+
import { ComponentAccessRules } from '@tari-project/ootle-ts-bindings';
|
|
4
5
|
import { ComponentAddress } from '@tari-project/ootle-ts-bindings';
|
|
5
6
|
import { ConfidentialWithdrawProof } from '@tari-project/ootle-ts-bindings';
|
|
6
7
|
import { Decision } from '@tari-project/ootle-ts-bindings';
|
|
@@ -27,18 +28,22 @@ import { MainSigner } from '@tari-project/ootle-ts-bindings';
|
|
|
27
28
|
import { MinotariBurnClaimProof } from '@tari-project/ootle-ts-bindings';
|
|
28
29
|
import { NonFungibleAddress } from '@tari-project/ootle-ts-bindings';
|
|
29
30
|
import { OutputBody } from '@tari-project/ootle-ts-bindings';
|
|
31
|
+
import { OwnerRule } from '@tari-project/ootle-ts-bindings';
|
|
30
32
|
import { PublishedTemplateAddress } from '@tari-project/ootle-ts-bindings';
|
|
31
33
|
import { RejectReason } from '@tari-project/ootle-ts-bindings';
|
|
32
34
|
import { Resource } from '@tari-project/ootle-ts-bindings';
|
|
33
35
|
import { ResourceAddress } from '@tari-project/ootle-ts-bindings';
|
|
34
36
|
import { RistrettoPublicKeyBytes } from '@tari-project/ootle-ts-bindings';
|
|
37
|
+
import { SpendAuthorization } from '@tari-project/ootle-ts-bindings';
|
|
35
38
|
import { StealthTransferStatement as StealthTransferStatement_2 } from '@tari-project/ootle-ts-bindings';
|
|
36
39
|
import { SubstateId } from '@tari-project/ootle-ts-bindings';
|
|
37
40
|
import { SubstateRequirement } from '@tari-project/ootle-ts-bindings';
|
|
38
41
|
import { SubstateValue } from '@tari-project/ootle-ts-bindings';
|
|
39
42
|
import { Transaction } from '@tari-project/ootle-ts-bindings';
|
|
43
|
+
import { transactionBody } from '@tari-project/ootle-ts-bindings';
|
|
40
44
|
import { TransactionEnvelope } from '@tari-project/ootle-ts-bindings';
|
|
41
45
|
import { TransactionReceipt } from '@tari-project/ootle-ts-bindings';
|
|
46
|
+
import { transactionSchemaVersion } from '@tari-project/ootle-ts-bindings';
|
|
42
47
|
import { TransactionSignature } from '@tari-project/ootle-ts-bindings';
|
|
43
48
|
import { TransactionV1 } from '@tari-project/ootle-ts-bindings';
|
|
44
49
|
import { UnsealedTransactionV1 } from '@tari-project/ootle-ts-bindings';
|
|
@@ -147,6 +152,10 @@ export declare class AuthorizedTransfer {
|
|
|
147
152
|
private readonly sealKeypair;
|
|
148
153
|
/** Extra signatures appended via {@link addSignature} before sealing. */
|
|
149
154
|
private readonly extraSignatures;
|
|
155
|
+
/** Co-signer keys declared via {@link addAuthorizer}, before the authorizer set is fixed. */
|
|
156
|
+
private readonly coSignerKeys;
|
|
157
|
+
/** The authorizer set, fixed on first use by {@link getAuthorizerPublicKeys}. */
|
|
158
|
+
private authorizerSet?;
|
|
150
159
|
/**
|
|
151
160
|
* Memoized one-time spend-key authorizations — see {@link createAuthorizations} for the
|
|
152
161
|
* lifecycle and why memoization (not recomputation) is required.
|
|
@@ -155,6 +164,23 @@ export declare class AuthorizedTransfer {
|
|
|
155
164
|
constructor(params: AuthorizedTransferParams);
|
|
156
165
|
/** The shared seal signer public key (fixed for this transfer's lifetime). */
|
|
157
166
|
getSealPublicKey(): Uint8Array;
|
|
167
|
+
/**
|
|
168
|
+
* Declare an external co-signer's public key as an authorizer of this transfer.
|
|
169
|
+
*
|
|
170
|
+
* Every signature commits to the whole authorizer set, so a co-signer must be declared before
|
|
171
|
+
* the set is fixed — that is, before {@link getAuthorizerPublicKeys}, {@link createAuthorizations}
|
|
172
|
+
* or {@link seal} is first called. The co-signer then signs over {@link getAuthorizerPublicKeys}
|
|
173
|
+
* and its signature is handed back via {@link addSignature}.
|
|
174
|
+
*
|
|
175
|
+
* @throws {WalletError} if the authorizer set is already fixed.
|
|
176
|
+
*/
|
|
177
|
+
addAuthorizer(publicKey: Uint8Array): this;
|
|
178
|
+
/**
|
|
179
|
+
* The transfer's authorizer set: the account key (unless `mustSignWithAccountKey` is `false`),
|
|
180
|
+
* each stealth input's one-time spend key, and every co-signer declared via
|
|
181
|
+
* {@link addAuthorizer}, in canonical order. Fixed on the first call.
|
|
182
|
+
*/
|
|
183
|
+
getAuthorizerPublicKeys(): Promise<Uint8Array[]>;
|
|
158
184
|
/** The hydrated, post-`prepare` spec (balance proof filled, instruction patched). */
|
|
159
185
|
getSpec(): StealthTransferSpec;
|
|
160
186
|
/**
|
|
@@ -194,6 +220,9 @@ export declare class AuthorizedTransfer {
|
|
|
194
220
|
* sealing. The account-key signature is added automatically at {@link seal} unless
|
|
195
221
|
* `mustSignWithAccountKey` is `false`.
|
|
196
222
|
*
|
|
223
|
+
* The co-signer's key must have been declared with {@link addAuthorizer}, and its signature made
|
|
224
|
+
* over {@link getAuthorizerPublicKeys}; {@link seal} throws `SignerError` otherwise.
|
|
225
|
+
*
|
|
197
226
|
* Do **NOT** pass the per-input one-time spend-key authorizations here — they are
|
|
198
227
|
* produced (memoized) by {@link createAuthorizations} and auto-included by {@link seal}
|
|
199
228
|
* exactly once. Re-adding them via this method would double-count them in the sealed tx,
|
|
@@ -285,6 +314,14 @@ declare abstract class Bytes32 {
|
|
|
285
314
|
/** CBOR-encode a `Vec<u8>` as a CBOR byte string. */
|
|
286
315
|
export declare function bytesLiteral(value: Uint8Array): InstructionArg;
|
|
287
316
|
|
|
317
|
+
/**
|
|
318
|
+
* Orders authorizer public keys canonically: ascending by bytes, without repeats.
|
|
319
|
+
*
|
|
320
|
+
* Every 32-byte key is length-checked. This is the order the mempool requires of a schema V2
|
|
321
|
+
* transaction's authorizations (`AuthorizationsNotCanonical` otherwise).
|
|
322
|
+
*/
|
|
323
|
+
export declare function canonicalAuthorizers(authorizers: Uint8Array[]): Uint8Array[];
|
|
324
|
+
|
|
288
325
|
/**
|
|
289
326
|
* CBOR-encode a `ClaimedOutputTombstoneAddress` as `Tag(136, bytes(32))`.
|
|
290
327
|
* Accepts either the `tombstone_<hex>` form or the bare 64-hex-char tail.
|
|
@@ -304,6 +341,12 @@ export declare function classifyOutcome(result: IndexerTransactionFinalizedResul
|
|
|
304
341
|
reason?: string;
|
|
305
342
|
} | null;
|
|
306
343
|
|
|
344
|
+
/**
|
|
345
|
+
* The authorizer set of a transaction signed by `signers`: each signer's
|
|
346
|
+
* `getAuthorizerPublicKeys()`, or its `getPublicKey()` when it does not implement that.
|
|
347
|
+
*/
|
|
348
|
+
export declare function collectAuthorizers(signers: Signer[]): Promise<Uint8Array[]>;
|
|
349
|
+
|
|
307
350
|
/**
|
|
308
351
|
* Extract the 32-byte commitment from a UTXO substate id.
|
|
309
352
|
*
|
|
@@ -455,6 +498,13 @@ export declare function defaultIndexerUrl(network: Network): string;
|
|
|
455
498
|
export declare class DefaultSignerNotSetError extends WalletError {
|
|
456
499
|
}
|
|
457
500
|
|
|
501
|
+
/**
|
|
502
|
+
* Encodes an authorizer set for the WASM signing functions (`addTransactionSigner`,
|
|
503
|
+
* `attachTransactionSignature`, `hashUnsignedTransaction`): the 32-byte keys concatenated, in
|
|
504
|
+
* canonical order.
|
|
505
|
+
*/
|
|
506
|
+
export declare function encodeAuthorizerSet(authorizers: Uint8Array[]): Uint8Array;
|
|
507
|
+
|
|
458
508
|
/**
|
|
459
509
|
* Opaque carrier for an output's ciphertext bytes (the AEAD-encrypted value/mask/memo
|
|
460
510
|
* payload). Treated as opaque here: the stealth module never inspects the plaintext
|
|
@@ -509,7 +559,7 @@ export declare class ExternalKeySigner implements Signer {
|
|
|
509
559
|
constructor(options: ExternalKeySignerOptions);
|
|
510
560
|
getAddress(): Promise<string>;
|
|
511
561
|
getPublicKey(): Promise<Uint8Array>;
|
|
512
|
-
signTransaction(unsignedTx: UnsignedTransactionV1, sealPublicKey: Uint8Array): Promise<TransactionSignature[]>;
|
|
562
|
+
signTransaction(unsignedTx: UnsignedTransactionV1, sealPublicKey: Uint8Array, authorizers: Uint8Array[]): Promise<TransactionSignature[]>;
|
|
513
563
|
}
|
|
514
564
|
|
|
515
565
|
export declare interface ExternalKeySignerOptions {
|
|
@@ -870,19 +920,31 @@ export declare class OotleWallet implements Signer {
|
|
|
870
920
|
* @throws {DefaultSignerNotSetError} when no default signer is configured.
|
|
871
921
|
* @throws {KeyProviderNotFoundError} when the default address has no registered provider.
|
|
872
922
|
*/
|
|
873
|
-
signTransaction(unsignedTx: UnsignedTransactionV1, sealPublicKey: Uint8Array): Promise<TransactionSignature[]>;
|
|
923
|
+
signTransaction(unsignedTx: UnsignedTransactionV1, sealPublicKey: Uint8Array, authorizers: Uint8Array[]): Promise<TransactionSignature[]>;
|
|
924
|
+
/**
|
|
925
|
+
* The default signer's authorizer keys.
|
|
926
|
+
*
|
|
927
|
+
* @throws {DefaultSignerNotSetError} when no default signer is configured.
|
|
928
|
+
* @throws {KeyProviderNotFoundError} when the default address has no registered provider.
|
|
929
|
+
*/
|
|
930
|
+
getAuthorizerPublicKeys(): Promise<Uint8Array[]>;
|
|
874
931
|
/**
|
|
875
932
|
* Generates `TransactionAuthorization` (signatures) for a specific registered signer.
|
|
876
933
|
* Mirrors `OotleWallet::authorize_transaction` from ootle-rs.
|
|
877
934
|
*
|
|
935
|
+
* `authorizers` is the transaction's full authorizer set, this signer's keys among them.
|
|
936
|
+
*
|
|
878
937
|
* @throws {KeyProviderNotFoundError} when no provider is registered for `signerAddress`.
|
|
879
938
|
*/
|
|
880
|
-
authorizeTransaction(signerAddress: string, unsignedTx: UnsignedTransactionV1, sealPublicKey: Uint8Array): Promise<TransactionAuthorization>;
|
|
939
|
+
authorizeTransaction(signerAddress: string, unsignedTx: UnsignedTransactionV1, sealPublicKey: Uint8Array, authorizers: Uint8Array[]): Promise<TransactionAuthorization>;
|
|
881
940
|
/**
|
|
882
941
|
* Collects authorizations from all registered key providers.
|
|
883
942
|
* Useful when a transaction requires multiple signers.
|
|
943
|
+
*
|
|
944
|
+
* `authorizers` defaults to the keys of every registered provider; pass the full set when the
|
|
945
|
+
* transaction has authorizers outside this wallet.
|
|
884
946
|
*/
|
|
885
|
-
authorizeTransactionAll(unsignedTx: UnsignedTransactionV1, sealPublicKey: Uint8Array): Promise<TransactionAuthorization[]>;
|
|
947
|
+
authorizeTransactionAll(unsignedTx: UnsignedTransactionV1, sealPublicKey: Uint8Array, authorizers?: Uint8Array[]): Promise<TransactionAuthorization[]>;
|
|
886
948
|
/**
|
|
887
949
|
* Returns the key provider for a specific address, if registered.
|
|
888
950
|
*/
|
|
@@ -940,6 +1002,8 @@ export declare interface ParsedUtxo {
|
|
|
940
1002
|
commitment: Uint8Array;
|
|
941
1003
|
/** The on-chain output body (`public_nonce`, `encrypted_data`, ...). */
|
|
942
1004
|
body: OutputBody;
|
|
1005
|
+
/** How the output is spent: a one-time spend key, a script, or both. */
|
|
1006
|
+
auth: SpendAuthorization;
|
|
943
1007
|
}
|
|
944
1008
|
|
|
945
1009
|
/**
|
|
@@ -1067,6 +1131,8 @@ declare interface ResolvedStealthInput {
|
|
|
1067
1131
|
publicNonce: Uint8Array;
|
|
1068
1132
|
/** The view secret that unblinded the input; the one-time spend key is derived from it too. */
|
|
1069
1133
|
viewSecret: Uint8Array;
|
|
1134
|
+
/** The UTXO's one-time spend public key (from its on-chain spend authorization). */
|
|
1135
|
+
oneTimePublicKey: Uint8Array;
|
|
1070
1136
|
}
|
|
1071
1137
|
|
|
1072
1138
|
/**
|
|
@@ -1220,15 +1286,26 @@ export declare interface Signer {
|
|
|
1220
1286
|
getAddress(): Promise<string>;
|
|
1221
1287
|
/** Returns the raw public key bytes for this signer. */
|
|
1222
1288
|
getPublicKey(): Promise<Uint8Array>;
|
|
1289
|
+
/**
|
|
1290
|
+
* The public keys this signer authorizes with, for the transaction's authorizer set.
|
|
1291
|
+
*
|
|
1292
|
+
* **Optional** — defaults to `[await getPublicKey()]`. Every authorizer signs over the full set,
|
|
1293
|
+
* so {@link signTransaction} (the free function) collects it from all signers before any of them
|
|
1294
|
+
* signs. Implement this only for a signer that contributes signatures from keys other than
|
|
1295
|
+
* {@link getPublicKey} (or more than one).
|
|
1296
|
+
*/
|
|
1297
|
+
getAuthorizerPublicKeys?(): Promise<Uint8Array[]>;
|
|
1223
1298
|
/**
|
|
1224
1299
|
* Signs the given unsigned transaction and returns the collected signatures.
|
|
1225
1300
|
*
|
|
1226
|
-
* `sealPublicKey`
|
|
1227
|
-
* (`hashUnsignedTransaction(
|
|
1228
|
-
* final envelope verifies against the SAME hash — the engine's seal verification
|
|
1229
|
-
* this.
|
|
1301
|
+
* `sealPublicKey` and `authorizers` are mixed into the transaction hash
|
|
1302
|
+
* (`hashUnsignedTransaction(json, sealPublicKey, encodeAuthorizerSet(authorizers))`) so every
|
|
1303
|
+
* signature in the final envelope verifies against the SAME hash — the engine's seal verification
|
|
1304
|
+
* enforces this. `authorizers` is the public key of every authorizer of the transaction, this
|
|
1305
|
+
* signer's among them; the sealed transaction must carry an authorization from each key and no
|
|
1306
|
+
* other. Implementations MUST hash with the supplied values, not their own.
|
|
1230
1307
|
*/
|
|
1231
|
-
signTransaction(transaction: UnsignedTransactionV1, sealPublicKey: Uint8Array): Promise<TransactionSignature[]>;
|
|
1308
|
+
signTransaction(transaction: UnsignedTransactionV1, sealPublicKey: Uint8Array, authorizers: Uint8Array[]): Promise<TransactionSignature[]>;
|
|
1232
1309
|
/**
|
|
1233
1310
|
* Returns the view-only secret for stealth scanning/spending, if this signer holds one.
|
|
1234
1311
|
*
|
|
@@ -1252,12 +1329,14 @@ export declare interface Signer {
|
|
|
1252
1329
|
* @param publicNonce - The stealth output's sender public nonce (the DH counterparty).
|
|
1253
1330
|
* @param sealPublicKey - The seal signer's public key, mixed into the transaction hash
|
|
1254
1331
|
* (mirrors the `hashUnsignedTransaction` arg used by {@link Signer.signTransaction}).
|
|
1255
|
-
* @param ctx - Injected crypto seam, so the signer never imports WASM directly
|
|
1256
|
-
* owner's 32-byte view secret, which the one-time spend key is derived from
|
|
1332
|
+
* @param ctx - Injected crypto seam, so the signer never imports WASM directly; the
|
|
1333
|
+
* owner's 32-byte view secret, which the one-time spend key is derived from; and the
|
|
1334
|
+
* transaction's full authorizer set, which includes the one-time spend public key.
|
|
1257
1335
|
*/
|
|
1258
1336
|
addStealthSignature?(unsignedJson: string, publicNonce: Uint8Array, sealPublicKey: Uint8Array, ctx: {
|
|
1259
1337
|
crypto: SignerStealthCrypto;
|
|
1260
1338
|
viewSecret: Uint8Array;
|
|
1339
|
+
authorizers: Uint8Array[];
|
|
1261
1340
|
}): Promise<TransactionSignature>;
|
|
1262
1341
|
}
|
|
1263
1342
|
|
|
@@ -1294,6 +1373,12 @@ export declare interface SignerStealthCrypto {
|
|
|
1294
1373
|
*
|
|
1295
1374
|
* The main signer is settled first with {@link resolveMainSigner}: a transaction that declares
|
|
1296
1375
|
* none acts as the first signer.
|
|
1376
|
+
*
|
|
1377
|
+
* The authorizer set is collected from every signer ({@link collectAuthorizers}) before any of
|
|
1378
|
+
* them signs, since each signature commits to the whole set. The signatures are sealed in
|
|
1379
|
+
* ascending public-key order, as schema V2 requires.
|
|
1380
|
+
*
|
|
1381
|
+
* @throws {SignerError} when the signers' signatures are not exactly one per authorizer key.
|
|
1297
1382
|
*/
|
|
1298
1383
|
export declare function signTransaction(signers: Signer[], unsignedTx: UnsignedTransactionV1, sealKeypair?: SealKeypair): Promise<SignedTransaction>;
|
|
1299
1384
|
|
|
@@ -1880,6 +1965,8 @@ export declare interface TransactionAuthorization {
|
|
|
1880
1965
|
signatures: TransactionSignature[];
|
|
1881
1966
|
}
|
|
1882
1967
|
|
|
1968
|
+
export { transactionBody }
|
|
1969
|
+
|
|
1883
1970
|
/**
|
|
1884
1971
|
* Fluent builder for constructing UnsignedTransactionV1 objects.
|
|
1885
1972
|
*
|
|
@@ -1911,6 +1998,16 @@ export declare class TransactionBuilder {
|
|
|
1911
1998
|
createAccount(ownerPublicKey: string, workspaceBucket?: string): this;
|
|
1912
1999
|
createProof(account: ComponentAddress, resourceAddress: ResourceAddress): this;
|
|
1913
2000
|
claimBurn(claim: MinotariBurnClaimProof): this;
|
|
2001
|
+
/**
|
|
2002
|
+
* Replace a component's method access rules (`SetComponentAccessRules`). The component's
|
|
2003
|
+
* `rules_updater`, fixed when it was created, decides who may: `Locked` components refuse it.
|
|
2004
|
+
*/
|
|
2005
|
+
setComponentAccessRules(componentAddress: ComponentAddress, accessRules: ComponentAccessRules): this;
|
|
2006
|
+
/**
|
|
2007
|
+
* Replace a component's owner rule (`SetComponentOwnerRule`), as permitted by its
|
|
2008
|
+
* `rules_updater`.
|
|
2009
|
+
*/
|
|
2010
|
+
setComponentOwnerRule(componentAddress: ComponentAddress, ownerRule: OwnerRule): this;
|
|
1914
2011
|
allocateAddress(allocatableType: AllocatableAddressType, workspaceIdName: string): this;
|
|
1915
2012
|
/**
|
|
1916
2013
|
* Saves the last instruction output to a named workspace variable.
|
|
@@ -2094,6 +2191,8 @@ export declare class TransactionRejectedError extends OotleError {
|
|
|
2094
2191
|
});
|
|
2095
2192
|
}
|
|
2096
2193
|
|
|
2194
|
+
export { transactionSchemaVersion }
|
|
2195
|
+
|
|
2097
2196
|
export { TransactionSignature }
|
|
2098
2197
|
|
|
2099
2198
|
/** Raised when polling / SSE both timed out before the transaction finalized. */
|