@zelana/sdk 0.1.0 → 0.1.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,gBAAgB,EAEhB,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;gBAEzB,MAAM,EAAE,eAAe;YAUrB,OAAO;YAuDP,GAAG;YAIH,IAAI;IAQlB;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC;IAanC;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAe1C;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC;IAehD;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC;IA2BtC;;OAEG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,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,GAAG,IAAI,CAAC;IAkB7D;;OAEG;IACG,WAAW,CACf,MAAM,GAAE,gBAAqB,GAC5B,OAAO,CAAC;QAAE,OAAO,EAAE,YAAY,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAyBtD;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAmB/D;;OAEG;IACG,gBAAgB,CACpB,MAAM,GAAE,gBAAgB,GAAG;QACzB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;KACZ,GACL,OAAO,CAAC;QAAE,YAAY,EAAE,SAAS,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IA+BxD;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,aAAa,CAAC;IA6B5C;;;;;;;;;;OAUG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkBzE;;;;;;;;;OASG;IACG,OAAO,CAAC,YAAY,GAAE,OAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CAcvE"}
package/dist/index.d.ts CHANGED
@@ -39,6 +39,7 @@
39
39
  export { ZelanaClient } from './zelana';
40
40
  export type { ZelanaClientConfig } from './zelana';
41
41
  export { Keypair, PublicKey } from './keypair';
42
+ export type { Signer } from './keypair';
42
43
  export { ApiClient } from './client';
43
44
  export type { ApiClientConfig } from './client';
44
45
  export type { Bytes32, AccountState, TxType, TxStatus, TxSummary, BatchStatus, BatchSummary, TransferRequest, TransferResponse, WithdrawRequest, WithdrawResponse, WithdrawalStatus, ShieldedRequest, ShieldedResponse, StateRoots, BatchStatusInfo, HealthInfo, GlobalStats, MerklePath, ScannedNote, FastWithdrawQuote, CommitteeMemberInfo, CommitteeInfo, PaginationParams, PaginatedResponse, DevDepositRequest, DevDepositResponse, DevSealRequest, DevSealResponse, ApiError, } from './types';
@@ -46,4 +47,6 @@ export { ZelanaError } from './types';
46
47
  export { shielded, ShieldedTransactionBuilder, generateShieldedKeys, shieldedKeysFromSpendingKey, createNote, noteWithRandomness, computeCommitment, computeNullifier, tryDecryptNote, } from './shielded';
47
48
  export type { Note, EncryptedNote, ShieldedKeys, ShieldedInput, ShieldedOutput, PreparedShieldedTx, ShieldedTransaction, ShieldedWitness, ScanResult, MerklePath as ShieldedMerklePath, } from './shielded';
48
49
  export { bytesToHex, hexToBytes, bytesToBase58, base58ToBytes, u64ToLeBytes, leBytesToU64, concatBytes, bytesEqual, randomBytes, } from './utils';
50
+ export { OwnershipProver, MockOwnershipProver, mockProver, getProver, computeOwnershipWitness, } from './prover';
51
+ export type { OwnershipWitness, OwnershipProof, DelegatedShieldedRequest, } from './prover';
49
52
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhD,YAAY,EAEV,OAAO,EACP,YAAY,EAGZ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EAGZ,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAGhB,UAAU,EACV,eAAe,EACf,UAAU,EACV,WAAW,EAGX,UAAU,EACV,WAAW,EAG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e,EACf,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAGhB,UAAU,EACV,eAAe,EACf,UAAU,EACV,WAAW,EAGX,UAAU,EACV,WAAW,EAGX,iBAAiB,EAGjB,mBAAmB,EACnB,aAAa,EAGb,gBAAgB,EAChB,iBAAiB,EAGjB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,eAAe,EAGf,QAAQ,GACT,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,OAAO,EACL,QAAQ,EACR,0BAA0B,EAC1B,oBAAoB,EACpB,2BAA2B,EAC3B,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,UAAU,IAAI,kBAAkB,GACjC,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,uBAAuB,GACxB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,wBAAwB,GACzB,MAAM,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,27 @@
1
+ var __create = Object.create;
2
+ var __getProtoOf = Object.getPrototypeOf;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __toESM = (mod, isNodeMode, target) => {
7
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
8
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
+ for (let key of __getOwnPropNames(mod))
10
+ if (!__hasOwnProp.call(to, key))
11
+ __defProp(to, key, {
12
+ get: () => mod[key],
13
+ enumerable: true
14
+ });
15
+ return to;
16
+ };
17
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
18
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
19
+ }) : x)(function(x) {
20
+ if (typeof require !== "undefined")
21
+ return require.apply(this, arguments);
22
+ throw Error('Dynamic require of "' + x + '" is not supported');
23
+ });
24
+
1
25
  // node_modules/@noble/ed25519/index.js
2
26
  /*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
3
27
  var ed25519_CURVE = {
@@ -1049,6 +1073,9 @@ class Keypair {
1049
1073
  return bytesToBase58(this.secretKey);
1050
1074
  }
1051
1075
  sign(message) {
1076
+ return Promise.resolve(sign(message, this.secretKey));
1077
+ }
1078
+ signSync(message) {
1052
1079
  return sign(message, this.secretKey);
1053
1080
  }
1054
1081
  static verify(signature, message, publicKey) {
@@ -1058,9 +1085,9 @@ class Keypair {
1058
1085
  return false;
1059
1086
  }
1060
1087
  }
1061
- signTransfer(to, amount, nonce, chainId = BigInt(1)) {
1088
+ async signTransfer(to, amount, nonce, chainId = BigInt(1)) {
1062
1089
  const message = concatBytes2(this._publicKey, to, u64ToLeBytes(amount), u64ToLeBytes(nonce), u64ToLeBytes(chainId));
1063
- const signature = this.sign(message);
1090
+ const signature = await this.sign(message);
1064
1091
  return {
1065
1092
  from: this.publicKey,
1066
1093
  to: new Uint8Array(to),
@@ -1071,9 +1098,9 @@ class Keypair {
1071
1098
  signerPubkey: this.publicKey
1072
1099
  };
1073
1100
  }
1074
- signWithdrawal(toL1Address, amount, nonce) {
1101
+ async signWithdrawal(toL1Address, amount, nonce) {
1075
1102
  const message = concatBytes2(this._publicKey, toL1Address, u64ToLeBytes(amount), u64ToLeBytes(nonce));
1076
- const signature = this.sign(message);
1103
+ const signature = await this.sign(message);
1077
1104
  return {
1078
1105
  from: this.publicKey,
1079
1106
  toL1Address: new Uint8Array(toL1Address),
@@ -1148,7 +1175,7 @@ class ApiClient {
1148
1175
  constructor(config) {
1149
1176
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
1150
1177
  this.timeout = config.timeout ?? 30000;
1151
- this.fetch = config.fetch ?? globalThis.fetch;
1178
+ this.fetch = config.fetch ? config.fetch : globalThis.fetch.bind(globalThis);
1152
1179
  }
1153
1180
  async request(method, path, body) {
1154
1181
  const url = `${this.baseUrl}${path}`;
@@ -1447,21 +1474,21 @@ function bigIntReviver(_key, value) {
1447
1474
  // src/zelana.ts
1448
1475
  class ZelanaClient {
1449
1476
  api;
1450
- keypair;
1477
+ signer;
1451
1478
  chainId;
1452
1479
  constructor(config) {
1453
1480
  this.api = new ApiClient(config);
1454
- this.keypair = config.keypair ?? null;
1481
+ this.signer = config.signer ?? config.keypair ?? null;
1455
1482
  this.chainId = config.chainId ?? BigInt(1);
1456
1483
  }
1457
1484
  get apiClient() {
1458
1485
  return this.api;
1459
1486
  }
1460
1487
  get publicKey() {
1461
- return this.keypair?.publicKey ?? null;
1488
+ return this.signer?.publicKey ?? null;
1462
1489
  }
1463
1490
  get publicKeyHex() {
1464
- return this.keypair?.publicKeyHex ?? null;
1491
+ return this.signer?.publicKeyHex ?? null;
1465
1492
  }
1466
1493
  async isHealthy() {
1467
1494
  try {
@@ -1484,10 +1511,10 @@ class ZelanaClient {
1484
1511
  return this.api.getStats();
1485
1512
  }
1486
1513
  async getAccount() {
1487
- if (!this.keypair) {
1488
- throw new ZelanaError("No keypair configured", "NO_KEYPAIR");
1514
+ if (!this.signer) {
1515
+ throw new ZelanaError("No signer configured", "NO_SIGNER");
1489
1516
  }
1490
- return this.api.getAccountByPubkey(this.keypair.publicKey);
1517
+ return this.api.getAccountByPubkey(this.signer.publicKey);
1491
1518
  }
1492
1519
  async getAccountFor(pubkey) {
1493
1520
  if (typeof pubkey === "string") {
@@ -1504,12 +1531,12 @@ class ZelanaClient {
1504
1531
  return account.nonce;
1505
1532
  }
1506
1533
  async transfer(to, amount, nonce) {
1507
- if (!this.keypair) {
1508
- throw new ZelanaError("No keypair configured", "NO_KEYPAIR");
1534
+ if (!this.signer) {
1535
+ throw new ZelanaError("No signer configured", "NO_SIGNER");
1509
1536
  }
1510
1537
  const toPubkey = typeof to === "string" ? new PublicKey(to).toBytes() : to;
1511
1538
  const txNonce = nonce ?? await this.getNonce();
1512
- const request = this.keypair.signTransfer(toPubkey, amount, txNonce, this.chainId);
1539
+ const request = await this.signer.signTransfer(toPubkey, amount, txNonce, this.chainId);
1513
1540
  return this.api.submitTransfer(request);
1514
1541
  }
1515
1542
  async transferAll(to, reserve = BigInt(0)) {
@@ -1521,12 +1548,12 @@ class ZelanaClient {
1521
1548
  return this.transfer(to, amount, account.nonce);
1522
1549
  }
1523
1550
  async withdraw(toL1Address, amount, nonce) {
1524
- if (!this.keypair) {
1525
- throw new ZelanaError("No keypair configured", "NO_KEYPAIR");
1551
+ if (!this.signer) {
1552
+ throw new ZelanaError("No signer configured", "NO_SIGNER");
1526
1553
  }
1527
1554
  const l1Pubkey = typeof toL1Address === "string" ? new PublicKey(toL1Address).toBytes() : toL1Address;
1528
1555
  const txNonce = nonce ?? await this.getNonce();
1529
- const request = this.keypair.signWithdrawal(l1Pubkey, amount, txNonce);
1556
+ const request = await this.signer.signWithdrawal(l1Pubkey, amount, txNonce);
1530
1557
  return this.api.submitWithdrawal(request);
1531
1558
  }
1532
1559
  async getWithdrawalStatus(txHash) {
@@ -1585,10 +1612,10 @@ class ZelanaClient {
1585
1612
  throw new ZelanaError(`Timeout waiting for batch ${batchId} to settle`, "TIMEOUT");
1586
1613
  }
1587
1614
  async devDeposit(amount) {
1588
- if (!this.keypair) {
1589
- throw new ZelanaError("No keypair configured", "NO_KEYPAIR");
1615
+ if (!this.signer) {
1616
+ throw new ZelanaError("No signer configured", "NO_SIGNER");
1590
1617
  }
1591
- return this.api.devDeposit(this.keypair.publicKeyHex, amount);
1618
+ return this.api.devDeposit(this.signer.publicKeyHex, amount);
1592
1619
  }
1593
1620
  async devDepositTo(to, amount) {
1594
1621
  const toHex = typeof to === "string" ? to : bytesToHex2(to);
@@ -1780,6 +1807,187 @@ var shielded = {
1780
1807
  computeNullifier,
1781
1808
  TransactionBuilder: ShieldedTransactionBuilder
1782
1809
  };
1810
+ // src/prover.ts
1811
+ class OwnershipProver {
1812
+ wasmModule = null;
1813
+ noirCircuit = null;
1814
+ backend = null;
1815
+ initialized = false;
1816
+ async init(options) {
1817
+ if (this.initialized) {
1818
+ return;
1819
+ }
1820
+ try {
1821
+ const wasmModule = await this.loadWasmModule(options?.wasmUrl);
1822
+ this.wasmModule = wasmModule;
1823
+ } catch (error) {
1824
+ throw new Error(`Failed to load ownership-prover WASM: ${error}`);
1825
+ }
1826
+ if (!options?.witnessOnly) {
1827
+ try {
1828
+ await this.loadNoirCircuit(options?.circuitUrl);
1829
+ } catch (error) {
1830
+ console.warn("Noir circuit not loaded, proof generation disabled:", error);
1831
+ }
1832
+ }
1833
+ this.initialized = true;
1834
+ }
1835
+ async loadWasmModule(wasmUrl) {
1836
+ try {
1837
+ const module = await import("zelana-ownership-prover");
1838
+ await module.default();
1839
+ return module;
1840
+ } catch {
1841
+ if (wasmUrl) {
1842
+ const importFn = new Function("url", "return import(url)");
1843
+ const module = await importFn(wasmUrl);
1844
+ await module.default();
1845
+ return module;
1846
+ }
1847
+ throw new Error("Could not load WASM module");
1848
+ }
1849
+ }
1850
+ async loadNoirCircuit(circuitUrl) {
1851
+ console.log("Noir circuit loading not yet implemented");
1852
+ this.noirCircuit = null;
1853
+ this.backend = null;
1854
+ }
1855
+ isInitialized() {
1856
+ return this.initialized;
1857
+ }
1858
+ canProve() {
1859
+ return this.initialized && this.noirCircuit !== null;
1860
+ }
1861
+ derivePublicKey(spendingKey) {
1862
+ this.ensureInitialized();
1863
+ const hex = this.wasmModule.derivePublicKey(bytesToHex2(spendingKey));
1864
+ return hexToBytes2(hex);
1865
+ }
1866
+ computeCommitment(ownerPk, value, blinding) {
1867
+ this.ensureInitialized();
1868
+ const hex = this.wasmModule.computeCommitment(bytesToHex2(ownerPk), value, bytesToHex2(blinding));
1869
+ return hexToBytes2(hex);
1870
+ }
1871
+ computeNullifier(spendingKey, commitment, position) {
1872
+ this.ensureInitialized();
1873
+ const hex = this.wasmModule.computeNullifier(bytesToHex2(spendingKey), bytesToHex2(commitment), position);
1874
+ return hexToBytes2(hex);
1875
+ }
1876
+ computeBlindedProxy(commitment, position) {
1877
+ this.ensureInitialized();
1878
+ const hex = this.wasmModule.computeBlindedProxy(bytesToHex2(commitment), position);
1879
+ return hexToBytes2(hex);
1880
+ }
1881
+ computeWitness(spendingKey, value, blinding, position) {
1882
+ this.ensureInitialized();
1883
+ return this.wasmModule.generateWitness(bytesToHex2(spendingKey), value, bytesToHex2(blinding), position);
1884
+ }
1885
+ verifyWitness(spendingKey, value, blinding, position, expectedCommitment, expectedNullifier, expectedProxy) {
1886
+ this.ensureInitialized();
1887
+ return this.wasmModule.verifyWitness(bytesToHex2(spendingKey), value, bytesToHex2(blinding), position, bytesToHex2(expectedCommitment), bytesToHex2(expectedNullifier), bytesToHex2(expectedProxy));
1888
+ }
1889
+ async prove(spendingKey, value, blinding, position) {
1890
+ this.ensureInitialized();
1891
+ if (!this.canProve()) {
1892
+ throw new Error("Noir circuit not loaded - proof generation unavailable");
1893
+ }
1894
+ const witness = this.computeWitness(spendingKey, value, blinding, position);
1895
+ throw new Error("Proof generation not yet implemented");
1896
+ }
1897
+ async verify(proof) {
1898
+ if (!this.canProve()) {
1899
+ throw new Error("Noir circuit not loaded - verification unavailable");
1900
+ }
1901
+ throw new Error("Proof verification not yet implemented");
1902
+ }
1903
+ ensureInitialized() {
1904
+ if (!this.initialized || !this.wasmModule) {
1905
+ throw new Error("Prover not initialized - call init() first");
1906
+ }
1907
+ }
1908
+ }
1909
+ var globalProver = null;
1910
+ async function getProver() {
1911
+ if (!globalProver) {
1912
+ globalProver = new OwnershipProver;
1913
+ await globalProver.init({ witnessOnly: true });
1914
+ }
1915
+ return globalProver;
1916
+ }
1917
+ async function computeOwnershipWitness(spendingKey, value, blinding, position) {
1918
+ const prover = await getProver();
1919
+ return prover.computeWitness(spendingKey, value, blinding, position);
1920
+ }
1921
+
1922
+ class MockOwnershipProver extends OwnershipProver {
1923
+ async init() {}
1924
+ isInitialized() {
1925
+ return true;
1926
+ }
1927
+ canProve() {
1928
+ return true;
1929
+ }
1930
+ derivePublicKey(spendingKey) {
1931
+ return this.mockHash("PK", spendingKey);
1932
+ }
1933
+ computeCommitment(ownerPk, value, blinding) {
1934
+ const valueBytes = new Uint8Array(8);
1935
+ new DataView(valueBytes.buffer).setBigUint64(0, value, true);
1936
+ return this.mockHash("CM", ownerPk, valueBytes, blinding);
1937
+ }
1938
+ computeNullifier(spendingKey, commitment, position) {
1939
+ const posBytes = new Uint8Array(8);
1940
+ new DataView(posBytes.buffer).setBigUint64(0, position, true);
1941
+ return this.mockHash("NF", spendingKey, commitment, posBytes);
1942
+ }
1943
+ computeBlindedProxy(commitment, position) {
1944
+ const posBytes = new Uint8Array(8);
1945
+ new DataView(posBytes.buffer).setBigUint64(0, position, true);
1946
+ return this.mockHash("BP", commitment, posBytes);
1947
+ }
1948
+ computeWitness(spendingKey, value, blinding, position) {
1949
+ const ownerPk = this.derivePublicKey(spendingKey);
1950
+ const commitment = this.computeCommitment(ownerPk, value, blinding);
1951
+ const nullifier = this.computeNullifier(spendingKey, commitment, position);
1952
+ const blindedProxy = this.computeBlindedProxy(commitment, position);
1953
+ return {
1954
+ ownerPk: bytesToHex2(ownerPk),
1955
+ commitment: bytesToHex2(commitment),
1956
+ nullifier: bytesToHex2(nullifier),
1957
+ blindedProxy: bytesToHex2(blindedProxy)
1958
+ };
1959
+ }
1960
+ async prove(spendingKey, value, blinding, position) {
1961
+ const witness = this.computeWitness(spendingKey, value, blinding, position);
1962
+ const fakeProof = this.mockHash("PROOF", hexToBytes2(witness.commitment), hexToBytes2(witness.nullifier));
1963
+ return {
1964
+ proof: fakeProof,
1965
+ publicInputs: {
1966
+ commitment: hexToBytes2(witness.commitment),
1967
+ nullifier: hexToBytes2(witness.nullifier),
1968
+ blindedProxy: hexToBytes2(witness.blindedProxy)
1969
+ }
1970
+ };
1971
+ }
1972
+ mockHash(domain, ...inputs) {
1973
+ const domainBytes = new TextEncoder().encode(domain);
1974
+ const combined = new Uint8Array(domainBytes.length + inputs.reduce((acc, i) => acc + i.length, 0));
1975
+ let offset = 0;
1976
+ combined.set(domainBytes, offset);
1977
+ offset += domainBytes.length;
1978
+ for (const input of inputs) {
1979
+ combined.set(input, offset);
1980
+ offset += input.length;
1981
+ }
1982
+ const result = new Uint8Array(32);
1983
+ for (let i = 0;i < combined.length; i++) {
1984
+ result[i % 32] ^= combined[i];
1985
+ result[(i + 1) % 32] ^= combined[i] << 4 | combined[i] >> 4;
1986
+ }
1987
+ return result;
1988
+ }
1989
+ }
1990
+ var mockProver = new MockOwnershipProver;
1783
1991
  export {
1784
1992
  u64ToLeBytes,
1785
1993
  tryDecryptNote,
@@ -1787,11 +1995,14 @@ export {
1787
1995
  shielded,
1788
1996
  randomBytes2 as randomBytes,
1789
1997
  noteWithRandomness,
1998
+ mockProver,
1790
1999
  leBytesToU64,
1791
2000
  hexToBytes2 as hexToBytes,
2001
+ getProver,
1792
2002
  generateShieldedKeys,
1793
2003
  createNote,
1794
2004
  concatBytes2 as concatBytes,
2005
+ computeOwnershipWitness,
1795
2006
  computeNullifier,
1796
2007
  computeCommitment,
1797
2008
  bytesToHex2 as bytesToHex,
@@ -1802,6 +2013,8 @@ export {
1802
2013
  ZelanaClient,
1803
2014
  ShieldedTransactionBuilder,
1804
2015
  PublicKey,
2016
+ OwnershipProver,
2017
+ MockOwnershipProver,
1805
2018
  Keypair,
1806
2019
  ApiClient
1807
2020
  };
package/dist/keypair.d.ts CHANGED
@@ -4,13 +4,36 @@
4
4
  * Provides key generation, import/export, and transaction signing.
5
5
  */
6
6
  import type { Bytes32, TransferRequest, WithdrawRequest } from './types';
7
+ /**
8
+ * Signer interface for L2 transactions.
9
+ *
10
+ * This allows using different signing mechanisms:
11
+ * - Keypair (local Ed25519 key)
12
+ * - WalletSigner (external wallet like Solana wallet)
13
+ */
14
+ export interface Signer {
15
+ /** The public key as 32 bytes */
16
+ readonly publicKey: Bytes32;
17
+ /** The public key as hex string */
18
+ readonly publicKeyHex: string;
19
+ /** The public key as base58 (Solana format) */
20
+ readonly publicKeyBase58: string;
21
+ /** Sign a message and return the 64-byte signature */
22
+ sign(message: Uint8Array): Promise<Uint8Array>;
23
+ /** Sign a transfer and return the signed request */
24
+ signTransfer(to: Bytes32, amount: bigint, nonce: bigint, chainId?: bigint): Promise<TransferRequest>;
25
+ /** Sign a withdrawal and return the signed request */
26
+ signWithdrawal(toL1Address: Bytes32, amount: bigint, nonce: bigint): Promise<WithdrawRequest>;
27
+ }
7
28
  /**
8
29
  * Zelana Keypair for L2 transactions
9
30
  *
10
31
  * Wraps an Ed25519 keypair and provides signing methods for
11
32
  * transfers, withdrawals, and other L2 operations.
33
+ *
34
+ * Implements the Signer interface.
12
35
  */
13
- export declare class Keypair {
36
+ export declare class Keypair implements Signer {
14
37
  private readonly secretKey;
15
38
  private readonly _publicKey;
16
39
  private constructor();
@@ -53,7 +76,11 @@ export declare class Keypair {
53
76
  /**
54
77
  * Sign arbitrary message bytes
55
78
  */
56
- sign(message: Uint8Array): Uint8Array;
79
+ sign(message: Uint8Array): Promise<Uint8Array>;
80
+ /**
81
+ * Sign synchronously (for internal use or when async is not needed)
82
+ */
83
+ signSync(message: Uint8Array): Uint8Array;
57
84
  /**
58
85
  * Verify a signature (static method)
59
86
  */
@@ -68,7 +95,7 @@ export declare class Keypair {
68
95
  * - nonce: u64 (little-endian)
69
96
  * - chain_id: u64 (little-endian)
70
97
  */
71
- signTransfer(to: Bytes32, amount: bigint, nonce: bigint, chainId?: bigint): TransferRequest;
98
+ signTransfer(to: Bytes32, amount: bigint, nonce: bigint, chainId?: bigint): Promise<TransferRequest>;
72
99
  /**
73
100
  * Sign a withdrawal request
74
101
  *
@@ -78,7 +105,7 @@ export declare class Keypair {
78
105
  * - amount: u64 (little-endian)
79
106
  * - nonce: u64 (little-endian)
80
107
  */
81
- signWithdrawal(toL1Address: Bytes32, amount: bigint, nonce: bigint): WithdrawRequest;
108
+ signWithdrawal(toL1Address: Bytes32, amount: bigint, nonce: bigint): Promise<WithdrawRequest>;
82
109
  }
83
110
  /**
84
111
  * PublicKey wrapper for address representation
@@ -1 +1 @@
1
- {"version":3,"file":"keypair.d.ts","sourceRoot":"","sources":["../src/keypair.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAKzE;;;;;GAKG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC,OAAO;IAKP;;OAEG;IACH,MAAM,CAAC,QAAQ,IAAI,OAAO;IAM1B;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO;IAQpD;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIpC;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAI1C;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED;;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AE,UAAU,GAAG,OAAO;IAQzF;;;;;;;;;OASG;IACG,YAAY,CAChB,EAAE,EAAE,OAAO,EACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAkB,GAC1B,OAAO,CAAC,eAAe,CAAC;IAuB3B;;;;;;;;OAQG;IACG,cAAc,CAClB,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,eAAe,CAAC;CAoB5B;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;gBAEvB,KAAK,EAAE,UAAU,GAAG,MAAM;IAsBtC;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,KAAK,IAAI,MAAM;IAIf;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO;CAQ/C"}
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Ownership Prover - Client-Side ZK Proof Generation
3
+ *
4
+ * This module provides the client-side proving functionality for Split Proving.
5
+ * Users generate lightweight ownership proofs in their browser, which are then
6
+ * verified by the sequencer and enhanced with Merkle proofs by the Swarm.
7
+ *
8
+ * Architecture:
9
+ * 1. User computes witness using WASM MiMC (matches Noir circuit exactly)
10
+ * 2. User generates ownership proof using Noir WASM prover (~500ms)
11
+ * 3. Proof is sent to sequencer for verification and batching
12
+ * 4. Swarm generates validity proof with Merkle membership (heavy work)
13
+ */
14
+ import type { Bytes32 } from './types';
15
+ /**
16
+ * Witness data computed from private inputs
17
+ */
18
+ export interface OwnershipWitness {
19
+ /** Owner's derived public key (32 bytes hex) */
20
+ ownerPk: string;
21
+ /** Note commitment (32 bytes hex) */
22
+ commitment: string;
23
+ /** Nullifier revealed when spending (32 bytes hex) */
24
+ nullifier: string;
25
+ /** Blinded proxy for swarm delegation (32 bytes hex) */
26
+ blindedProxy: string;
27
+ }
28
+ /**
29
+ * Complete ownership proof ready for submission
30
+ */
31
+ export interface OwnershipProof {
32
+ /** The ZK proof bytes */
33
+ proof: Uint8Array;
34
+ /** Public inputs to the circuit */
35
+ publicInputs: {
36
+ commitment: Bytes32;
37
+ nullifier: Bytes32;
38
+ blindedProxy: Bytes32;
39
+ };
40
+ }
41
+ /**
42
+ * Request to submit a delegated shielded transaction
43
+ */
44
+ export interface DelegatedShieldedRequest {
45
+ /** Ownership proof (serialized) */
46
+ ownershipProof: Uint8Array;
47
+ /** Nullifier being spent */
48
+ nullifier: Bytes32;
49
+ /** Input commitment */
50
+ commitment: Bytes32;
51
+ /** Blinded proxy for swarm lookup */
52
+ blindedProxy: Bytes32;
53
+ /** Output commitment for new note */
54
+ outputCommitment: Bytes32;
55
+ /** Encrypted note data */
56
+ ciphertext: Uint8Array;
57
+ /** Ephemeral key for decryption */
58
+ ephemeralKey: Bytes32;
59
+ }
60
+ /**
61
+ * OwnershipProver handles client-side ownership proof generation.
62
+ *
63
+ * This class:
64
+ * 1. Loads the WASM module for MiMC hash computation
65
+ * 2. Loads the Noir circuit for proof generation
66
+ * 3. Provides methods to compute witnesses and generate proofs
67
+ *
68
+ * Usage:
69
+ * ```typescript
70
+ * const prover = new OwnershipProver();
71
+ * await prover.init();
72
+ *
73
+ * // Compute witness from private inputs
74
+ * const witness = prover.computeWitness(spendingKey, value, blinding, position);
75
+ *
76
+ * // Generate proof
77
+ * const proof = await prover.prove(spendingKey, value, blinding, position);
78
+ * ```
79
+ */
80
+ export declare class OwnershipProver {
81
+ private wasmModule;
82
+ private noirCircuit;
83
+ private backend;
84
+ private initialized;
85
+ /**
86
+ * Initialize the prover
87
+ *
88
+ * This loads:
89
+ * 1. The ownership-prover WASM module (MiMC hash)
90
+ * 2. The Noir circuit definition
91
+ * 3. The Barretenberg backend for proving
92
+ *
93
+ * @param options Configuration options
94
+ */
95
+ init(options?: {
96
+ /** URL to fetch WASM from (defaults to CDN) */
97
+ wasmUrl?: string;
98
+ /** URL to fetch circuit JSON from (defaults to CDN) */
99
+ circuitUrl?: string;
100
+ /** Skip Noir initialization (for witness-only mode) */
101
+ witnessOnly?: boolean;
102
+ }): Promise<void>;
103
+ /**
104
+ * Load the WASM module
105
+ */
106
+ private loadWasmModule;
107
+ /**
108
+ * Load the Noir circuit and backend
109
+ */
110
+ private loadNoirCircuit;
111
+ /**
112
+ * Check if the prover is initialized
113
+ */
114
+ isInitialized(): boolean;
115
+ /**
116
+ * Check if proof generation is available
117
+ */
118
+ canProve(): boolean;
119
+ /**
120
+ * Derive public key from spending key
121
+ *
122
+ * pk = MiMC_hash3(PK_DOMAIN, spending_key, 0)
123
+ */
124
+ derivePublicKey(spendingKey: Bytes32): Bytes32;
125
+ /**
126
+ * Compute note commitment
127
+ *
128
+ * commitment = MiMC_hash3(owner_pk, value, blinding)
129
+ */
130
+ computeCommitment(ownerPk: Bytes32, value: bigint, blinding: Bytes32): Bytes32;
131
+ /**
132
+ * Compute nullifier
133
+ *
134
+ * nullifier = MiMC_hash4(NULLIFIER_DOMAIN, spending_key, commitment, position)
135
+ */
136
+ computeNullifier(spendingKey: Bytes32, commitment: Bytes32, position: bigint): Bytes32;
137
+ /**
138
+ * Compute blinded proxy for swarm delegation
139
+ *
140
+ * blinded_proxy = MiMC_hash3(DELEGATE_DOMAIN, commitment, position)
141
+ */
142
+ computeBlindedProxy(commitment: Bytes32, position: bigint): Bytes32;
143
+ /**
144
+ * Compute complete witness from private inputs
145
+ *
146
+ * This computes all public outputs that will be revealed to the sequencer.
147
+ */
148
+ computeWitness(spendingKey: Bytes32, value: bigint, blinding: Bytes32, position: bigint): OwnershipWitness;
149
+ /**
150
+ * Verify that computed witness matches expected values
151
+ *
152
+ * Useful for debugging before generating a proof.
153
+ */
154
+ verifyWitness(spendingKey: Bytes32, value: bigint, blinding: Bytes32, position: bigint, expectedCommitment: Bytes32, expectedNullifier: Bytes32, expectedProxy: Bytes32): boolean;
155
+ /**
156
+ * Generate an ownership proof
157
+ *
158
+ * This is the main entry point for proof generation. It:
159
+ * 1. Computes the witness using WASM MiMC
160
+ * 2. Generates the Noir proof using Barretenberg
161
+ *
162
+ * @param spendingKey The user's spending key (secret)
163
+ * @param value The note value in lamports
164
+ * @param blinding Random blinding factor
165
+ * @param position Position in the commitment tree
166
+ * @returns The proof and public inputs
167
+ */
168
+ prove(spendingKey: Bytes32, value: bigint, blinding: Bytes32, position: bigint): Promise<OwnershipProof>;
169
+ /**
170
+ * Verify an ownership proof locally
171
+ *
172
+ * This is for debugging/testing. In production, the sequencer verifies proofs.
173
+ */
174
+ verify(proof: OwnershipProof): Promise<boolean>;
175
+ private ensureInitialized;
176
+ }
177
+ /**
178
+ * Get or create the global prover instance
179
+ */
180
+ export declare function getProver(): Promise<OwnershipProver>;
181
+ /**
182
+ * Compute witness using the global prover
183
+ */
184
+ export declare function computeOwnershipWitness(spendingKey: Bytes32, value: bigint, blinding: Bytes32, position: bigint): Promise<OwnershipWitness>;
185
+ /**
186
+ * MockOwnershipProver provides a fake prover for development.
187
+ *
188
+ * It generates deterministic "proofs" using SHA-256 instead of real ZK proofs.
189
+ * This is useful for:
190
+ * - Development without WASM setup
191
+ * - Testing the API flow
192
+ * - Benchmarking non-proof overhead
193
+ *
194
+ * WARNING: This does NOT provide any cryptographic security!
195
+ */
196
+ export declare class MockOwnershipProver extends OwnershipProver {
197
+ init(): Promise<void>;
198
+ isInitialized(): boolean;
199
+ canProve(): boolean;
200
+ derivePublicKey(spendingKey: Bytes32): Bytes32;
201
+ computeCommitment(ownerPk: Bytes32, value: bigint, blinding: Bytes32): Bytes32;
202
+ computeNullifier(spendingKey: Bytes32, commitment: Bytes32, position: bigint): Bytes32;
203
+ computeBlindedProxy(commitment: Bytes32, position: bigint): Bytes32;
204
+ computeWitness(spendingKey: Bytes32, value: bigint, blinding: Bytes32, position: bigint): OwnershipWitness;
205
+ prove(spendingKey: Bytes32, value: bigint, blinding: Bytes32, position: bigint): Promise<OwnershipProof>;
206
+ private mockHash;
207
+ }
208
+ export declare const mockProver: MockOwnershipProver;
209
+ //# sourceMappingURL=prover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prover.d.ts","sourceRoot":"","sources":["../src/prover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAOvC;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,yBAAyB;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,mCAAmC;IACnC,YAAY,EAAE;QACZ,UAAU,EAAE,OAAO,CAAC;QACpB,SAAS,EAAE,OAAO,CAAC;QACnB,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,mCAAmC;IACnC,cAAc,EAAE,UAAU,CAAC;IAC3B,4BAA4B;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,uBAAuB;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,qCAAqC;IACrC,YAAY,EAAE,OAAO,CAAC;IACtB,qCAAqC;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,0BAA0B;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,mCAAmC;IACnC,YAAY,EAAE,OAAO,CAAC;CACvB;AAmCD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,WAAW,CAAiB;IACpC,OAAO,CAAC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,MAAM,UAAU,qBAA4B,CAAC"}
package/dist/zelana.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * Combines keypair management and API client for a convenient developer experience.
5
5
  * This is the main entry point for interacting with Zelana L2.
6
6
  */
7
- import { Keypair } from './keypair';
7
+ import { Keypair, Signer } from './keypair';
8
8
  import { ApiClient, ApiClientConfig } from './client';
9
9
  import type { AccountState, TransferResponse, WithdrawResponse, HealthInfo, StateRoots, BatchStatusInfo, GlobalStats, TxSummary, BatchSummary, PaginationParams, DevDepositResponse, DevSealResponse } from './types';
10
10
  /**
@@ -44,17 +44,18 @@ export interface ZelanaClientConfig extends ApiClientConfig {
44
44
  */
45
45
  export declare class ZelanaClient {
46
46
  private readonly api;
47
- private readonly keypair;
47
+ private readonly signer;
48
48
  private readonly chainId;
49
49
  constructor(config: ZelanaClientConfig & {
50
50
  keypair?: Keypair;
51
+ signer?: Signer;
51
52
  });
52
53
  /**
53
54
  * Get the underlying API client for low-level operations
54
55
  */
55
56
  get apiClient(): ApiClient;
56
57
  /**
57
- * Get the public key of the configured keypair
58
+ * Get the public key of the configured signer
58
59
  */
59
60
  get publicKey(): Uint8Array | null;
60
61
  /**
@@ -82,7 +83,7 @@ export declare class ZelanaClient {
82
83
  */
83
84
  getStats(): Promise<GlobalStats>;
84
85
  /**
85
- * Get account state for the configured keypair
86
+ * Get account state for the configured signer
86
87
  */
87
88
  getAccount(): Promise<AccountState>;
88
89
  /**
@@ -179,11 +180,11 @@ export declare class ZelanaClient {
179
180
  * Simulate a deposit from L1 (DEV MODE ONLY)
180
181
  *
181
182
  * This method is only available when the sequencer is running with DEV_MODE=true.
182
- * It bypasses the L1 indexer and directly credits funds to the configured keypair's account.
183
+ * It bypasses the L1 indexer and directly credits funds to the configured signer's account.
183
184
  *
184
185
  * @param amount - Amount to deposit in lamports
185
186
  * @returns Deposit response with new balance
186
- * @throws ZelanaError if dev mode is not enabled (404) or no keypair configured
187
+ * @throws ZelanaError if dev mode is not enabled (404) or no signer configured
187
188
  */
188
189
  devDeposit(amount: bigint): Promise<DevDepositResponse>;
189
190
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"zelana.d.ts","sourceRoot":"","sources":["../src/zelana.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAa,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGtD,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,eAAe,EACf,WAAW,EACX,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAY;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,EAAE,kBAAkB,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;IAM9D;;OAEG;IACH,IAAI,SAAS,IAAI,SAAS,CAEzB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,UAAU,GAAG,IAAI,CAEjC;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,GAAG,IAAI,CAEhC;IAMD;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IASnC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC;IAInC;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAI1C;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC;IAIhD;;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BrB;;OAEG;IACG,YAAY,CAChB,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAe,EAC1B,cAAc,GAAE,MAAa,GAC5B,OAAO,CAAC,YAAY,CAAC;IA8BxB;;;;;;;;;OASG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAO7D;;;;;;;;;;OAUG;IACG,YAAY,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAKxF;;;;;;;;;OASG;IACG,OAAO,CAAC,YAAY,GAAE,OAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CAGvE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zelana/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "TypeScript SDK for Zelana L2",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -44,4 +44,4 @@
44
44
  "type": "git",
45
45
  "url": "https://github.com/zelana/zelana"
46
46
  }
47
- }
47
+ }