@unlink-xyz/core 0.1.5 → 0.1.6
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/account/account.d.ts +1 -1
- package/dist/account/account.d.ts.map +1 -1
- package/dist/browser/index.js +225 -67
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/wallet/index.js +224 -66
- package/dist/browser/wallet/index.js.map +1 -1
- package/dist/clients/http.d.ts.map +1 -1
- package/dist/config.d.ts +14 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +225 -67
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/async.js.map +1 -1
- package/dist/utils/validators.d.ts +1 -1
- package/dist/wallet/adapter.d.ts.map +1 -1
- package/dist/wallet/index.js +224 -66
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/sdk.d.ts +6 -7
- package/dist/wallet/sdk.d.ts.map +1 -1
- package/dist/wallet/types.d.ts +12 -14
- package/dist/wallet/types.d.ts.map +1 -1
- package/dist/wallet/unlink-wallet.d.ts +7 -8
- package/dist/wallet/unlink-wallet.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../account/account.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IAC5D,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;CAChE,CAAC;AAEF,MAA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B,GAAG,OAAO,CAAC,UAAU,CAAC,CAgCjD;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,gBAA2C,GAClD,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAK5B;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,UAAU,EAChB,MAAM,GAAE,gBAA2C,GAClD,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,gBAA2C,GAClD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUxB;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,EACzC,OAAO,EACP,QAAQ,EACR,MAAiC,EACjC,SAAiB,EACjB,QAAa,GACd,EAAE,2BAA2B,GAAG,OAAO,CAAC,UAAU,CAAC,CAenD;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,gBAA2C,GAClD,OAAO,CAAC,IAAI,CAAC,CASf"}
|
package/dist/browser/index.js
CHANGED
|
@@ -7512,9 +7512,9 @@ var bech32m = /* @__PURE__ */ genBech32("bech32m");
|
|
|
7512
7512
|
|
|
7513
7513
|
// keys/address.ts
|
|
7514
7514
|
var VERSION = 1;
|
|
7515
|
-
var LIMIT =
|
|
7515
|
+
var LIMIT = 130;
|
|
7516
7516
|
var ALL_CHAINS = "ffffffffffffffff";
|
|
7517
|
-
var PREFIX = "
|
|
7517
|
+
var PREFIX = "unlink";
|
|
7518
7518
|
var SALT = new TextEncoder().encode("unlink");
|
|
7519
7519
|
function xorWithSalt(hex2) {
|
|
7520
7520
|
const bytes2 = Hex.toBytes(hex2);
|
|
@@ -7660,7 +7660,7 @@ function parseZkAddress(value) {
|
|
|
7660
7660
|
};
|
|
7661
7661
|
} catch (err) {
|
|
7662
7662
|
throw new ValidationError(
|
|
7663
|
-
`Invalid ZK address (expected
|
|
7663
|
+
`Invalid ZK address (expected unlink1... format): ${err instanceof Error ? err.message : "unknown error"}`
|
|
7664
7664
|
);
|
|
7665
7665
|
}
|
|
7666
7666
|
}
|
|
@@ -34626,29 +34626,41 @@ function createJsonHttpClient(baseUrl, deps) {
|
|
|
34626
34626
|
fetch: fetchImpl,
|
|
34627
34627
|
// Disable ky's automatic error throwing to prevent browser DevTools
|
|
34628
34628
|
// from logging expected 404s as network errors
|
|
34629
|
-
throwHttpErrors: false
|
|
34629
|
+
throwHttpErrors: false,
|
|
34630
|
+
retry: 0
|
|
34630
34631
|
});
|
|
34632
|
+
const RETRYABLE_STATUSES = [502, 503, 504];
|
|
34633
|
+
const MAX_RETRIES = 3;
|
|
34634
|
+
const BASE_DELAY_MS = 500;
|
|
34631
34635
|
return {
|
|
34632
34636
|
async request(opts) {
|
|
34633
34637
|
let res;
|
|
34634
|
-
|
|
34635
|
-
|
|
34636
|
-
|
|
34637
|
-
|
|
34638
|
-
|
|
34639
|
-
|
|
34640
|
-
|
|
34641
|
-
|
|
34642
|
-
|
|
34643
|
-
|
|
34644
|
-
|
|
34645
|
-
|
|
34638
|
+
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
34639
|
+
try {
|
|
34640
|
+
res = await api(opts.path.replace(/^\//, ""), {
|
|
34641
|
+
method: opts.method,
|
|
34642
|
+
searchParams: opts.query,
|
|
34643
|
+
json: opts.json,
|
|
34644
|
+
body: opts.body,
|
|
34645
|
+
headers: opts.headers,
|
|
34646
|
+
signal: opts.signal
|
|
34647
|
+
});
|
|
34648
|
+
} catch (err) {
|
|
34649
|
+
if (err instanceof TimeoutError) {
|
|
34650
|
+
throw new HttpError("HTTP timeout", 408, null);
|
|
34651
|
+
}
|
|
34652
|
+
throw new HttpError(
|
|
34653
|
+
err instanceof Error ? err.message : "Network error",
|
|
34654
|
+
0,
|
|
34655
|
+
null
|
|
34656
|
+
);
|
|
34646
34657
|
}
|
|
34647
|
-
|
|
34648
|
-
|
|
34649
|
-
|
|
34650
|
-
|
|
34651
|
-
|
|
34658
|
+
if (RETRYABLE_STATUSES.includes(res.status) && attempt < MAX_RETRIES) {
|
|
34659
|
+
const delay2 = BASE_DELAY_MS * 2 ** attempt + Math.random() * 200;
|
|
34660
|
+
await new Promise((r2) => setTimeout(r2, delay2));
|
|
34661
|
+
continue;
|
|
34662
|
+
}
|
|
34663
|
+
break;
|
|
34652
34664
|
}
|
|
34653
34665
|
if (!res.ok) {
|
|
34654
34666
|
const body = await readErrorBodySafe(res);
|
|
@@ -34858,63 +34870,85 @@ var Runtime = {
|
|
|
34858
34870
|
|
|
34859
34871
|
// config.ts
|
|
34860
34872
|
var CONFIG_URL = "https://config.unlink.xyz/networks.json";
|
|
34861
|
-
function parseRequiredString(
|
|
34873
|
+
function parseRequiredString(chain2, field, value) {
|
|
34862
34874
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
34863
34875
|
throw new InitializationError(
|
|
34864
|
-
`Invalid SDK config for ${
|
|
34876
|
+
`Invalid SDK config for ${chain2}: ${field} must be a non-empty string`
|
|
34865
34877
|
);
|
|
34866
34878
|
}
|
|
34867
34879
|
return value.trim();
|
|
34868
34880
|
}
|
|
34869
|
-
function parseOptionalString(
|
|
34881
|
+
function parseOptionalString(chain2, field, value) {
|
|
34870
34882
|
if (value === void 0) return void 0;
|
|
34871
34883
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
34872
34884
|
throw new InitializationError(
|
|
34873
|
-
`Invalid SDK config for ${
|
|
34885
|
+
`Invalid SDK config for ${chain2}: ${field} must be a non-empty string when provided`
|
|
34874
34886
|
);
|
|
34875
34887
|
}
|
|
34876
34888
|
return value.trim();
|
|
34877
34889
|
}
|
|
34878
|
-
function
|
|
34890
|
+
function parseRequiredChainId(chain2, value) {
|
|
34891
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value <= 0) {
|
|
34892
|
+
throw new InitializationError(
|
|
34893
|
+
`Invalid SDK config for ${chain2}: chainId must be a positive integer`
|
|
34894
|
+
);
|
|
34895
|
+
}
|
|
34896
|
+
return value;
|
|
34897
|
+
}
|
|
34898
|
+
function parseChainConfig(chain2, value) {
|
|
34879
34899
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
34880
34900
|
throw new InitializationError(
|
|
34881
|
-
`Invalid SDK config for ${
|
|
34901
|
+
`Invalid SDK config for ${chain2}: expected object`
|
|
34882
34902
|
);
|
|
34883
34903
|
}
|
|
34884
34904
|
const raw = value;
|
|
34905
|
+
const chainId = parseRequiredChainId(chain2, raw.chainId);
|
|
34885
34906
|
const gatewayUrl = parseRequiredString(
|
|
34886
|
-
|
|
34907
|
+
chain2,
|
|
34887
34908
|
"gatewayUrl",
|
|
34888
34909
|
raw.gatewayUrl
|
|
34889
34910
|
).replace(/\/+$/, "");
|
|
34890
|
-
const poolAddress = parseRequiredString(
|
|
34911
|
+
const poolAddress = parseRequiredString(
|
|
34912
|
+
chain2,
|
|
34913
|
+
"poolAddress",
|
|
34914
|
+
raw.poolAddress
|
|
34915
|
+
);
|
|
34891
34916
|
const artifactVersion = parseRequiredString(
|
|
34892
|
-
|
|
34917
|
+
chain2,
|
|
34893
34918
|
"artifactVersion",
|
|
34894
34919
|
raw.artifactVersion
|
|
34895
34920
|
).replace(/^\/+|\/+$/g, "");
|
|
34921
|
+
const frostUrl = parseOptionalString(
|
|
34922
|
+
chain2,
|
|
34923
|
+
"frostUrl",
|
|
34924
|
+
raw.frostUrl
|
|
34925
|
+
)?.replace(/\/+$/, "");
|
|
34896
34926
|
const artifactBaseUrl = parseOptionalString(
|
|
34897
|
-
|
|
34927
|
+
chain2,
|
|
34898
34928
|
"artifactBaseUrl",
|
|
34899
34929
|
raw.artifactBaseUrl
|
|
34900
34930
|
)?.replace(/\/+$/, "");
|
|
34901
34931
|
return {
|
|
34932
|
+
chainId,
|
|
34902
34933
|
gatewayUrl,
|
|
34934
|
+
...frostUrl !== void 0 ? { frostUrl } : {},
|
|
34903
34935
|
poolAddress,
|
|
34904
34936
|
artifactVersion,
|
|
34905
34937
|
...artifactBaseUrl !== void 0 ? { artifactBaseUrl } : { artifactBaseUrl: DEFAULT_ARTIFACT_BASE_URL }
|
|
34906
34938
|
};
|
|
34907
34939
|
}
|
|
34908
|
-
async function
|
|
34940
|
+
async function fetchChainConfig(chain2) {
|
|
34909
34941
|
const res = await fetch(CONFIG_URL);
|
|
34910
34942
|
if (!res.ok) {
|
|
34911
34943
|
throw new InitializationError(`Failed to fetch SDK config: ${res.status}`);
|
|
34912
34944
|
}
|
|
34913
34945
|
const config2 = await res.json();
|
|
34914
|
-
if (!config2[
|
|
34915
|
-
throw new InitializationError(
|
|
34946
|
+
if (!config2[chain2]) {
|
|
34947
|
+
throw new InitializationError(
|
|
34948
|
+
`Unknown chain: "${chain2}". Supported chains: ${Object.keys(config2).join(", ")}`
|
|
34949
|
+
);
|
|
34916
34950
|
}
|
|
34917
|
-
return
|
|
34951
|
+
return parseChainConfig(chain2, config2[chain2]);
|
|
34918
34952
|
}
|
|
34919
34953
|
function createServiceConfig(gatewayUrl) {
|
|
34920
34954
|
const baseUrl = gatewayUrl.replace(/\/+$/, "");
|
|
@@ -52327,6 +52361,114 @@ var circuits_default = {
|
|
|
52327
52361
|
template: "JoinSplit",
|
|
52328
52362
|
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52329
52363
|
params: [5, 2, 16]
|
|
52364
|
+
},
|
|
52365
|
+
joinsplit_1x3_16: {
|
|
52366
|
+
file: "joinsplit",
|
|
52367
|
+
template: "JoinSplit",
|
|
52368
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52369
|
+
params: [1, 3, 16]
|
|
52370
|
+
},
|
|
52371
|
+
joinsplit_4x3_16: {
|
|
52372
|
+
file: "joinsplit",
|
|
52373
|
+
template: "JoinSplit",
|
|
52374
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52375
|
+
params: [4, 3, 16]
|
|
52376
|
+
},
|
|
52377
|
+
joinsplit_5x3_16: {
|
|
52378
|
+
file: "joinsplit",
|
|
52379
|
+
template: "JoinSplit",
|
|
52380
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52381
|
+
params: [5, 3, 16]
|
|
52382
|
+
},
|
|
52383
|
+
joinsplit_6x1_16: {
|
|
52384
|
+
file: "joinsplit",
|
|
52385
|
+
template: "JoinSplit",
|
|
52386
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52387
|
+
params: [6, 1, 16]
|
|
52388
|
+
},
|
|
52389
|
+
joinsplit_6x2_16: {
|
|
52390
|
+
file: "joinsplit",
|
|
52391
|
+
template: "JoinSplit",
|
|
52392
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52393
|
+
params: [6, 2, 16]
|
|
52394
|
+
},
|
|
52395
|
+
joinsplit_6x3_16: {
|
|
52396
|
+
file: "joinsplit",
|
|
52397
|
+
template: "JoinSplit",
|
|
52398
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52399
|
+
params: [6, 3, 16]
|
|
52400
|
+
},
|
|
52401
|
+
joinsplit_7x1_16: {
|
|
52402
|
+
file: "joinsplit",
|
|
52403
|
+
template: "JoinSplit",
|
|
52404
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52405
|
+
params: [7, 1, 16]
|
|
52406
|
+
},
|
|
52407
|
+
joinsplit_7x2_16: {
|
|
52408
|
+
file: "joinsplit",
|
|
52409
|
+
template: "JoinSplit",
|
|
52410
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52411
|
+
params: [7, 2, 16]
|
|
52412
|
+
},
|
|
52413
|
+
joinsplit_7x3_16: {
|
|
52414
|
+
file: "joinsplit",
|
|
52415
|
+
template: "JoinSplit",
|
|
52416
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52417
|
+
params: [7, 3, 16]
|
|
52418
|
+
},
|
|
52419
|
+
joinsplit_8x1_16: {
|
|
52420
|
+
file: "joinsplit",
|
|
52421
|
+
template: "JoinSplit",
|
|
52422
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52423
|
+
params: [8, 1, 16]
|
|
52424
|
+
},
|
|
52425
|
+
joinsplit_8x2_16: {
|
|
52426
|
+
file: "joinsplit",
|
|
52427
|
+
template: "JoinSplit",
|
|
52428
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52429
|
+
params: [8, 2, 16]
|
|
52430
|
+
},
|
|
52431
|
+
joinsplit_8x3_16: {
|
|
52432
|
+
file: "joinsplit",
|
|
52433
|
+
template: "JoinSplit",
|
|
52434
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52435
|
+
params: [8, 3, 16]
|
|
52436
|
+
},
|
|
52437
|
+
joinsplit_9x1_16: {
|
|
52438
|
+
file: "joinsplit",
|
|
52439
|
+
template: "JoinSplit",
|
|
52440
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52441
|
+
params: [9, 1, 16]
|
|
52442
|
+
},
|
|
52443
|
+
joinsplit_9x2_16: {
|
|
52444
|
+
file: "joinsplit",
|
|
52445
|
+
template: "JoinSplit",
|
|
52446
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52447
|
+
params: [9, 2, 16]
|
|
52448
|
+
},
|
|
52449
|
+
joinsplit_9x3_16: {
|
|
52450
|
+
file: "joinsplit",
|
|
52451
|
+
template: "JoinSplit",
|
|
52452
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52453
|
+
params: [9, 3, 16]
|
|
52454
|
+
},
|
|
52455
|
+
joinsplit_10x1_16: {
|
|
52456
|
+
file: "joinsplit",
|
|
52457
|
+
template: "JoinSplit",
|
|
52458
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52459
|
+
params: [10, 1, 16]
|
|
52460
|
+
},
|
|
52461
|
+
joinsplit_10x2_16: {
|
|
52462
|
+
file: "joinsplit",
|
|
52463
|
+
template: "JoinSplit",
|
|
52464
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52465
|
+
params: [10, 2, 16]
|
|
52466
|
+
},
|
|
52467
|
+
joinsplit_10x3_16: {
|
|
52468
|
+
file: "joinsplit",
|
|
52469
|
+
template: "JoinSplit",
|
|
52470
|
+
pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
|
|
52471
|
+
params: [10, 3, 16]
|
|
52330
52472
|
}
|
|
52331
52473
|
};
|
|
52332
52474
|
|
|
@@ -52346,7 +52488,7 @@ function getCircuitConfig(inputs, outputs) {
|
|
|
52346
52488
|
}
|
|
52347
52489
|
|
|
52348
52490
|
// prover/prover.ts
|
|
52349
|
-
var MAX_ARTIFACT_CACHE_ENTRIES =
|
|
52491
|
+
var MAX_ARTIFACT_CACHE_ENTRIES = 16;
|
|
52350
52492
|
var artifactCache = /* @__PURE__ */ new Map();
|
|
52351
52493
|
function selectCircuit(inputs, outputs) {
|
|
52352
52494
|
const config2 = getCircuitConfig(inputs, outputs);
|
|
@@ -54719,6 +54861,16 @@ function createAdapterService(deps) {
|
|
|
54719
54861
|
const reshieldSpecs = params.reshields.map(
|
|
54720
54862
|
(reshield, i) => normalizeReshieldSpec(reshield, i)
|
|
54721
54863
|
);
|
|
54864
|
+
const seenReshieldTokens = /* @__PURE__ */ new Set();
|
|
54865
|
+
for (const r2 of reshieldSpecs) {
|
|
54866
|
+
const lower = r2.token.toLowerCase();
|
|
54867
|
+
if (seenReshieldTokens.has(lower)) {
|
|
54868
|
+
throw new AdapterError(
|
|
54869
|
+
`duplicate reshield token ${r2.token}; each reshield must target a unique token`
|
|
54870
|
+
);
|
|
54871
|
+
}
|
|
54872
|
+
seenReshieldTokens.add(lower);
|
|
54873
|
+
}
|
|
54722
54874
|
const account = overrides?.account ?? await deps.requireActiveAccount();
|
|
54723
54875
|
const signer = overrides?.signer ?? deps.requireSigner(account);
|
|
54724
54876
|
const nowSeconds = BigInt(Math.floor(nowImpl() / 1e3));
|
|
@@ -55604,28 +55756,31 @@ function createWalletSDK(deps, options) {
|
|
|
55604
55756
|
return sdk;
|
|
55605
55757
|
}
|
|
55606
55758
|
async function createBrowserWalletSDK(options) {
|
|
55759
|
+
let chainId;
|
|
55607
55760
|
let gatewayUrl;
|
|
55608
55761
|
let poolAddress;
|
|
55609
55762
|
let prover = options.prover;
|
|
55610
|
-
if ("
|
|
55763
|
+
if ("chain" in options) {
|
|
55764
|
+
const chainConfig = await fetchChainConfig(options.chain);
|
|
55765
|
+
chainId = chainConfig.chainId;
|
|
55766
|
+
gatewayUrl = chainConfig.gatewayUrl;
|
|
55767
|
+
poolAddress = options.poolAddress ?? chainConfig.poolAddress;
|
|
55768
|
+
prover = {
|
|
55769
|
+
artifactSource: {
|
|
55770
|
+
baseUrl: options.prover?.artifactSource?.baseUrl ?? chainConfig.artifactBaseUrl,
|
|
55771
|
+
version: options.prover?.artifactSource?.version ?? chainConfig.artifactVersion,
|
|
55772
|
+
preferLocalFiles: options.prover?.artifactSource?.preferLocalFiles
|
|
55773
|
+
}
|
|
55774
|
+
};
|
|
55775
|
+
} else {
|
|
55776
|
+
chainId = options.chainId;
|
|
55611
55777
|
gatewayUrl = options.gatewayUrl;
|
|
55612
55778
|
poolAddress = options.poolAddress;
|
|
55613
55779
|
if (typeof window !== "undefined" && !options.prover?.artifactSource?.version) {
|
|
55614
55780
|
throw new InitializationError(
|
|
55615
|
-
"prover.artifactSource.version is required in browser when using explicit gatewayUrl mode. Use
|
|
55781
|
+
"prover.artifactSource.version is required in browser when using explicit gatewayUrl mode. Use chain mode or provide a pinned artifact version."
|
|
55616
55782
|
);
|
|
55617
55783
|
}
|
|
55618
|
-
} else {
|
|
55619
|
-
const envConfig = await fetchEnvironmentConfig(options.environment);
|
|
55620
|
-
gatewayUrl = envConfig.gatewayUrl;
|
|
55621
|
-
poolAddress = options.poolAddress ?? envConfig.poolAddress;
|
|
55622
|
-
prover = {
|
|
55623
|
-
artifactSource: {
|
|
55624
|
-
baseUrl: options.prover?.artifactSource?.baseUrl ?? envConfig.artifactBaseUrl,
|
|
55625
|
-
version: options.prover?.artifactSource?.version ?? envConfig.artifactVersion,
|
|
55626
|
-
preferLocalFiles: options.prover?.artifactSource?.preferLocalFiles
|
|
55627
|
-
}
|
|
55628
|
-
};
|
|
55629
55784
|
}
|
|
55630
55785
|
const storage = createIndexedDbStorage({ name: "unlink-wallet" });
|
|
55631
55786
|
const rng = (n2) => {
|
|
@@ -55642,7 +55797,7 @@ async function createBrowserWalletSDK(options) {
|
|
|
55642
55797
|
core,
|
|
55643
55798
|
fetch: globalThis.fetch
|
|
55644
55799
|
},
|
|
55645
|
-
{ chainId
|
|
55800
|
+
{ chainId, gatewayUrl, prover }
|
|
55646
55801
|
);
|
|
55647
55802
|
return {
|
|
55648
55803
|
sdk,
|
|
@@ -55672,34 +55827,37 @@ var UnlinkWallet = class _UnlinkWallet {
|
|
|
55672
55827
|
* Create a new UnlinkWallet instance.
|
|
55673
55828
|
*
|
|
55674
55829
|
* Handles all initialization internally:
|
|
55675
|
-
* - Resolves
|
|
55830
|
+
* - Resolves chain config (if using `chain` instead of explicit URLs)
|
|
55676
55831
|
* - Auto-detects storage (IndexedDB in browser) and rng (crypto.getRandomValues)
|
|
55677
55832
|
* - Runs schema migration via `initCore()`
|
|
55678
55833
|
* - Creates the internal SDK
|
|
55679
55834
|
*/
|
|
55680
55835
|
static async create(config2) {
|
|
55836
|
+
let chainId;
|
|
55681
55837
|
let gatewayUrl;
|
|
55682
55838
|
let poolAddress;
|
|
55683
55839
|
let proverConfig = config2.prover;
|
|
55684
|
-
if ("
|
|
55840
|
+
if ("chain" in config2) {
|
|
55841
|
+
const chainConfig = await fetchChainConfig(config2.chain);
|
|
55842
|
+
chainId = chainConfig.chainId;
|
|
55843
|
+
gatewayUrl = chainConfig.gatewayUrl;
|
|
55844
|
+
poolAddress = config2.poolAddress ?? chainConfig.poolAddress;
|
|
55845
|
+
proverConfig = {
|
|
55846
|
+
artifactSource: {
|
|
55847
|
+
baseUrl: config2.prover?.artifactSource?.baseUrl ?? chainConfig.artifactBaseUrl,
|
|
55848
|
+
version: config2.prover?.artifactSource?.version ?? chainConfig.artifactVersion,
|
|
55849
|
+
preferLocalFiles: config2.prover?.artifactSource?.preferLocalFiles
|
|
55850
|
+
}
|
|
55851
|
+
};
|
|
55852
|
+
} else {
|
|
55853
|
+
chainId = config2.chainId;
|
|
55685
55854
|
gatewayUrl = config2.gatewayUrl;
|
|
55686
55855
|
poolAddress = config2.poolAddress;
|
|
55687
55856
|
if (typeof window !== "undefined" && !config2.prover?.artifactSource?.version) {
|
|
55688
55857
|
throw new InitializationError(
|
|
55689
|
-
"prover.artifactSource.version is required in browser when using explicit gatewayUrl mode. Use
|
|
55858
|
+
"prover.artifactSource.version is required in browser when using explicit gatewayUrl mode. Use chain mode or provide a pinned artifact version."
|
|
55690
55859
|
);
|
|
55691
55860
|
}
|
|
55692
|
-
} else {
|
|
55693
|
-
const envConfig = await fetchEnvironmentConfig(config2.environment);
|
|
55694
|
-
gatewayUrl = envConfig.gatewayUrl;
|
|
55695
|
-
poolAddress = config2.poolAddress ?? envConfig.poolAddress;
|
|
55696
|
-
proverConfig = {
|
|
55697
|
-
artifactSource: {
|
|
55698
|
-
baseUrl: config2.prover?.artifactSource?.baseUrl ?? envConfig.artifactBaseUrl,
|
|
55699
|
-
version: config2.prover?.artifactSource?.version ?? envConfig.artifactVersion,
|
|
55700
|
-
preferLocalFiles: config2.prover?.artifactSource?.preferLocalFiles
|
|
55701
|
-
}
|
|
55702
|
-
};
|
|
55703
55861
|
}
|
|
55704
55862
|
const storage = config2.storage ?? detectStorage();
|
|
55705
55863
|
const rng = config2.rng ?? defaultRng;
|
|
@@ -55708,14 +55866,14 @@ var UnlinkWallet = class _UnlinkWallet {
|
|
|
55708
55866
|
const sdk = createWalletSDK(
|
|
55709
55867
|
{ core, fetch: fetchImpl },
|
|
55710
55868
|
{
|
|
55711
|
-
chainId
|
|
55869
|
+
chainId,
|
|
55712
55870
|
gatewayUrl,
|
|
55713
55871
|
chainRpcUrl: config2.chainRpcUrl,
|
|
55714
55872
|
prover: proverConfig,
|
|
55715
55873
|
autoSync: config2.autoSync
|
|
55716
55874
|
}
|
|
55717
55875
|
);
|
|
55718
|
-
return new _UnlinkWallet(sdk,
|
|
55876
|
+
return new _UnlinkWallet(sdk, chainId, poolAddress);
|
|
55719
55877
|
}
|
|
55720
55878
|
// ===== Seed Lifecycle =====
|
|
55721
55879
|
/** Seed management (create, import, export, delete mnemonic). */
|
|
@@ -56069,7 +56227,7 @@ export {
|
|
|
56069
56227
|
ensureNoteCommitmentInput,
|
|
56070
56228
|
ensurePositiveInt,
|
|
56071
56229
|
ensureWithdrawalInput,
|
|
56072
|
-
|
|
56230
|
+
fetchChainConfig,
|
|
56073
56231
|
formatAmount,
|
|
56074
56232
|
formatUint256,
|
|
56075
56233
|
generateMasterSeed,
|