@tempoxyz/id 0.0.0-pr-749.sha-e9face1 → 0.0.0-pr-751.sha-fff2145

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.
@@ -4,9 +4,9 @@ import {
4
4
  name,
5
5
  parseName,
6
6
  pending
7
- } from "./chunk-CMIMUIV7.js";
7
+ } from "./chunk-QL7UYVGP.js";
8
8
  import "./chunk-HWONYWNC.js";
9
- import "./chunk-UGIWBXMZ.js";
9
+ import "./chunk-2BJJYAAI.js";
10
10
  import "./chunk-MLKGABMK.js";
11
11
  export {
12
12
  attach,
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  PendingNotFoundError,
7
7
  RequestError
8
- } from "./chunk-UGIWBXMZ.js";
8
+ } from "./chunk-2BJJYAAI.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
 
11
11
  // ../../accounts/src/internal/BackendCookie.ts
@@ -4,8 +4,8 @@ import {
4
4
  machines,
5
5
  prompt,
6
6
  waiting
7
- } from "./chunk-S3QDABXG.js";
8
- import "./chunk-UGIWBXMZ.js";
7
+ } from "./chunk-OR4H7ZKK.js";
8
+ import "./chunk-2BJJYAAI.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
  export {
11
11
  create,
@@ -39,16 +39,12 @@ __export(Accounts_exports, {
39
39
  // ../../accounts/src/actions/account.ts
40
40
  var account_exports = {};
41
41
  __export(account_exports, {
42
- BlockedError: () => BlockedError,
43
- OriginError: () => OriginError,
44
- PageRequiredError: () => PageRequiredError,
45
42
  connection: () => connection,
46
43
  connections: () => connections,
47
44
  disconnect: () => disconnect,
48
45
  disconnectApp: () => disconnectApp,
49
46
  get: () => get,
50
47
  revokeAccessKey: () => revokeAccessKey,
51
- revokeAccessKeys: () => revokeAccessKeys,
52
48
  signMessage: () => signMessage,
53
49
  signTypedData: () => signTypedData,
54
50
  updateAccessKey: () => updateAccessKey,
@@ -497,141 +493,7 @@ function withoutKey(body, options = {}) {
497
493
  };
498
494
  }
499
495
 
500
- // ../../accounts/src/internal/Callback.ts
501
- function received(value, options) {
502
- if (typeof value !== "object" || value === null) return void 0;
503
- const data = value;
504
- if (data.type === `${options.prefix}.callback` && typeof data.url === "string")
505
- return { url: data.url };
506
- if (data.type !== `${options.prefix}.result` || typeof data.authorization !== "object" || data.authorization === null)
507
- return void 0;
508
- return {
509
- authorization: data.authorization,
510
- ...typeof data.state === "string" ? { state: data.state } : {}
511
- };
512
- }
513
- function checkState(url, options) {
514
- if (url.searchParams.getAll("state").at(-1) !== options.state)
515
- throw new RequestError({
516
- code: "invalid_request",
517
- field: "state",
518
- message: "Invalid `state` in the callback URL. Start sign-in again from this app.",
519
- status: 400
520
- });
521
- }
522
- function error2(url, options) {
523
- const code = parameter(url, { ...options, name: "error" });
524
- if (!code) return void 0;
525
- return new RequestError({
526
- code,
527
- message: parameter(url, { ...options, name: "error_description" }) ?? code,
528
- status: 0,
529
- uri: parameter(url, { ...options, name: "error_uri" })
530
- });
531
- }
532
- function parameter(url, options) {
533
- const registered = new URL(options.redirectUri).searchParams.getAll(
534
- options.name
535
- ).length;
536
- return url.searchParams.getAll(options.name)[registered];
537
- }
538
-
539
- // ../../accounts/src/internal/Chains.ts
540
- var devIds = { devnet: 31318, localnet: 1337 };
541
- var ids = { mainnet: 4217, testnet: 42431 };
542
- function parameter2(options) {
543
- const name = Object.keys(ids).find(
544
- (key) => ids[key] === options.chainId
545
- );
546
- return name ?? String(options.chainId);
547
- }
548
-
549
- // ../../accounts/src/internal/Popup.ts
550
- var closeGrace = 1e3;
551
- var closeInterval = 100;
552
- function openPopup(url) {
553
- const width = 432;
554
- const height = 420;
555
- const left = window.screenX + (window.outerWidth - width) / 2;
556
- const top = window.screenY + (window.outerHeight - height) / 2;
557
- return window.open(
558
- url,
559
- "_blank",
560
- `popup,width=${width},height=${height},left=${left},top=${top}`
561
- );
562
- }
563
- function watchPopup(popup, options) {
564
- let open2 = false;
565
- let closedAt;
566
- const listener = (event) => {
567
- if (event.origin !== options.origin || event.source !== popup) return;
568
- const data = event.data;
569
- if (data?.type === "tempo-id:popup.open") {
570
- open2 = true;
571
- return;
572
- }
573
- const callback = received(data, { prefix: "tempo-id:popup" });
574
- if (!callback) return;
575
- stop();
576
- options.onCallback(callback);
577
- };
578
- const interval = setInterval(() => {
579
- if (!open2 || !popup.closed) return;
580
- if (closedAt === void 0) {
581
- closedAt = Date.now();
582
- options.onClosed?.();
583
- }
584
- if (Date.now() - closedAt < closeGrace) return;
585
- stop();
586
- options.onClose();
587
- }, closeInterval);
588
- const stop = () => {
589
- clearInterval(interval);
590
- window.removeEventListener("message", listener);
591
- };
592
- window.addEventListener("message", listener);
593
- return stop;
594
- }
595
- function apple() {
596
- const agent = navigator.userAgent;
597
- if (/iPad|iPhone|iPod/.test(agent)) return true;
598
- return /Macintosh/.test(agent) && navigator.maxTouchPoints > 1;
599
- }
600
- function coinflow(options) {
601
- const { amount, chainId, token: token2 } = options;
602
- if (amount === void 0 || token2 !== "MACH") return false;
603
- if (chainId !== ids.mainnet) return false;
604
- return apple();
605
- }
606
- function activated() {
607
- return navigator.userActivation?.isActive ?? true;
608
- }
609
-
610
496
  // ../../accounts/src/actions/account.ts
611
- var BlockedError = class extends Error {
612
- name = "Actions.account.BlockedError";
613
- constructor() {
614
- super(
615
- "The browser blocked the approval popup. Call the action in a click handler, before any `await`, or open the approval page in a frame or through a redirect."
616
- );
617
- }
618
- };
619
- var OriginError = class extends Error {
620
- name = "Actions.account.OriginError";
621
- constructor(options) {
622
- super(
623
- `Invalid redirect URI: ${options.redirectUri} is not on this page's origin, ${options.origin}. Call the action on a page of the redirect URI's origin, or open the approval page through a redirect.`
624
- );
625
- }
626
- };
627
- var PageRequiredError = class extends Error {
628
- name = "Actions.account.PageRequiredError";
629
- constructor() {
630
- super(
631
- "No browser window: the approval page opens in a frame or a popup only from a page. Open it through a redirect instead."
632
- );
633
- }
634
- };
635
497
  async function connection(auth, options) {
636
498
  const url = new URL(
637
499
  `/v1/connection?${new URLSearchParams({ client_id: auth.clientId })}`,
@@ -730,35 +592,20 @@ async function get(auth, options = {}) {
730
592
  }
731
593
  async function revokeAccessKey(auth, options) {
732
594
  const { accessKey: accessKey2, accessToken: accessToken2, account: account2, chainId } = options;
733
- if (options.redirect || options.dialog) {
734
- if (options.dialog && typeof document === "undefined")
735
- throw new PageRequiredError();
736
- const redirectUri = approvalRedirectUri(auth, options);
737
- const query = {
595
+ if (options.redirect) {
596
+ const redirectUri = options.redirectUri ?? auth.redirectUri ?? (globalThis.location ? `${globalThis.location.origin}/` : void 0);
597
+ if (!redirectUri)
598
+ throw new Error("The approval page needs `redirectUri` to return to.");
599
+ const url = new URL("/access-keys/revoke", auth.url);
600
+ url.search = new URLSearchParams({
738
601
  account: account2,
739
602
  address: accessKey2,
740
603
  chain_id: String(chainId),
741
604
  client_id: auth.clientId,
742
605
  redirect_uri: redirectUri,
743
606
  ...options.state !== void 0 ? { state: options.state } : {}
744
- };
745
- if (!options.dialog) {
746
- const url2 = new URL("/access-keys/revoke", auth.url);
747
- url2.search = new URLSearchParams(query).toString();
748
- return { url: url2.href };
749
- }
750
- const url = await approve(auth, {
751
- label: "Revoke access with Tempo",
752
- mode: options.dialog,
753
- noun: "revocation",
754
- path: "/access-keys/revoke",
755
- query,
756
- signal: options.signal,
757
- text: "Continue in a Tempo ID window to revoke access."
758
- });
759
- return {
760
- transaction: transactionOf(url, { redirectUri }) ?? null
761
- };
607
+ }).toString();
608
+ return { url: url.href };
762
609
  }
763
610
  const json2 = {
764
611
  account: account2,
@@ -785,34 +632,6 @@ async function revokeAccessKey(auth, options) {
785
632
  );
786
633
  return body.receipt ? formatTransactionReceipt(body.receipt) : null;
787
634
  }
788
- async function revokeAccessKeys(auth, options) {
789
- const { account: account2, chainId, getFn, keyIds: keyIds2 } = options;
790
- const json2 = {
791
- account: account2,
792
- chainId,
793
- client_id: auth.clientId,
794
- ...keyIds2 ? { keyIds: keyIds2 } : {}
795
- };
796
- const path = "/v1/account/access-keys/revoke";
797
- const first = await json(await post(auth, path, { json: json2 }));
798
- const body = await (async () => {
799
- if (!("step" in first)) return first;
800
- const deserialized = Authentication.deserializeOptions(first.step.options);
801
- const assertion = Authentication.serializeResponse(
802
- await Authentication.sign(
803
- // ox reads `getFn` beside request options at runtime, which its types admit only beside a challenge.
804
- getFn ? { ...deserialized, getFn } : deserialized
805
- )
806
- );
807
- return await json(
808
- await post(auth, path, { json: { ...json2, passkey: { assertion } } })
809
- );
810
- })();
811
- return {
812
- receipt: body.receipt ? formatTransactionReceipt(body.receipt) : null,
813
- revoked: body.revoked
814
- };
815
- }
816
635
  async function signMessage(auth, options) {
817
636
  const { account: account2, chain, message } = options;
818
637
  const body = await json(
@@ -867,11 +686,12 @@ async function updateAccessKey(auth, options) {
867
686
  } : {},
868
687
  ...options.scopes ? { scopes: options.scopes } : {}
869
688
  };
870
- if (options.redirect || options.dialog) {
871
- if (options.dialog && typeof document === "undefined")
872
- throw new PageRequiredError();
873
- const redirectUri = approvalRedirectUri(auth, options);
874
- const query = {
689
+ if (options.redirect) {
690
+ const redirectUri = options.redirectUri ?? auth.redirectUri ?? (globalThis.location ? `${globalThis.location.origin}/` : void 0);
691
+ if (!redirectUri)
692
+ throw new Error("The approval page needs `redirectUri` to return to.");
693
+ const url = new URL("/access-keys/update", auth.url);
694
+ url.search = new URLSearchParams({
875
695
  account: account2,
876
696
  address: accessKey2,
877
697
  chain_id: String(chainId),
@@ -882,24 +702,8 @@ async function updateAccessKey(auth, options) {
882
702
  pad: false,
883
703
  url: true
884
704
  })
885
- };
886
- if (!options.dialog) {
887
- const url2 = new URL("/access-keys/update", auth.url);
888
- url2.search = new URLSearchParams(query).toString();
889
- return { url: url2.href };
890
- }
891
- const url = await approve(auth, {
892
- label: "Change access with Tempo",
893
- mode: options.dialog,
894
- noun: "change",
895
- path: "/access-keys/update",
896
- query,
897
- signal: options.signal,
898
- text: "Continue in a Tempo ID window to change access."
899
- });
900
- const transaction = transactionOf(url, { redirectUri });
901
- if (!transaction) throw transactionOf.missing();
902
- return { transaction };
705
+ }).toString();
706
+ return { url: url.href };
903
707
  }
904
708
  const body = await json(
905
709
  await post(auth, "/v1/account/access-keys/update", {
@@ -912,130 +716,9 @@ async function updateAccessKey(auth, options) {
912
716
  }
913
717
  })
914
718
  );
915
- return formatTransactionReceipt(body.receipt);
916
- }
917
- function approvalRedirectUri(auth, options) {
918
- const redirectUri = options.redirectUri ?? auth.redirectUri ?? (globalThis.location ? `${globalThis.location.origin}/` : void 0);
919
- if (!redirectUri)
920
- throw new Error("The approval page needs `redirectUri` to return to.");
921
- return redirectUri;
922
- }
923
- async function approve(auth, options) {
924
- const { mode, path, query, signal } = options;
925
- const redirectUri = query.redirect_uri;
926
- signal?.throwIfAborted();
927
- if (typeof document === "undefined") throw new PageRequiredError();
928
- if (new URL(redirectUri).origin !== window.location.origin)
929
- throw new OriginError({ origin: window.location.origin, redirectUri });
930
- const origin = new URL(auth.url).origin;
931
- const toUrl = (display) => {
932
- const url = new URL(display === "frame" ? `/embed${path}` : path, auth.url);
933
- url.search = new URLSearchParams({
934
- ...query,
935
- ...display === "popup" ? { display } : {}
936
- }).toString();
937
- return url.href;
938
- };
939
- const closed = () => new DOMException(`The user closed the ${options.noun}.`, "AbortError");
940
- const finish = (value) => {
941
- const url = new URL(value);
942
- const refusal = error2(url, { redirectUri });
943
- if (refusal) throw refusal;
944
- return url;
945
- };
946
- const watch2 = async (popup) => {
947
- let abort2;
948
- let settled = false;
949
- let unblock;
950
- let unwatch;
951
- try {
952
- return await new Promise((resolve3, reject) => {
953
- void import("./Sheet-2VUMVJXV.js").then(
954
- (Sheet2) => {
955
- if (settled) return;
956
- unblock = Sheet2.waiting({
957
- onCancel: () => reject(closed()),
958
- popup
959
- });
960
- },
961
- () => void 0
962
- );
963
- abort2 = () => reject(signal?.reason);
964
- signal?.addEventListener("abort", abort2, { once: true });
965
- unwatch = watchPopup(popup, {
966
- onCallback: (value) => {
967
- if (!("url" in value))
968
- return reject(
969
- new RequestError({
970
- code: "invalid_request",
971
- message: "Invalid return: the approval page posted no return URL. Try again.",
972
- status: 0
973
- })
974
- );
975
- try {
976
- resolve3(finish(value.url));
977
- } catch (error3) {
978
- reject(error3);
979
- }
980
- },
981
- onClose: () => reject(closed()),
982
- onClosed: () => unblock?.(),
983
- origin
984
- });
985
- });
986
- } finally {
987
- settled = true;
988
- if (abort2) signal?.removeEventListener("abort", abort2);
989
- unblock?.();
990
- unwatch?.();
991
- popup.close();
992
- }
993
- };
994
- if (mode === "popup") {
995
- const popup = openPopup(toUrl("popup"));
996
- if (popup === null) throw new BlockedError();
997
- return await watch2(popup);
998
- }
999
- const Sheet = await import("./Sheet-2VUMVJXV.js");
1000
- signal?.throwIfAborted();
1001
- let abort;
1002
- let close;
1003
- try {
1004
- return await new Promise((resolve3, reject) => {
1005
- abort = () => reject(signal?.reason);
1006
- signal?.addEventListener("abort", abort, { once: true });
1007
- close = Sheet.frame({
1008
- // The page runs the passkey ceremony of the account's owner, for Tempo ID's origin.
1009
- allow: `publickey-credentials-get ${origin}`,
1010
- label: options.label,
1011
- onCallback: (value) => {
1012
- try {
1013
- resolve3(finish(value));
1014
- } catch (error3) {
1015
- reject(error3);
1016
- }
1017
- },
1018
- onCancel: () => reject(closed()),
1019
- onPopup: (entry) => {
1020
- const popup = openPopup(toUrl("popup"));
1021
- if (popup === null) {
1022
- if (!entry.automatic) reject(new BlockedError());
1023
- return false;
1024
- }
1025
- close?.();
1026
- watch2(popup).then(resolve3, reject);
1027
- return true;
1028
- },
1029
- origin,
1030
- sandbox: "allow-forms allow-same-origin allow-scripts",
1031
- text: options.text,
1032
- url: toUrl("frame")
1033
- });
1034
- });
1035
- } finally {
1036
- if (abort) signal?.removeEventListener("abort", abort);
1037
- close?.();
1038
- }
719
+ return formatTransactionReceipt(
720
+ body.receipt
721
+ );
1039
722
  }
1040
723
  async function upgrade(auth, options) {
1041
724
  const { getFn, key } = options;
@@ -1084,22 +767,6 @@ function toConnection(body) {
1084
767
  app: body.app
1085
768
  };
1086
769
  }
1087
- function transactionOf(url, options) {
1088
- const transaction = parameter(url, {
1089
- name: "transaction",
1090
- redirectUri: options.redirectUri
1091
- });
1092
- if (transaction === void 0) return void 0;
1093
- if (Hex.validate(transaction) && Hex.size(transaction) === 32)
1094
- return transaction;
1095
- throw transactionOf.missing();
1096
- }
1097
- transactionOf.missing = () => new RequestError({
1098
- code: "invalid_request",
1099
- field: "transaction",
1100
- message: "Invalid `transaction` in the return URL: it is not a transaction hash. Check the account on Tempo ID, then try again.",
1101
- status: 0
1102
- });
1103
770
 
1104
771
  // ../../accounts/src/internal/Headless.ts
1105
772
  import { Authentication as Authentication2 } from "ox/webauthn";
@@ -1116,6 +783,18 @@ function from2(value) {
1116
783
  import { Address as Address2, Value } from "ox";
1117
784
  import { Addresses, Scopes, Selectors } from "viem/tempo";
1118
785
  import { defineToken, tokens as tokens2 } from "viem/tokens";
786
+
787
+ // ../../accounts/src/internal/Chains.ts
788
+ var devIds = { devnet: 31318, localnet: 1337 };
789
+ var ids = { mainnet: 4217, testnet: 42431 };
790
+ function parameter(options) {
791
+ const name = Object.keys(ids).find(
792
+ (key) => ids[key] === options.chainId
793
+ );
794
+ return name ?? String(options.chainId);
795
+ }
796
+
797
+ // ../../accounts/src/Permissions.ts
1119
798
  var DecimalsUnknownError = class extends Error {
1120
799
  name = "Permissions.DecimalsUnknownError";
1121
800
  constructor(options) {
@@ -3514,7 +3193,7 @@ var signInIds = /* @__PURE__ */ new Set([
3514
3193
  function plugin() {
3515
3194
  let loading;
3516
3195
  function load() {
3517
- loading ??= import("./dialog-SWHB7N65.js").then((module) => module.dialog()).catch((error3) => {
3196
+ loading ??= import("./dialog-CPAB7R2I.js").then((module) => module.dialog()).catch((error3) => {
3518
3197
  loading = void 0;
3519
3198
  throw error3;
3520
3199
  });
@@ -3532,9 +3211,7 @@ function plugin() {
3532
3211
  }
3533
3212
  return {
3534
3213
  callback: async () => (await get3()).callback(),
3535
- revokeAccessKey: async (parameters) => (await get3()).revokeAccessKey(parameters),
3536
- signIn: async (parameters) => (await get3()).signIn(parameters),
3537
- updateAccessKey: async (parameters) => (await get3()).updateAccessKey(parameters)
3214
+ signIn: async (parameters) => (await get3()).signIn(parameters)
3538
3215
  };
3539
3216
  },
3540
3217
  // The loaded plugin adds no member, so its `extend` runs once the module loads, and this one
@@ -3665,13 +3342,115 @@ function served(options) {
3665
3342
  // ../../accounts/src/actions/funding.ts
3666
3343
  var funding_exports = {};
3667
3344
  __export(funding_exports, {
3668
- BlockedError: () => BlockedError2,
3669
- OriginError: () => OriginError2,
3670
- PageRequiredError: () => PageRequiredError2,
3345
+ BlockedError: () => BlockedError,
3346
+ OriginError: () => OriginError,
3347
+ PageRequiredError: () => PageRequiredError,
3671
3348
  complete: () => complete2,
3672
3349
  open: () => open
3673
3350
  });
3674
- var BlockedError2 = class extends Error {
3351
+
3352
+ // ../../accounts/src/internal/Callback.ts
3353
+ function received(value, options) {
3354
+ if (typeof value !== "object" || value === null) return void 0;
3355
+ const data = value;
3356
+ if (data.type === `${options.prefix}.callback` && typeof data.url === "string")
3357
+ return { url: data.url };
3358
+ if (data.type !== `${options.prefix}.result` || typeof data.authorization !== "object" || data.authorization === null)
3359
+ return void 0;
3360
+ return {
3361
+ authorization: data.authorization,
3362
+ ...typeof data.state === "string" ? { state: data.state } : {}
3363
+ };
3364
+ }
3365
+ function checkState(url, options) {
3366
+ if (url.searchParams.getAll("state").at(-1) !== options.state)
3367
+ throw new RequestError({
3368
+ code: "invalid_request",
3369
+ field: "state",
3370
+ message: "Invalid `state` in the callback URL. Start sign-in again from this app.",
3371
+ status: 400
3372
+ });
3373
+ }
3374
+ function error2(url, options) {
3375
+ const code = parameter2(url, { ...options, name: "error" });
3376
+ if (!code) return void 0;
3377
+ return new RequestError({
3378
+ code,
3379
+ message: parameter2(url, { ...options, name: "error_description" }) ?? code,
3380
+ status: 0,
3381
+ uri: parameter2(url, { ...options, name: "error_uri" })
3382
+ });
3383
+ }
3384
+ function parameter2(url, options) {
3385
+ const registered = new URL(options.redirectUri).searchParams.getAll(
3386
+ options.name
3387
+ ).length;
3388
+ return url.searchParams.getAll(options.name)[registered];
3389
+ }
3390
+
3391
+ // ../../accounts/src/internal/Popup.ts
3392
+ var closeGrace = 1e3;
3393
+ var closeInterval = 100;
3394
+ function openPopup(url) {
3395
+ const width = 432;
3396
+ const height = 420;
3397
+ const left = window.screenX + (window.outerWidth - width) / 2;
3398
+ const top = window.screenY + (window.outerHeight - height) / 2;
3399
+ return window.open(
3400
+ url,
3401
+ "_blank",
3402
+ `popup,width=${width},height=${height},left=${left},top=${top}`
3403
+ );
3404
+ }
3405
+ function watchPopup(popup, options) {
3406
+ let open2 = false;
3407
+ let closedAt;
3408
+ const listener = (event) => {
3409
+ if (event.origin !== options.origin || event.source !== popup) return;
3410
+ const data = event.data;
3411
+ if (data?.type === "tempo-id:popup.open") {
3412
+ open2 = true;
3413
+ return;
3414
+ }
3415
+ const callback = received(data, { prefix: "tempo-id:popup" });
3416
+ if (!callback) return;
3417
+ stop();
3418
+ options.onCallback(callback);
3419
+ };
3420
+ const interval = setInterval(() => {
3421
+ if (!open2 || !popup.closed) return;
3422
+ if (closedAt === void 0) {
3423
+ closedAt = Date.now();
3424
+ options.onClosed?.();
3425
+ }
3426
+ if (Date.now() - closedAt < closeGrace) return;
3427
+ stop();
3428
+ options.onClose();
3429
+ }, closeInterval);
3430
+ const stop = () => {
3431
+ clearInterval(interval);
3432
+ window.removeEventListener("message", listener);
3433
+ };
3434
+ window.addEventListener("message", listener);
3435
+ return stop;
3436
+ }
3437
+ function apple() {
3438
+ const agent = navigator.userAgent;
3439
+ if (/iPad|iPhone|iPod/.test(agent)) return true;
3440
+ return /Macintosh/.test(agent) && navigator.maxTouchPoints > 1;
3441
+ }
3442
+ function coinflow(options) {
3443
+ const { amount, chainId, token: token2 } = options;
3444
+ if (amount === void 0 || token2 !== "MACH") return false;
3445
+ if (chainId !== ids.mainnet) return false;
3446
+ return apple();
3447
+ }
3448
+ function activated() {
3449
+ return navigator.userActivation?.isActive ?? true;
3450
+ }
3451
+
3452
+ // ../../accounts/src/actions/funding.ts
3453
+ var BlockedError = class extends Error {
3675
3454
  name = "Actions.funding.BlockedError";
3676
3455
  constructor() {
3677
3456
  super(
@@ -3679,7 +3458,7 @@ var BlockedError2 = class extends Error {
3679
3458
  );
3680
3459
  }
3681
3460
  };
3682
- var OriginError2 = class extends Error {
3461
+ var OriginError = class extends Error {
3683
3462
  name = "Actions.funding.OriginError";
3684
3463
  constructor(options) {
3685
3464
  super(
@@ -3687,7 +3466,7 @@ var OriginError2 = class extends Error {
3687
3466
  );
3688
3467
  }
3689
3468
  };
3690
- var PageRequiredError2 = class extends Error {
3469
+ var PageRequiredError = class extends Error {
3691
3470
  name = "Actions.funding.PageRequiredError";
3692
3471
  constructor() {
3693
3472
  super(
@@ -3723,7 +3502,7 @@ async function open(auth, options) {
3723
3502
  if (typeof options.address === "object")
3724
3503
  Promise.resolve(options.address).catch(() => void 0);
3725
3504
  signal?.throwIfAborted();
3726
- if (typeof document === "undefined") throw new PageRequiredError2();
3505
+ if (typeof document === "undefined") throw new PageRequiredError();
3727
3506
  const mode = (() => {
3728
3507
  const value = options.mode ?? "frame";
3729
3508
  if (value !== "frame") return value;
@@ -3746,7 +3525,7 @@ async function open(auth, options) {
3746
3525
  ...entry.amount ? { amount: entry.amount } : {},
3747
3526
  // The page reads `mainnet` and `testnet` by name, and another chain by the name that the
3748
3527
  // deployment lists for its ID.
3749
- chain: parameter2({ chainId: options.chainId ?? auth.chainId }),
3528
+ chain: parameter({ chainId: options.chainId ?? auth.chainId }),
3750
3529
  client_id: auth.clientId,
3751
3530
  ...entry.mode === "popup" ? { display: entry.mode } : {},
3752
3531
  ...currency === void 0 ? {} : { funding_currency: currency },
@@ -3771,10 +3550,10 @@ async function open(auth, options) {
3771
3550
  return void 0;
3772
3551
  }
3773
3552
  if (new URL(redirectUri).origin !== window.location.origin)
3774
- throw new OriginError2({ origin: window.location.origin, redirectUri });
3553
+ throw new OriginError({ origin: window.location.origin, redirectUri });
3775
3554
  if (mode === "popup" && options.mode !== "popup" && !activated()) {
3776
3555
  const address = await abortable(read2(), { signal });
3777
- const Sheet = await import("./Sheet-2VUMVJXV.js");
3556
+ const Sheet = await import("./Sheet-D644QHD6.js");
3778
3557
  return await new Promise((resolve3, reject) => {
3779
3558
  const abort = () => {
3780
3559
  close();
@@ -3806,7 +3585,7 @@ async function open(auth, options) {
3806
3585
  const popup = openPopup(
3807
3586
  typeof options.address === "string" ? toUrl(options.address) : "about:blank"
3808
3587
  );
3809
- if (popup === null) throw new BlockedError2();
3588
+ if (popup === null) throw new BlockedError();
3810
3589
  return await watch(auth, {
3811
3590
  address: read2(),
3812
3591
  popup,
@@ -3825,7 +3604,7 @@ async function watch(auth, options) {
3825
3604
  try {
3826
3605
  return await new Promise(
3827
3606
  (resolve3, reject) => {
3828
- void import("./Sheet-2VUMVJXV.js").then(
3607
+ void import("./Sheet-D644QHD6.js").then(
3829
3608
  (Sheet) => {
3830
3609
  if (settled) return;
3831
3610
  unblock = Sheet.waiting({
@@ -3890,7 +3669,7 @@ function parse(url, options) {
3890
3669
  async function frame(auth, options) {
3891
3670
  const { redirectUri, signal, toUrl } = options;
3892
3671
  const address = await abortable(options.address, { signal });
3893
- const Sheet = await import("./Sheet-2VUMVJXV.js");
3672
+ const Sheet = await import("./Sheet-D644QHD6.js");
3894
3673
  signal?.throwIfAborted();
3895
3674
  let close;
3896
3675
  let abort;
@@ -3900,11 +3679,6 @@ async function frame(auth, options) {
3900
3679
  abort = () => reject(signal?.reason);
3901
3680
  signal?.addEventListener("abort", abort, { once: true });
3902
3681
  close = Sheet.frame({
3903
- // Apple Pay and Google Pay need the `payment` permission in a frame, and their sheets open
3904
- // popups from the frame's own clicks. The frame runs third-party scripts and nests the
3905
- // card issuer's page.
3906
- allow: "payment",
3907
- label: "Add funds with Tempo",
3908
3682
  onCallback: (value) => resolve3(
3909
3683
  complete2(auth, { redirectUri, url: value }) ?? {
3910
3684
  status: "continued"
@@ -3920,7 +3694,7 @@ async function frame(auth, options) {
3920
3694
  })
3921
3695
  );
3922
3696
  if (popup === null) {
3923
- if (!entry.automatic) reject(new BlockedError2());
3697
+ if (!entry.automatic) reject(new BlockedError());
3924
3698
  return false;
3925
3699
  }
3926
3700
  close?.();
@@ -3931,8 +3705,6 @@ async function frame(auth, options) {
3931
3705
  return true;
3932
3706
  },
3933
3707
  origin: new URL(auth.url).origin,
3934
- sandbox: "allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts",
3935
- text: "Continue in a Tempo ID window to add funds.",
3936
3708
  url: toUrl(address)
3937
3709
  });
3938
3710
  }
@@ -4362,7 +4134,7 @@ function create4(options = {}) {
4362
4134
  function connections2() {
4363
4135
  if (!connectionsOptions)
4364
4136
  return Promise.reject(new ConnectionsRequiredError());
4365
- attached ??= import("./Connections-K44EJ6F7.js").then(
4137
+ attached ??= import("./Connections-4J63W3O3.js").then(
4366
4138
  (module) => module.attach(config, connectionsOptions)
4367
4139
  );
4368
4140
  return attached;
@@ -4411,7 +4183,7 @@ function create4(options = {}) {
4411
4183
  },
4412
4184
  handler: {
4413
4185
  async fetch(request2) {
4414
- server ??= import("./Server-CAPWBFI3.js").then(
4186
+ server ??= import("./Server-GHH2TOPL.js").then(
4415
4187
  (module) => module.create({
4416
4188
  accessKeys: connectionsOptions ? async () => (await connections2()).keyEndpoint : void 0,
4417
4189
  // The `backend` plugin's actions sit on the instance under its `id`.
@@ -4718,15 +4490,6 @@ export {
4718
4490
  user,
4719
4491
  tokens,
4720
4492
  withoutKey,
4721
- received,
4722
- checkState,
4723
- error2,
4724
- openPopup,
4725
- watchPopup,
4726
- coinflow,
4727
- activated,
4728
- revokeAccessKey,
4729
- updateAccessKey,
4730
4493
  account_exports,
4731
4494
  authorizeUrl,
4732
4495
  request,
@@ -4748,12 +4511,17 @@ export {
4748
4511
  toSession,
4749
4512
  unlisted,
4750
4513
  from4 as from2,
4514
+ received,
4515
+ checkState,
4516
+ error2,
4751
4517
  get2 as get,
4518
+ openPopup,
4519
+ watchPopup,
4520
+ coinflow,
4521
+ activated,
4752
4522
  open,
4753
4523
  funding_exports,
4754
- KeyRequiredError,
4755
4524
  PendingNotFoundError,
4756
4525
  RequestError,
4757
- SignedOutError2 as SignedOutError,
4758
4526
  Accounts_exports
4759
4527
  };
@@ -2,7 +2,7 @@ import {
2
2
  create,
3
3
  prompt,
4
4
  waiting
5
- } from "./chunk-S3QDABXG.js";
5
+ } from "./chunk-OR4H7ZKK.js";
6
6
  import {
7
7
  basePath
8
8
  } from "./chunk-HWONYWNC.js";
@@ -27,7 +27,7 @@ import {
27
27
  tokens,
28
28
  user,
29
29
  watchPopup
30
- } from "./chunk-UGIWBXMZ.js";
30
+ } from "./chunk-2BJJYAAI.js";
31
31
  import {
32
32
  __export
33
33
  } from "./chunk-MLKGABMK.js";
@@ -2,7 +2,7 @@ import {
2
2
  openPopup,
3
3
  received,
4
4
  watchPopup
5
- } from "./chunk-UGIWBXMZ.js";
5
+ } from "./chunk-2BJJYAAI.js";
6
6
 
7
7
  // ../../accounts/src/internal/Sheet.ts
8
8
  import {
@@ -461,11 +461,13 @@ function frame(options) {
461
461
  adopt();
462
462
  const dialog = document.createElement("dialog");
463
463
  dialog.setAttribute(attribute, "");
464
- dialog.setAttribute("aria-label", options.label);
464
+ dialog.setAttribute("aria-label", "Add funds with Tempo");
465
465
  const element = document.createElement("iframe");
466
- element.setAttribute("allow", options.allow);
467
- element.setAttribute("referrerpolicy", "origin");
468
- element.setAttribute("sandbox", options.sandbox);
466
+ element.setAttribute("allow", "payment");
467
+ element.setAttribute(
468
+ "sandbox",
469
+ "allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"
470
+ );
469
471
  element.setAttribute("title", "Tempo ID");
470
472
  element.style.height = "420px";
471
473
  element.src = options.url;
@@ -487,7 +489,7 @@ function frame(options) {
487
489
  panel.setAttribute("data-panel", "");
488
490
  const text = document.createElement("p");
489
491
  text.setAttribute("aria-live", "polite");
490
- text.textContent = options.text;
492
+ text.textContent = "Continue in a Tempo ID window to add funds.";
491
493
  const primary = document.createElement("button");
492
494
  primary.setAttribute("data-primary", "");
493
495
  primary.type = "button";
@@ -9,7 +9,7 @@ import {
9
9
  from,
10
10
  json,
11
11
  post
12
- } from "./chunk-UGIWBXMZ.js";
12
+ } from "./chunk-2BJJYAAI.js";
13
13
  import {
14
14
  __export
15
15
  } from "./chunk-MLKGABMK.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  dialog_exports,
3
3
  redirect_exports
4
- } from "./chunk-YXEQ42DK.js";
4
+ } from "./chunk-MLMRZMAK.js";
5
5
  import {
6
6
  connections_exports
7
- } from "./chunk-CMIMUIV7.js";
7
+ } from "./chunk-QL7UYVGP.js";
8
8
  import {
9
9
  AccessKeyRequiredError,
10
10
  AccessKey_exports,
@@ -43,7 +43,7 @@ import {
43
43
  unlisted,
44
44
  user,
45
45
  withoutKey
46
- } from "./chunk-UGIWBXMZ.js";
46
+ } from "./chunk-2BJJYAAI.js";
47
47
  import {
48
48
  __export
49
49
  } from "./chunk-MLKGABMK.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  env,
3
3
  login
4
- } from "../chunk-6Y4DXPDA.js";
5
- import "../chunk-YXEQ42DK.js";
6
- import "../chunk-S3QDABXG.js";
7
- import "../chunk-CMIMUIV7.js";
4
+ } from "../chunk-RXFSIUSG.js";
5
+ import "../chunk-MLMRZMAK.js";
6
+ import "../chunk-OR4H7ZKK.js";
7
+ import "../chunk-QL7UYVGP.js";
8
8
  import "../chunk-HWONYWNC.js";
9
- import "../chunk-UGIWBXMZ.js";
9
+ import "../chunk-2BJJYAAI.js";
10
10
  import "../chunk-MLKGABMK.js";
11
11
 
12
12
  // src/commands/login.ts
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  env,
3
3
  remove
4
- } from "../chunk-6Y4DXPDA.js";
5
- import "../chunk-YXEQ42DK.js";
6
- import "../chunk-S3QDABXG.js";
7
- import "../chunk-CMIMUIV7.js";
4
+ } from "../chunk-RXFSIUSG.js";
5
+ import "../chunk-MLMRZMAK.js";
6
+ import "../chunk-OR4H7ZKK.js";
7
+ import "../chunk-QL7UYVGP.js";
8
8
  import "../chunk-HWONYWNC.js";
9
- import "../chunk-UGIWBXMZ.js";
9
+ import "../chunk-2BJJYAAI.js";
10
10
  import "../chunk-MLKGABMK.js";
11
11
 
12
12
  // src/commands/logout.ts
@@ -2,12 +2,12 @@ import {
2
2
  env,
3
3
  signedOut,
4
4
  whoami
5
- } from "../chunk-6Y4DXPDA.js";
6
- import "../chunk-YXEQ42DK.js";
7
- import "../chunk-S3QDABXG.js";
8
- import "../chunk-CMIMUIV7.js";
5
+ } from "../chunk-RXFSIUSG.js";
6
+ import "../chunk-MLMRZMAK.js";
7
+ import "../chunk-OR4H7ZKK.js";
8
+ import "../chunk-QL7UYVGP.js";
9
9
  import "../chunk-HWONYWNC.js";
10
- import "../chunk-UGIWBXMZ.js";
10
+ import "../chunk-2BJJYAAI.js";
11
11
  import "../chunk-MLKGABMK.js";
12
12
 
13
13
  // src/commands/whoami.ts
@@ -2,21 +2,17 @@ import {
2
2
  callback,
3
3
  preload,
4
4
  signIn
5
- } from "./chunk-YXEQ42DK.js";
6
- import "./chunk-S3QDABXG.js";
5
+ } from "./chunk-MLMRZMAK.js";
6
+ import "./chunk-OR4H7ZKK.js";
7
7
  import {
8
8
  basePath
9
9
  } from "./chunk-HWONYWNC.js";
10
10
  import {
11
- KeyRequiredError,
12
- SignedOutError,
13
11
  accessKey,
14
12
  expired2 as expired,
15
13
  from2 as from,
16
- revokeAccessKey,
17
- toSession,
18
- updateAccessKey
19
- } from "./chunk-UGIWBXMZ.js";
14
+ toSession
15
+ } from "./chunk-2BJJYAAI.js";
20
16
  import "./chunk-MLKGABMK.js";
21
17
 
22
18
  // ../../accounts/src/plugins/dialog.ts
@@ -55,52 +51,12 @@ function dialog(options = {}) {
55
51
  return from({
56
52
  actions: (context) => {
57
53
  const config = configOf(context);
58
- const target = (session, parameters) => {
59
- const entries = [session?.key, ...session?.keys ?? []].filter(
60
- (entry2) => entry2 !== void 0 && (parameters.accessKey === void 0 || entry2.keyAuthorization.keyId.toLowerCase() === parameters.accessKey.toLowerCase()) && (parameters.account === void 0 || entry2.account.toLowerCase() === parameters.account.toLowerCase())
61
- );
62
- const entry = entries.find(
63
- (entry2) => Number(entry2.chainId) === (parameters.chainId ?? config.chainId)
64
- ) ?? (parameters.chainId === void 0 && parameters.accessKey !== void 0 && entries.length === 1 ? entries[0] : void 0);
65
- const accessKey2 = parameters.accessKey ?? entry?.keyAuthorization.keyId;
66
- const account = parameters.account ?? entry?.account;
67
- const chainId = parameters.chainId ?? (entry ? Number(entry.chainId) : void 0) ?? config.chainId;
68
- if (accessKey2 && account) return { accessKey: accessKey2, account, chainId };
69
- const { status } = context.session.status.get();
70
- if (status === "pending" || status === "reauthorizing")
71
- throw new SignedOutError({ pending: true });
72
- if (session && !expired(session))
73
- throw new KeyRequiredError();
74
- throw new SignedOutError();
75
- };
76
- const sessionOf = async (parameters) => {
77
- if (parameters.accessKey && parameters.account && parameters.chainId !== void 0)
78
- return void 0;
79
- return await context.session.load();
80
- };
81
- const modeOf = (mode) => mode ?? (popup && !crossOriginOpenerPolicy ? "popup" : "iframe");
82
54
  return {
83
55
  /**
84
56
  * Completes a popup's sign-in on the page of the redirect URI, and closes the popup.
85
57
  * Returns whether the page was the callback of a popup.
86
58
  */
87
59
  callback: () => callback(config),
88
- /**
89
- * Revokes the app's own access key on Tempo ID's approval page, in the dialog or a popup, and
90
- * returns the hash of the transaction, or `null` for an access key that the chain held
91
- * revoked already. Defaults to the session's access key.
92
- */
93
- // An async member rejects every failure, and still opens a popup within the click, since it
94
- // runs at once up to its first `await`.
95
- revokeAccessKey: async (parameters = {}) => revokeAccessKey(config, {
96
- ...target(
97
- context.session.get() ?? await sessionOf(parameters),
98
- parameters
99
- ),
100
- dialog: modeOf(parameters.mode),
101
- redirectUri: parameters.redirectUri ?? backendRedirectUri(config),
102
- signal: parameters.signal
103
- }),
104
60
  /**
105
61
  * Signs the user in, sets the instance's session, and returns it. With `backend`, the
106
62
  * backend keeps the session, and the call returns the session that the page reads.
@@ -127,23 +83,7 @@ function dialog(options = {}) {
127
83
  const session = toSession(result);
128
84
  await change.commit(session);
129
85
  return session;
130
- },
131
- /**
132
- * Changes the limits, the scopes, or both of the app's own access key on Tempo ID's approval
133
- * page, in the dialog or a popup, and returns the hash of the transaction. Defaults to the
134
- * session's access key.
135
- */
136
- updateAccessKey: async (parameters) => updateAccessKey(config, {
137
- ...target(
138
- context.session.get() ?? await sessionOf(parameters),
139
- parameters
140
- ),
141
- dialog: modeOf(parameters.mode),
142
- limits: parameters.limits,
143
- redirectUri: parameters.redirectUri ?? backendRedirectUri(config),
144
- scopes: parameters.scopes,
145
- signal: parameters.signal
146
- })
86
+ }
147
87
  };
148
88
  },
149
89
  // The plugin adds no member. It reads the instance's status, which only `extend` receives.
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=24.21"
10
10
  },
11
11
  "name": "@tempoxyz/id",
12
- "version": "0.0.0-pr-749.sha-e9face1",
12
+ "version": "0.0.0-pr-751.sha-fff2145",
13
13
  "description": "The tempo-id CLI: sign in to Tempo ID, and call its API and the Admin API.",
14
14
  "type": "module",
15
15
  "bin": {