@chironbuilder/ootle-sdk 0.1.13 → 0.1.15
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 +45 -1
- package/dist/burnClaim.d.ts +62 -20
- package/dist/burnClaim.d.ts.map +1 -1
- package/dist/burnClaim.js +201 -34
- package/dist/htlcSafety.d.ts +123 -0
- package/dist/htlcSafety.d.ts.map +1 -0
- package/dist/htlcSafety.js +275 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/storage.d.ts +92 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +85 -1
- package/dist/wallet.d.ts +201 -77
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +895 -275
- package/package.json +6 -2
- package/vendor/ootle-patched/dist/index.d.ts +57 -28
- package/vendor/ootle-patched/dist/index.js +1389 -1365
- package/vendor/ootle-patched/package.json +23 -23
- package/vendor/ootle-wasm-patched/ootle_wasm.d.ts +4 -4
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.js +29 -17
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm +0 -0
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm.d.ts +4 -4
- package/vendor/ootle-wasm-patched/package.json +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chironbuilder/ootle-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Shared TypeScript client for Tari Ootle (L2): account derivation, balances, transactions, HTLCs, and stealth/confidential transfers — the account core behind Sapient and the Tari L1 web wallet's Ootle support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,12 +44,16 @@
|
|
|
44
44
|
"@tari-project/ootle": "file:./vendor/ootle-patched",
|
|
45
45
|
"@tari-project/ootle-indexer": "^0.3.0",
|
|
46
46
|
"@tari-project/ootle-secret-key-wallet": "^0.3.0",
|
|
47
|
-
"@tari-project/ootle-ts-bindings": "^1.
|
|
47
|
+
"@tari-project/ootle-ts-bindings": "^1.55.0",
|
|
48
48
|
"@tari-project/ootle-wasm": "file:./vendor/ootle-wasm-patched"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/chrome": "^0.0.280",
|
|
52
52
|
"typescript": "^5.6.0",
|
|
53
53
|
"vitest": "^4.1.0"
|
|
54
|
+
},
|
|
55
|
+
"overrides": {
|
|
56
|
+
"@tari-project/ootle-wasm": "$@tari-project/ootle-wasm",
|
|
57
|
+
"@tari-project/ootle": "$@tari-project/ootle"
|
|
54
58
|
}
|
|
55
59
|
}
|
|
@@ -17,6 +17,7 @@ import { IndexerGetTransactionResultResponse } from '@tari-project/ootle-ts-bind
|
|
|
17
17
|
import { IndexerSubmitTransactionRequest } from '@tari-project/ootle-ts-bindings';
|
|
18
18
|
import { IndexerSubmitTransactionResponse } from '@tari-project/ootle-ts-bindings';
|
|
19
19
|
import { IndexerTransactionFinalizedResult } from '@tari-project/ootle-ts-bindings';
|
|
20
|
+
import { InputDeclaration } from '@tari-project/ootle-ts-bindings';
|
|
20
21
|
import { Instruction } from '@tari-project/ootle-ts-bindings';
|
|
21
22
|
import { InstructionArg } from '@tari-project/ootle-ts-bindings';
|
|
22
23
|
import { ListRecentTransactionsRequest } from '@tari-project/ootle-ts-bindings';
|
|
@@ -517,7 +518,7 @@ export declare function fromHexStr(hex: string): Uint8Array;
|
|
|
517
518
|
* @returns A complete transfer statement.
|
|
518
519
|
* @throws {InvalidArgumentError} if `specs` is empty.
|
|
519
520
|
*/
|
|
520
|
-
export declare function generateOutputsStatement(crypto: StealthCryptoProvider, specs: Output[], revealed: bigint): Promise<StealthTransferStatement>;
|
|
521
|
+
export declare function generateOutputsStatement(crypto: StealthCryptoProvider, specs: Output[], revealed: bigint, revealedReceiver?: Uint8Array): Promise<StealthTransferStatement>;
|
|
521
522
|
|
|
522
523
|
/**
|
|
523
524
|
* Generate a fresh seal keypair (a thin wrapper over the WASM `generateKeypair`).
|
|
@@ -1195,10 +1196,13 @@ export declare interface StealthCryptoProvider {
|
|
|
1195
1196
|
*
|
|
1196
1197
|
* @param specs - The outputs to create (incl. change).
|
|
1197
1198
|
* @param revealedOutputAmount - The un-confidential (revealed) µTari output amount.
|
|
1199
|
+
* @param revealedReceiver - The 32-byte public key allowed to take the revealed output
|
|
1200
|
+
* (tari-ootle#2645: the engine requires its badge in the transaction's auth scope). Required
|
|
1201
|
+
* when `revealedOutputAmount > 0`, ignored otherwise.
|
|
1198
1202
|
* @returns The WASM-produced {@link StealthOutputsStatement} and the aggregated
|
|
1199
1203
|
* `outputMask` for the balance proof.
|
|
1200
1204
|
*/
|
|
1201
|
-
generateOutputsStatement(specs: Output[], revealedOutputAmount: bigint): Promise<{
|
|
1205
|
+
generateOutputsStatement(specs: Output[], revealedOutputAmount: bigint, revealedReceiver?: Uint8Array): Promise<{
|
|
1202
1206
|
statement: StealthOutputsStatement;
|
|
1203
1207
|
outputMask: Mask;
|
|
1204
1208
|
}>;
|
|
@@ -1363,11 +1367,23 @@ export declare class StealthTransfer {
|
|
|
1363
1367
|
/** Guards against a second {@link prepare} re-emitting instructions into the same builder. */
|
|
1364
1368
|
private prepared;
|
|
1365
1369
|
/**
|
|
1366
|
-
*
|
|
1367
|
-
*
|
|
1368
|
-
*
|
|
1370
|
+
* When set, revealed change is captured as a bucket on the workspace under this name
|
|
1371
|
+
* instead of being auto-deposited back to `revealedInput.source` — see
|
|
1372
|
+
* {@link toRevealedOutputAsBucket}.
|
|
1369
1373
|
*/
|
|
1370
1374
|
private revealedOutputBucketVar;
|
|
1375
|
+
/**
|
|
1376
|
+
* Extra instructions appended after the native `StealthTransfer` instruction (and its
|
|
1377
|
+
* change-bucket handling), in the same transaction — see {@link andThen}. Lets a caller
|
|
1378
|
+
* chain e.g. a custom contract call that consumes the bucket saved by
|
|
1379
|
+
* {@link toRevealedOutputAsBucket}, all signed together by the authorizer in one
|
|
1380
|
+
* transaction instead of needing a separate one.
|
|
1381
|
+
*/
|
|
1382
|
+
private followUpInstructions;
|
|
1383
|
+
/**
|
|
1384
|
+
* The public key allowed to take the revealed output — see {@link withRevealedReceiver}.
|
|
1385
|
+
*/
|
|
1386
|
+
private revealedReceiver;
|
|
1371
1387
|
/**
|
|
1372
1388
|
* @param provider - Read-only chain access (used by {@link prepare} to resolve inputs).
|
|
1373
1389
|
* @param resourceAddress - The resource being transferred.
|
|
@@ -1394,32 +1410,40 @@ export declare class StealthTransfer {
|
|
|
1394
1410
|
*/
|
|
1395
1411
|
toRevealedOutput(amount: bigint): this;
|
|
1396
1412
|
/**
|
|
1397
|
-
* Like {@link toRevealedOutput}, but
|
|
1398
|
-
* `
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1401
|
-
*
|
|
1402
|
-
*
|
|
1413
|
+
* Like {@link toRevealedOutput}, but instead of auto-depositing the change back into
|
|
1414
|
+
* `revealedInput.source`, the `StealthTransfer` instruction's bucket output is left on the
|
|
1415
|
+
* workspace under `workspaceVarName` for {@link andThen}'s instructions (or a caller-supplied
|
|
1416
|
+
* `withBuilder` continuation) to consume directly — e.g. passing it straight into a custom
|
|
1417
|
+
* contract call in the same transaction, rather than requiring a second transaction that
|
|
1418
|
+
* withdraws it back out again (which a plain `CallMethod withdraw` on a Stealth-typed vault
|
|
1419
|
+
* cannot do standalone — see this class's own `emitInstructions` doc comment: the account
|
|
1420
|
+
* template's `withdraw` only produces a valid bucket when paired with the native
|
|
1421
|
+
* `StealthTransfer` instruction in the same transaction).
|
|
1403
1422
|
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1423
|
+
* A real `toStealthOutput` is still required elsewhere on this builder (`validate()` enforces
|
|
1424
|
+
* it): the bundled `ootle-wasm@0.37.0` signer cannot parse a statement with zero stealth
|
|
1425
|
+
* outputs at all — confirmed live, `signTransaction`'s own WASM call throws the generic "did
|
|
1426
|
+
* not match any variant of untagged enum TransactionInput" error regardless of how
|
|
1427
|
+
* `balance_proof` is represented. A small dust self-output (as `OotleAccount.
|
|
1428
|
+
* withdrawStealthAndExecute` in tari-wallet-extension does) satisfies this cheaply.
|
|
1406
1429
|
*
|
|
1407
|
-
* @throws {InvalidArgumentError} if `amount` is not `> 0
|
|
1408
|
-
* already set by an earlier call.
|
|
1430
|
+
* @throws {InvalidArgumentError} if `amount` is not `> 0`.
|
|
1409
1431
|
*/
|
|
1410
1432
|
toRevealedOutputAsBucket(amount: bigint, workspaceVarName: string): this;
|
|
1411
1433
|
/**
|
|
1412
|
-
*
|
|
1413
|
-
*
|
|
1414
|
-
*
|
|
1415
|
-
*
|
|
1434
|
+
* Name the public key allowed to take the revealed output (tari-ootle#2645). The engine
|
|
1435
|
+
* requires that key's badge in the transaction's auth scope before it creates the revealed
|
|
1436
|
+
* bucket, so it must be a key that signs the transaction — normally the account key, which
|
|
1437
|
+
* {@link WalletStealthAuthorizer} signs with by default. Required whenever the transfer has a
|
|
1438
|
+
* revealed output ({@link toRevealedOutput} / {@link toRevealedOutputAsBucket}).
|
|
1416
1439
|
*
|
|
1417
|
-
*
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
*
|
|
1422
|
-
*
|
|
1440
|
+
* @throws {InvalidArgumentError} if `publicKey` is not 32 bytes.
|
|
1441
|
+
*/
|
|
1442
|
+
withRevealedReceiver(publicKey: Uint8Array): this;
|
|
1443
|
+
/**
|
|
1444
|
+
* Append `instructions` after the native `StealthTransfer` instruction (and its bucket
|
|
1445
|
+
* handling), so they run in the same signed transaction — typically consuming the bucket
|
|
1446
|
+
* {@link toRevealedOutputAsBucket} saved to the workspace. Repeatable; each call appends.
|
|
1423
1447
|
*/
|
|
1424
1448
|
andThen(instructions: Instruction[]): this;
|
|
1425
1449
|
/**
|
|
@@ -1840,8 +1864,13 @@ export declare class TransactionBuilder {
|
|
|
1840
1864
|
* Note this REPLACES any fee instructions already set, as it always has.
|
|
1841
1865
|
*/
|
|
1842
1866
|
withFeeInstructionsBuilder(builder: (b: TransactionBuilder) => TransactionBuilder): this;
|
|
1843
|
-
|
|
1844
|
-
|
|
1867
|
+
/**
|
|
1868
|
+
* Declare a transaction input. Since tari-ootle#2640 every input declares read or write
|
|
1869
|
+
* intent; a plain {@link SubstateRequirement} (no `is_write`) is declared a **write**, the
|
|
1870
|
+
* engine's own default — over-declaring only locks more, under-declaring aborts execution.
|
|
1871
|
+
*/
|
|
1872
|
+
addInput(input: SubstateRequirement | InputDeclaration): this;
|
|
1873
|
+
withInputs(inputs: (SubstateRequirement | InputDeclaration)[]): this;
|
|
1845
1874
|
/** @throws {InvalidArgumentError} if `minEpoch` is not a non-negative integer. */
|
|
1846
1875
|
withMinEpoch(minEpoch: number): this;
|
|
1847
1876
|
/**
|
|
@@ -2076,7 +2105,7 @@ export declare class WasmStealthCrypto implements StealthCryptoProvider {
|
|
|
2076
2105
|
*/
|
|
2077
2106
|
private readonly network;
|
|
2078
2107
|
constructor(network?: Network);
|
|
2079
|
-
generateOutputsStatement(specs: Output[], revealedOutputAmount: bigint): Promise<{
|
|
2108
|
+
generateOutputsStatement(specs: Output[], revealedOutputAmount: bigint, revealedReceiver?: Uint8Array): Promise<{
|
|
2080
2109
|
statement: StealthOutputsStatement;
|
|
2081
2110
|
outputMask: Mask;
|
|
2082
2111
|
}>;
|