@chironbuilder/ootle-sdk 0.1.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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/dist/accountApi.d.ts +33 -0
  4. package/dist/accountApi.d.ts.map +1 -0
  5. package/dist/accountApi.js +1 -0
  6. package/dist/adapters.d.ts +13 -0
  7. package/dist/adapters.d.ts.map +1 -0
  8. package/dist/adapters.js +68 -0
  9. package/dist/componentAddress.d.ts +27 -0
  10. package/dist/componentAddress.d.ts.map +1 -0
  11. package/dist/componentAddress.js +68 -0
  12. package/dist/confidential.d.ts +50 -0
  13. package/dist/confidential.d.ts.map +1 -0
  14. package/dist/confidential.js +86 -0
  15. package/dist/derivation.d.ts +7 -0
  16. package/dist/derivation.d.ts.map +1 -0
  17. package/dist/derivation.js +47 -0
  18. package/dist/domainHash.d.ts +11 -0
  19. package/dist/domainHash.d.ts.map +1 -0
  20. package/dist/domainHash.js +44 -0
  21. package/dist/htlc.d.ts +26 -0
  22. package/dist/htlc.d.ts.map +1 -0
  23. package/dist/htlc.js +69 -0
  24. package/dist/index.d.ts +21 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +14 -0
  27. package/dist/ootleNetwork.d.ts +4 -0
  28. package/dist/ootleNetwork.d.ts.map +1 -0
  29. package/dist/ootleNetwork.js +11 -0
  30. package/dist/ownershipProof.d.ts +4 -0
  31. package/dist/ownershipProof.d.ts.map +1 -0
  32. package/dist/ownershipProof.js +53 -0
  33. package/dist/storage.d.ts +61 -0
  34. package/dist/storage.d.ts.map +1 -0
  35. package/dist/storage.js +110 -0
  36. package/dist/timeout.d.ts +2 -0
  37. package/dist/timeout.d.ts.map +1 -0
  38. package/dist/timeout.js +19 -0
  39. package/dist/vault.d.ts +12 -0
  40. package/dist/vault.d.ts.map +1 -0
  41. package/dist/vault.js +44 -0
  42. package/dist/wallet.d.ts +733 -0
  43. package/dist/wallet.d.ts.map +1 -0
  44. package/dist/wallet.js +1964 -0
  45. package/package.json +46 -0
  46. package/vendor/ootle-patched/README.md +67 -0
  47. package/vendor/ootle-patched/dist/index.d.ts +2129 -0
  48. package/vendor/ootle-patched/dist/index.js +1365 -0
  49. package/vendor/ootle-patched/package.json +23 -0
  50. package/vendor/ootle-wasm-patched/README.md +128 -0
  51. package/vendor/ootle-wasm-patched/ootle_wasm.d.ts +454 -0
  52. package/vendor/ootle-wasm-patched/ootle_wasm.js +9 -0
  53. package/vendor/ootle-wasm-patched/ootle_wasm_bg.js +1485 -0
  54. package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm +0 -0
  55. package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm.d.ts +83 -0
  56. package/vendor/ootle-wasm-patched/package.json +27 -0
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@chironbuilder/ootle-sdk",
3
+ "version": "0.1.0",
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
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/chironbuilds/ootle-sdk-ts.git"
10
+ },
11
+ "homepage": "https://github.com/chironbuilds/ootle-sdk-ts",
12
+ "keywords": ["tari", "ootle", "wallet", "blockchain", "web3"],
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./adapters": {
21
+ "types": "./dist/adapters.d.ts",
22
+ "default": "./dist/adapters.js"
23
+ }
24
+ },
25
+ "files": ["dist", "vendor"],
26
+ "scripts": {
27
+ "build": "tsc -p tsconfig.build.json",
28
+ "typecheck": "tsc --noEmit",
29
+ "test": "vitest run",
30
+ "prepublishOnly": "npm run build"
31
+ },
32
+ "dependencies": {
33
+ "@noble/curves": "^1.9.0",
34
+ "@noble/hashes": "^2.2.0",
35
+ "@tari-project/ootle": "file:./vendor/ootle-patched",
36
+ "@tari-project/ootle-indexer": "^0.3.0",
37
+ "@tari-project/ootle-secret-key-wallet": "^0.3.0",
38
+ "@tari-project/ootle-ts-bindings": "^1.49.1",
39
+ "@tari-project/ootle-wasm": "file:./vendor/ootle-wasm-patched"
40
+ },
41
+ "devDependencies": {
42
+ "@types/chrome": "^0.0.280",
43
+ "typescript": "^5.6.0",
44
+ "vitest": "^4.1.0"
45
+ }
46
+ }
@@ -0,0 +1,67 @@
1
+ # Patched `@tari-project/ootle` (temporary, remove once upstream releases a fix)
2
+
3
+ Rebased 2026-08-20 onto `tari-project/ootle.ts`'s `main` branch at commit `1f2e8b2`
4
+ ("feat(deps)!: upgrade the tari package set to the 0.39 protocol (#123)") — the same commit the
5
+ officially published `@tari-project/ootle@0.3.0` npm release was built from (confirmed: identical
6
+ `version` field, identical `covenant_claims` hardcoding when diffed against the published tarball).
7
+ This is a source rebase, not a re-derivation from scratch — the previous vendor copy (built
8
+ 2026-08-06 from a since-unknown `ootle.ts` `main` commit `2bc5e93e`) carried one patch that no
9
+ longer applies and one that still does:
10
+
11
+ 1. ~~One line changed in `packages/ootle/src/stealth/statements.ts` to always include
12
+ `"covenant_claims":[]`~~ — **no longer needed**. Confirmed by grepping the real, published
13
+ `@tari-project/ootle@0.3.0` dist: it already includes `"covenant_claims":[]` unconditionally.
14
+ Upstream picked this up independently at some point after the original 2026-08-06 patch. This
15
+ remains correct for every transfer this wallet builds today, including the HTLC claim/refund
16
+ this rebase was done to unblock — `covenant_claims` is only ever read by
17
+ `SpendScriptExecution::covenant_balanced`, reached only from a `Covenant::BalancePreserved`
18
+ leaf or a `TemplateFunction` calling `SpendContext::covenant_balanced`; a revealed
19
+ `HashLock`/`AfterEpoch`/`AccessRule` leaf (what every HTLC leaf in `src/lib/htlc.ts` is) never
20
+ touches it (confirmed against `tari-project/tari-ootle#2431`'s own review discussion, where a
21
+ maintainer caught an earlier PR description overclaiming this field was "required whenever a
22
+ script-path input is spent").
23
+
24
+ 2. `packages/ootle/src/stealth/transfer.ts`'s `StealthTransfer` builder still needs its two
25
+ wallet-specific public methods, `toRevealedOutputAsBucket(amount, workspaceVarName)` and
26
+ `andThen(instructions)` — **re-applied on top of the current source**, still absent upstream
27
+ (confirmed: `grep -c toRevealedOutputAsBucket` on the fresh `ootle.ts` checkout before
28
+ patching was 0). Upstream's `toRevealedOutput()` always auto-deposits the revealed change back
29
+ into the source account — there's no way to get it as a bucket a caller can route elsewhere.
30
+ The patched methods leave it on the workspace instead and let extra instructions run in the
31
+ *same* signed transaction, consuming that bucket. This exists because a third-party dApp (or
32
+ this wallet's own `withdrawStealthAndExecute`) cannot move Stealth-typed funds (e.g. XTR) into
33
+ its own contract call at all otherwise — a plain `CallMethod withdraw` on a Stealth vault is
34
+ not a standalone-valid instruction; moving Stealth funds anywhere always requires the native
35
+ `StealthTransfer` instruction, paired with `WalletStealthAuthorizer` to sign it — which
36
+ `account.execute()`/plain `TransactionBuilder` never invokes. See `withdrawStealthAndExecute`
37
+ in `src/lib/wallet.ts` for the wallet-side method that uses this. Full method docs are inline
38
+ in `transfer.ts` itself now (copied into this package's own `dist/index.d.ts`).
39
+
40
+ **Why this rebase happened now**: `@tari-project/ootle-wasm@0.39.0`/`0.39.1` are real, officially
41
+ published releases (not a moving branch HEAD) that finally include
42
+ `buildScriptPathWitness`/`buildStealthInputsStatementFromInputs`/`buildStealthTransferStatement`
43
+ (`tari-project/tari-ootle#2426`, `#2431`) — the primitives `OotleAccount.htlcClaim`/`htlcRefund`
44
+ need. Picking those up meant moving off the old `^0.37.0` pin, which meant rebuilding this vendor
45
+ copy against a source tree consistent with the new wasm version rather than continuing to build
46
+ against the stale 2026-08-06 base.
47
+
48
+ **Verified before landing**: `packages/ootle`'s own `tsc -b` and `vite build` both clean against
49
+ this patch; its non-wasm-dependent test files (240 tests across 17 files) pass unchanged. Its
50
+ wasm-dependent test files fail to even load in this build environment with
51
+ `TypeError: filename must be a file URL... Received 'file:///__vite-plugin-wasm-helper'` —
52
+ confirmed via `git stash` that this happens identically on the *unpatched* upstream source, so
53
+ it's a pre-existing `vite-plugin-wasm`/Node version environment issue, not something this patch
54
+ introduced or something this patch's correctness can be judged by. `tari-wallet`'s own test suite
55
+ (a different vitest config) is the real correctness check for this vendor copy — see this repo's
56
+ top-level `README.md` / commit history for that result.
57
+
58
+ To rebuild after further edits: clone `tari-project/ootle.ts` fresh, re-apply the
59
+ `toRevealedOutputAsBucket`/`andThen` patch to `packages/ootle/src/stealth/transfer.ts` (diff
60
+ against this vendored `dist/index.d.ts` if the patch itself is lost), then
61
+ `cd packages/ootle && pnpm install && npx tsc -b && npx vite build`, and copy `dist/index.js` +
62
+ `dist/index.d.ts` into this directory's `dist/`.
63
+
64
+ Delete `vendor/ootle-patched/` and the `pnpm-workspace.yaml` override once `@tari-project/ootle`
65
+ publishes a release that includes fix 2 (fix 1 is already moot) — re-verify shield/unshield *and*
66
+ the bucket-output/`andThen` capability (and, once built, HTLC claim/refund) against whatever
67
+ version ships, since fix 2 still has no upstream equivalent and would need to be proposed there.