@seams/wallet 0.21.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/THIRD_PARTY_NOTICES.md +5 -2
  2. package/dist/.build-inputs.sha256 +1 -1
  3. package/dist/esm/core/signingEngine/uiConfirm/ui/preact/TransactionReceipt.js +107 -43
  4. package/dist/esm/core/signingEngine/uiConfirm/ui/preact/mountConfirmationSurface.js +1 -1
  5. package/dist/esm/core/signingEngine/uiConfirm/ui/transaction-receipt.js +36 -6
  6. package/dist/esm/core/ui/messages.js +9 -14
  7. package/dist/esm/externalNear/actions.js +26 -0
  8. package/dist/esm/externalNear/boundary.js +53 -0
  9. package/dist/esm/externalNear/controller.js +187 -0
  10. package/dist/esm/externalNear/hot.js +40 -0
  11. package/dist/esm/externalNear/index.js +3 -0
  12. package/dist/esm/externalNear/intear.js +109 -0
  13. package/dist/esm/externalNear/intearPopup.js +83 -0
  14. package/dist/esm/externalNear/meteor.js +121 -0
  15. package/dist/esm/externalNear/meteorRequest.js +117 -0
  16. package/dist/esm/externalNear/types.js +17 -0
  17. package/dist/esm/externalNear/wallets.js +33 -0
  18. package/dist/esm/node_modules/borsh/lib/esm/buffer.js +67 -0
  19. package/dist/esm/node_modules/borsh/lib/esm/deserialize.js +94 -0
  20. package/dist/esm/node_modules/borsh/lib/esm/index.js +13 -0
  21. package/dist/esm/node_modules/borsh/lib/esm/serialize.js +127 -0
  22. package/dist/esm/node_modules/borsh/lib/esm/types.js +19 -0
  23. package/dist/esm/node_modules/borsh/lib/esm/utils.js +104 -0
  24. package/dist/esm/plugins/plugin-utils.js +2 -5
  25. package/dist/esm/react/components/AccountMenuButton/ProfileDropdown.js +23 -9
  26. package/dist/esm/react/components/AccountMenuButton/TransactionSettingsSection.css +376 -84
  27. package/dist/esm/react/components/AccountMenuButton/TransactionSettingsSection.js +87 -167
  28. package/dist/esm/react/components/AccountMenuButton/WalletRegionSection.js +11 -9
  29. package/dist/esm/react/components/AccountMenuButton/WalletSettingsLayout.css +76 -74
  30. package/dist/esm/react/components/AccountMenuButton/WalletSettingsLayout.js +23 -22
  31. package/dist/esm/react/components/AccountMenuButton/Web3AuthProfileButton.css +1 -5
  32. package/dist/esm/react/components/AccountMenuButton/icons/MapPinIcon.js +12 -0
  33. package/dist/esm/react/components/AccountMenuButton/index.js +2 -1
  34. package/dist/esm/react/externalNear.css +90 -0
  35. package/dist/esm/react/externalNear.js +104 -0
  36. package/dist/esm/react/styles/styles.css +452 -162
  37. package/dist/{public/sdk/ConfirmationDrawer-B7RCp58z.js → esm/sdk/ConfirmationDrawer-Ck33ZmU-.js} +1 -1
  38. package/dist/esm/sdk/adapters-CgJpSAxH.js +2 -0
  39. package/dist/esm/sdk/appearance-token-vars-BA3KQyEE.js +2 -0
  40. package/dist/esm/sdk/{export-viewer-host-CVdpEuY6.js → export-viewer-host-C9n-62Pi.js} +1 -1
  41. package/dist/esm/sdk/{exportKeypairOperation-gVCqLrDl.js → exportKeypairOperation-Du9HKB8f.js} +1 -1
  42. package/dist/esm/sdk/host-C5KYWEcs.js +1 -0
  43. package/dist/esm/sdk/{localOnly-TXaYAZj-.js → localOnly-CvFSZFUy.js} +1 -1
  44. package/dist/esm/sdk/{mountExportPrivateKeySurface-DUnKOBQr.js → mountExportPrivateKeySurface-DdJHWwqY.js} +1 -1
  45. package/dist/esm/sdk/{mountRecoveryCodeBackupSurface-MGTl6FhG.js → mountRecoveryCodeBackupSurface-D3QFgMGE.js} +1 -1
  46. package/dist/{public/sdk/pendingWalletRecoveryCodeBackup-DWeemdJv.js → esm/sdk/pendingWalletRecoveryCodeBackup-LbstFwcY.js} +1 -1
  47. package/dist/esm/sdk/{registration-DVX_lnP7.js → registration-CIxJvbTo.js} +1 -1
  48. package/dist/esm/sdk/{registration-DeCUrUR9.js → registration-CeOmKyCG.js} +1 -1
  49. package/dist/{public/sdk/runtime-auth-BAGyfscG.js → esm/sdk/runtime-auth-C0V-5znH.js} +1 -1
  50. package/dist/{public/sdk/runtime-device-link-DKkMLVor.js → esm/sdk/runtime-device-link-B1jpHQSF.js} +1 -1
  51. package/dist/{public/sdk/runtime-ecdsa-tempo-0TAVH1xg.js → esm/sdk/runtime-ecdsa-tempo-CDSZ3pxS.js} +1 -1
  52. package/dist/esm/sdk/{runtime-email-otp-DoHa8Hif.js → runtime-email-otp-DXuxFOjL.js} +1 -1
  53. package/dist/esm/sdk/{runtime-export-CAt17IFH.js → runtime-export-Ba12ChDI.js} +1 -1
  54. package/dist/esm/sdk/{runtime-near-BQX9Jk9Z.js → runtime-near-DRrdWzmr.js} +1 -1
  55. package/dist/esm/sdk/{runtime-preferences-BuKTIpv6.js → runtime-preferences-BWyhRaBA.js} +1 -1
  56. package/dist/esm/sdk/{runtime-recovery-DyxJKKNw.js → runtime-recovery-DlJlaZlf.js} +1 -1
  57. package/dist/esm/sdk/{runtime-recovery-codes-CWmt0FDB.js → runtime-recovery-codes-CuqYWqK7.js} +1 -1
  58. package/dist/esm/sdk/{shared-BVps1f3F.js → shared-B95wnpoD.js} +1 -1
  59. package/dist/esm/sdk/transaction-activity-CpDMkSPm.js +1 -0
  60. package/dist/esm/sdk/tx-confirm-ui.js +186 -71
  61. package/dist/esm/sdk/wallet-iframe-host-ecdsa.js +1 -1
  62. package/dist/esm/sdk/wallet-iframe-host-full.js +1 -1
  63. package/dist/esm/sdk/wallet-iframe-host-near.js +1 -1
  64. package/dist/esm/sdk/wallet-iframe-host-runtime.js +1 -1
  65. package/dist/esm/sdk/wallet-ui.css +1 -1
  66. package/dist/{public/sdk/walletRecoveryAdminProof-CIoLawfC.js → esm/sdk/walletRecoveryAdminProof-CtH8_lph.js} +1 -1
  67. package/dist/public/headers.manifest.json +1 -1
  68. package/dist/{esm/sdk/ConfirmationDrawer-B7RCp58z.js → public/sdk/ConfirmationDrawer-Ck33ZmU-.js} +1 -1
  69. package/dist/public/sdk/adapters-CgJpSAxH.js +2 -0
  70. package/dist/public/sdk/appearance-token-vars-BA3KQyEE.js +2 -0
  71. package/dist/public/sdk/{export-viewer-host-CVdpEuY6.js → export-viewer-host-C9n-62Pi.js} +1 -1
  72. package/dist/public/sdk/{exportKeypairOperation-gVCqLrDl.js → exportKeypairOperation-Du9HKB8f.js} +1 -1
  73. package/dist/public/sdk/host-C5KYWEcs.js +1 -0
  74. package/dist/public/sdk/{localOnly-TXaYAZj-.js → localOnly-CvFSZFUy.js} +1 -1
  75. package/dist/public/sdk/{mountExportPrivateKeySurface-DUnKOBQr.js → mountExportPrivateKeySurface-DdJHWwqY.js} +1 -1
  76. package/dist/public/sdk/{mountRecoveryCodeBackupSurface-MGTl6FhG.js → mountRecoveryCodeBackupSurface-D3QFgMGE.js} +1 -1
  77. package/dist/{esm/sdk/pendingWalletRecoveryCodeBackup-DWeemdJv.js → public/sdk/pendingWalletRecoveryCodeBackup-LbstFwcY.js} +1 -1
  78. package/dist/public/sdk/{registration-DVX_lnP7.js → registration-CIxJvbTo.js} +1 -1
  79. package/dist/public/sdk/{registration-DeCUrUR9.js → registration-CeOmKyCG.js} +1 -1
  80. package/dist/{esm/sdk/runtime-auth-BAGyfscG.js → public/sdk/runtime-auth-C0V-5znH.js} +1 -1
  81. package/dist/{esm/sdk/runtime-device-link-DKkMLVor.js → public/sdk/runtime-device-link-B1jpHQSF.js} +1 -1
  82. package/dist/{esm/sdk/runtime-ecdsa-tempo-0TAVH1xg.js → public/sdk/runtime-ecdsa-tempo-CDSZ3pxS.js} +1 -1
  83. package/dist/public/sdk/{runtime-email-otp-DoHa8Hif.js → runtime-email-otp-DXuxFOjL.js} +1 -1
  84. package/dist/public/sdk/{runtime-export-CAt17IFH.js → runtime-export-Ba12ChDI.js} +1 -1
  85. package/dist/public/sdk/{runtime-near-BQX9Jk9Z.js → runtime-near-DRrdWzmr.js} +1 -1
  86. package/dist/public/sdk/{runtime-preferences-BuKTIpv6.js → runtime-preferences-BWyhRaBA.js} +1 -1
  87. package/dist/public/sdk/{runtime-recovery-DyxJKKNw.js → runtime-recovery-DlJlaZlf.js} +1 -1
  88. package/dist/public/sdk/{runtime-recovery-codes-CWmt0FDB.js → runtime-recovery-codes-CuqYWqK7.js} +1 -1
  89. package/dist/public/sdk/{shared-BVps1f3F.js → shared-B95wnpoD.js} +1 -1
  90. package/dist/public/sdk/transaction-activity-CpDMkSPm.js +1 -0
  91. package/dist/public/sdk/tx-confirm-ui.js +186 -71
  92. package/dist/public/sdk/wallet-iframe-host-ecdsa.js +1 -1
  93. package/dist/public/sdk/wallet-iframe-host-full.js +1 -1
  94. package/dist/public/sdk/wallet-iframe-host-near.js +1 -1
  95. package/dist/public/sdk/wallet-iframe-host-runtime.js +1 -1
  96. package/dist/public/sdk/wallet-ui.css +1 -1
  97. package/dist/{esm/sdk/walletRecoveryAdminProof-CIoLawfC.js → public/sdk/walletRecoveryAdminProof-CtH8_lph.js} +1 -1
  98. package/dist/public/wallet-assets.manifest.json +50 -51
  99. package/dist/public/wallet-service/index.html +4 -4
  100. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/auth-menu/controller.d.ts +2 -0
  101. package/dist/types/wallet/src/core/signingEngine/uiConfirm/ui/transaction-activity.d.ts +2 -2
  102. package/dist/types/wallet/src/core/signingEngine/uiConfirm/ui/transaction-receipt.d.ts +25 -6
  103. package/dist/types/wallet/src/core/ui/messages.d.ts +1 -1
  104. package/dist/types/wallet/src/externalNear/actions.d.ts +20 -0
  105. package/dist/types/wallet/src/externalNear/boundary.d.ts +7 -0
  106. package/dist/types/wallet/src/externalNear/controller.d.ts +23 -0
  107. package/dist/types/wallet/src/externalNear/hot.d.ts +13 -0
  108. package/dist/types/wallet/src/externalNear/index.d.ts +4 -0
  109. package/dist/types/wallet/src/externalNear/intear.d.ts +12 -0
  110. package/dist/types/wallet/src/externalNear/intearPopup.d.ts +25 -0
  111. package/dist/types/wallet/src/externalNear/meteor.d.ts +16 -0
  112. package/dist/types/wallet/src/externalNear/meteorRequest.d.ts +29 -0
  113. package/dist/types/wallet/src/externalNear/types.d.ts +67 -0
  114. package/dist/types/wallet/src/externalNear/wallets.d.ts +4 -0
  115. package/dist/types/wallet/src/plugins/plugin-utils.d.ts +1 -1
  116. package/dist/types/wallet/src/react/components/AccountMenuButton/icons/MapPinIcon.d.ts +2 -0
  117. package/dist/types/wallet/src/react/externalNear.d.ts +26 -0
  118. package/package.json +18 -1
  119. package/dist/esm/plugins/SeamsWeb/walletIframe/sanitization.js +0 -18
  120. package/dist/esm/react/components/AccountMenuButton/SegmentedControl.js +0 -77
  121. package/dist/esm/sdk/adapters-La60hveX.js +0 -2
  122. package/dist/esm/sdk/appearance-token-vars-Bu6YUWmf.js +0 -2
  123. package/dist/esm/sdk/host-Bz7mRJPZ.js +0 -1
  124. package/dist/esm/sdk/transaction-activity-D5f-Yn9t.js +0 -1
  125. package/dist/public/sdk/adapters-La60hveX.js +0 -2
  126. package/dist/public/sdk/appearance-token-vars-Bu6YUWmf.js +0 -2
  127. package/dist/public/sdk/host-Bz7mRJPZ.js +0 -1
  128. package/dist/public/sdk/transaction-activity-D5f-Yn9t.js +0 -1
  129. package/dist/types/wallet/src/react/components/AccountMenuButton/SegmentedControl.d.ts +0 -25
@@ -0,0 +1,33 @@
1
+ //#region src/externalNear/wallets.ts
2
+ function nearWalletName(wallet) {
3
+ switch (wallet) {
4
+ case "meteor": return "Meteor Wallet";
5
+ case "hot": return "HOT Wallet";
6
+ case "intear": return "Intear Wallet";
7
+ default: return assertNever(wallet);
8
+ }
9
+ }
10
+ function assertNever(value) {
11
+ throw new Error(`Unknown NEAR wallet: ${value}`);
12
+ }
13
+ async function createNearWalletProvider(wallet, rpcUrl) {
14
+ switch (wallet) {
15
+ case "meteor": {
16
+ const { MeteorExtensionProvider } = await import("./meteor.js");
17
+ return new MeteorExtensionProvider(rpcUrl);
18
+ }
19
+ case "hot": {
20
+ const { HotExtensionProvider } = await import("./hot.js");
21
+ return new HotExtensionProvider();
22
+ }
23
+ case "intear": {
24
+ const { IntearWalletProvider } = await import("./intear.js");
25
+ return new IntearWalletProvider();
26
+ }
27
+ default: return assertNever(wallet);
28
+ }
29
+ }
30
+ //#endregion
31
+ export { createNearWalletProvider, nearWalletName };
32
+
33
+ //# sourceMappingURL=wallets.js.map
@@ -0,0 +1,67 @@
1
+ //#region ../../node_modules/borsh/lib/esm/buffer.js
2
+ var EncodeBuffer = function() {
3
+ function EncodeBuffer() {
4
+ this.offset = 0;
5
+ this.buffer_size = 256;
6
+ this.buffer = new ArrayBuffer(this.buffer_size);
7
+ this.view = new DataView(this.buffer);
8
+ }
9
+ EncodeBuffer.prototype.resize_if_necessary = function(needed_space) {
10
+ if (this.buffer_size - this.offset < needed_space) {
11
+ this.buffer_size = Math.max(this.buffer_size * 2, this.buffer_size + needed_space);
12
+ var new_buffer = new ArrayBuffer(this.buffer_size);
13
+ new Uint8Array(new_buffer).set(new Uint8Array(this.buffer));
14
+ this.buffer = new_buffer;
15
+ this.view = new DataView(new_buffer);
16
+ }
17
+ };
18
+ EncodeBuffer.prototype.get_used_buffer = function() {
19
+ return new Uint8Array(this.buffer).slice(0, this.offset);
20
+ };
21
+ EncodeBuffer.prototype.store_value = function(value, type) {
22
+ var bSize = type.substring(1);
23
+ var size = parseInt(bSize) / 8;
24
+ this.resize_if_necessary(size);
25
+ var toCall = type[0] === "f" ? "setFloat".concat(bSize) : type[0] === "i" ? "setInt".concat(bSize) : "setUint".concat(bSize);
26
+ this.view[toCall](this.offset, value, true);
27
+ this.offset += size;
28
+ };
29
+ EncodeBuffer.prototype.store_bytes = function(from) {
30
+ this.resize_if_necessary(from.length);
31
+ new Uint8Array(this.buffer).set(new Uint8Array(from), this.offset);
32
+ this.offset += from.length;
33
+ };
34
+ return EncodeBuffer;
35
+ }();
36
+ var DecodeBuffer = function() {
37
+ function DecodeBuffer(buf) {
38
+ this.offset = 0;
39
+ this.buffer_size = buf.length;
40
+ this.buffer = new ArrayBuffer(buf.length);
41
+ new Uint8Array(this.buffer).set(buf);
42
+ this.view = new DataView(this.buffer);
43
+ }
44
+ DecodeBuffer.prototype.assert_enough_buffer = function(size) {
45
+ if (this.offset + size > this.buffer.byteLength) throw new Error("Error in schema, the buffer is smaller than expected");
46
+ };
47
+ DecodeBuffer.prototype.consume_value = function(type) {
48
+ var bSize = type.substring(1);
49
+ var size = parseInt(bSize) / 8;
50
+ this.assert_enough_buffer(size);
51
+ var toCall = type[0] === "f" ? "getFloat".concat(bSize) : type[0] === "i" ? "getInt".concat(bSize) : "getUint".concat(bSize);
52
+ var ret = this.view[toCall](this.offset, true);
53
+ this.offset += size;
54
+ return ret;
55
+ };
56
+ DecodeBuffer.prototype.consume_bytes = function(size) {
57
+ this.assert_enough_buffer(size);
58
+ var ret = this.buffer.slice(this.offset, this.offset + size);
59
+ this.offset += size;
60
+ return ret;
61
+ };
62
+ return DecodeBuffer;
63
+ }();
64
+ //#endregion
65
+ export { DecodeBuffer, EncodeBuffer };
66
+
67
+ //# sourceMappingURL=buffer.js.map
@@ -0,0 +1,94 @@
1
+ import { integers } from "./types.js";
2
+ import { DecodeBuffer } from "./buffer.js";
3
+ (function() {
4
+ function BorshDeserializer(bufferArray) {
5
+ this.buffer = new DecodeBuffer(bufferArray);
6
+ }
7
+ BorshDeserializer.prototype.decode = function(schema) {
8
+ return this.decode_value(schema);
9
+ };
10
+ BorshDeserializer.prototype.decode_value = function(schema) {
11
+ if (typeof schema === "string") {
12
+ if (integers.includes(schema)) return this.decode_integer(schema);
13
+ if (schema === "string") return this.decode_string();
14
+ if (schema === "bool") return this.decode_boolean();
15
+ }
16
+ if (typeof schema === "object") {
17
+ if ("option" in schema) return this.decode_option(schema);
18
+ if ("enum" in schema) return this.decode_enum(schema);
19
+ if ("array" in schema) return this.decode_array(schema);
20
+ if ("set" in schema) return this.decode_set(schema);
21
+ if ("map" in schema) return this.decode_map(schema);
22
+ if ("struct" in schema) return this.decode_struct(schema);
23
+ }
24
+ throw new Error("Unsupported type: ".concat(schema));
25
+ };
26
+ BorshDeserializer.prototype.decode_integer = function(schema) {
27
+ var size = parseInt(schema.substring(1));
28
+ if (size <= 32 || schema == "f64") return this.buffer.consume_value(schema);
29
+ return this.decode_bigint(size, schema.startsWith("i"));
30
+ };
31
+ BorshDeserializer.prototype.decode_bigint = function(size, signed) {
32
+ if (signed === void 0) signed = false;
33
+ var buffer_len = size / 8;
34
+ var buffer = new Uint8Array(this.buffer.consume_bytes(buffer_len));
35
+ var bits = buffer.reduceRight(function(r, x) {
36
+ return r + x.toString(16).padStart(2, "0");
37
+ }, "");
38
+ if (signed && buffer[buffer_len - 1]) return BigInt.asIntN(size, BigInt("0x".concat(bits)));
39
+ return BigInt("0x".concat(bits));
40
+ };
41
+ BorshDeserializer.prototype.decode_string = function() {
42
+ var len = this.decode_integer("u32");
43
+ var buffer = new Uint8Array(this.buffer.consume_bytes(len));
44
+ return String.fromCharCode.apply(null, buffer);
45
+ };
46
+ BorshDeserializer.prototype.decode_boolean = function() {
47
+ return this.buffer.consume_value("u8") > 0;
48
+ };
49
+ BorshDeserializer.prototype.decode_option = function(schema) {
50
+ var option = this.buffer.consume_value("u8");
51
+ if (option === 1) return this.decode_value(schema.option);
52
+ if (option !== 0) throw new Error("Invalid option ".concat(option));
53
+ return null;
54
+ };
55
+ BorshDeserializer.prototype.decode_enum = function(schema) {
56
+ var _a;
57
+ var valueIndex = this.buffer.consume_value("u8");
58
+ if (valueIndex > schema["enum"].length) throw new Error("Enum option ".concat(valueIndex, " is not available"));
59
+ var struct = schema["enum"][valueIndex].struct;
60
+ var key = Object.keys(struct)[0];
61
+ return _a = {}, _a[key] = this.decode_value(struct[key]), _a;
62
+ };
63
+ BorshDeserializer.prototype.decode_array = function(schema) {
64
+ var result = [];
65
+ var len = schema.array.len ? schema.array.len : this.decode_integer("u32");
66
+ for (var i = 0; i < len; ++i) result.push(this.decode_value(schema.array.type));
67
+ return result;
68
+ };
69
+ BorshDeserializer.prototype.decode_set = function(schema) {
70
+ var len = this.decode_integer("u32");
71
+ var result = /* @__PURE__ */ new Set();
72
+ for (var i = 0; i < len; ++i) result.add(this.decode_value(schema.set));
73
+ return result;
74
+ };
75
+ BorshDeserializer.prototype.decode_map = function(schema) {
76
+ var len = this.decode_integer("u32");
77
+ var result = /* @__PURE__ */ new Map();
78
+ for (var i = 0; i < len; ++i) {
79
+ var key = this.decode_value(schema.map.key);
80
+ var value = this.decode_value(schema.map.value);
81
+ result.set(key, value);
82
+ }
83
+ return result;
84
+ };
85
+ BorshDeserializer.prototype.decode_struct = function(schema) {
86
+ var result = {};
87
+ for (var key in schema.struct) result[key] = this.decode_value(schema.struct[key]);
88
+ return result;
89
+ };
90
+ return BorshDeserializer;
91
+ })();
92
+ //#endregion
93
+
94
+ //# sourceMappingURL=deserialize.js.map
@@ -0,0 +1,13 @@
1
+ import { validate_schema } from "./utils.js";
2
+ import { BorshSerializer } from "./serialize.js";
3
+ import "./deserialize.js";
4
+ //#region ../../node_modules/borsh/lib/esm/index.js
5
+ function serialize(schema, value, validate) {
6
+ if (validate === void 0) validate = true;
7
+ if (validate) validate_schema(schema);
8
+ return new BorshSerializer(validate).encode(value, schema);
9
+ }
10
+ //#endregion
11
+ export { serialize };
12
+
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,127 @@
1
+ import { integers } from "./types.js";
2
+ import { EncodeBuffer } from "./buffer.js";
3
+ import { expect_bigint, expect_enum, expect_same_size, expect_type, isArrayLike } from "./utils.js";
4
+ //#region ../../node_modules/borsh/lib/esm/serialize.js
5
+ var BorshSerializer = function() {
6
+ function BorshSerializer(checkTypes) {
7
+ this.encoded = new EncodeBuffer();
8
+ this.fieldPath = ["value"];
9
+ this.checkTypes = checkTypes;
10
+ }
11
+ BorshSerializer.prototype.encode = function(value, schema) {
12
+ this.encode_value(value, schema);
13
+ return this.encoded.get_used_buffer();
14
+ };
15
+ BorshSerializer.prototype.encode_value = function(value, schema) {
16
+ if (typeof schema === "string") {
17
+ if (integers.includes(schema)) return this.encode_integer(value, schema);
18
+ if (schema === "string") return this.encode_string(value);
19
+ if (schema === "bool") return this.encode_boolean(value);
20
+ }
21
+ if (typeof schema === "object") {
22
+ if ("option" in schema) return this.encode_option(value, schema);
23
+ if ("enum" in schema) return this.encode_enum(value, schema);
24
+ if ("array" in schema) return this.encode_array(value, schema);
25
+ if ("set" in schema) return this.encode_set(value, schema);
26
+ if ("map" in schema) return this.encode_map(value, schema);
27
+ if ("struct" in schema) return this.encode_struct(value, schema);
28
+ }
29
+ };
30
+ BorshSerializer.prototype.encode_integer = function(value, schema) {
31
+ var size = parseInt(schema.substring(1));
32
+ if (size <= 32 || schema == "f64") {
33
+ this.checkTypes && expect_type(value, "number", this.fieldPath);
34
+ this.encoded.store_value(value, schema);
35
+ } else {
36
+ this.checkTypes && expect_bigint(value, this.fieldPath);
37
+ this.encode_bigint(BigInt(value), size);
38
+ }
39
+ };
40
+ BorshSerializer.prototype.encode_bigint = function(value, size) {
41
+ var buffer_len = size / 8;
42
+ var buffer = new Uint8Array(buffer_len);
43
+ for (var i = 0; i < buffer_len; i++) {
44
+ buffer[i] = Number(value & BigInt(255));
45
+ value = value >> BigInt(8);
46
+ }
47
+ this.encoded.store_bytes(new Uint8Array(buffer));
48
+ };
49
+ BorshSerializer.prototype.encode_string = function(value) {
50
+ this.checkTypes && expect_type(value, "string", this.fieldPath);
51
+ var _value = value;
52
+ this.encoded.store_value(_value.length, "u32");
53
+ for (var i = 0; i < _value.length; i++) this.encoded.store_value(_value.charCodeAt(i), "u8");
54
+ };
55
+ BorshSerializer.prototype.encode_boolean = function(value) {
56
+ this.checkTypes && expect_type(value, "boolean", this.fieldPath);
57
+ this.encoded.store_value(value ? 1 : 0, "u8");
58
+ };
59
+ BorshSerializer.prototype.encode_option = function(value, schema) {
60
+ if (value === null || value === void 0) this.encoded.store_value(0, "u8");
61
+ else {
62
+ this.encoded.store_value(1, "u8");
63
+ this.encode_value(value, schema.option);
64
+ }
65
+ };
66
+ BorshSerializer.prototype.encode_enum = function(value, schema) {
67
+ this.checkTypes && expect_enum(value, this.fieldPath);
68
+ var valueKey = Object.keys(value)[0];
69
+ for (var i = 0; i < schema["enum"].length; i++) {
70
+ var valueSchema = schema["enum"][i];
71
+ if (valueKey === Object.keys(valueSchema.struct)[0]) {
72
+ this.encoded.store_value(i, "u8");
73
+ return this.encode_struct(value, valueSchema);
74
+ }
75
+ }
76
+ throw new Error("Enum key (".concat(valueKey, ") not found in enum schema: ").concat(JSON.stringify(schema), " at ").concat(this.fieldPath.join(".")));
77
+ };
78
+ BorshSerializer.prototype.encode_array = function(value, schema) {
79
+ if (isArrayLike(value)) return this.encode_arraylike(value, schema);
80
+ if (value instanceof ArrayBuffer) return this.encode_buffer(value, schema);
81
+ throw new Error("Expected Array-like not ".concat(typeof value, "(").concat(value, ") at ").concat(this.fieldPath.join(".")));
82
+ };
83
+ BorshSerializer.prototype.encode_arraylike = function(value, schema) {
84
+ if (schema.array.len) expect_same_size(value.length, schema.array.len, this.fieldPath);
85
+ else this.encoded.store_value(value.length, "u32");
86
+ for (var i = 0; i < value.length; i++) this.encode_value(value[i], schema.array.type);
87
+ };
88
+ BorshSerializer.prototype.encode_buffer = function(value, schema) {
89
+ if (schema.array.len) expect_same_size(value.byteLength, schema.array.len, this.fieldPath);
90
+ else this.encoded.store_value(value.byteLength, "u32");
91
+ this.encoded.store_bytes(new Uint8Array(value));
92
+ };
93
+ BorshSerializer.prototype.encode_set = function(value, schema) {
94
+ this.checkTypes && expect_type(value, "object", this.fieldPath);
95
+ var values = value instanceof Set ? Array.from(value.values()) : Object.values(value);
96
+ this.encoded.store_value(values.length, "u32");
97
+ for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
98
+ var value_1 = values_1[_i];
99
+ this.encode_value(value_1, schema.set);
100
+ }
101
+ };
102
+ BorshSerializer.prototype.encode_map = function(value, schema) {
103
+ this.checkTypes && expect_type(value, "object", this.fieldPath);
104
+ var isMap = value instanceof Map;
105
+ var keys = isMap ? Array.from(value.keys()) : Object.keys(value);
106
+ this.encoded.store_value(keys.length, "u32");
107
+ for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
108
+ var key = keys_1[_i];
109
+ this.encode_value(key, schema.map.key);
110
+ this.encode_value(isMap ? value.get(key) : value[key], schema.map.value);
111
+ }
112
+ };
113
+ BorshSerializer.prototype.encode_struct = function(value, schema) {
114
+ this.checkTypes && expect_type(value, "object", this.fieldPath);
115
+ for (var _i = 0, _a = Object.keys(schema.struct); _i < _a.length; _i++) {
116
+ var key = _a[_i];
117
+ this.fieldPath.push(key);
118
+ this.encode_value(value[key], schema.struct[key]);
119
+ this.fieldPath.pop();
120
+ }
121
+ };
122
+ return BorshSerializer;
123
+ }();
124
+ //#endregion
125
+ export { BorshSerializer };
126
+
127
+ //# sourceMappingURL=serialize.js.map
@@ -0,0 +1,19 @@
1
+ //#region ../../node_modules/borsh/lib/esm/types.js
2
+ var integers = [
3
+ "u8",
4
+ "u16",
5
+ "u32",
6
+ "u64",
7
+ "u128",
8
+ "i8",
9
+ "i16",
10
+ "i32",
11
+ "i64",
12
+ "i128",
13
+ "f32",
14
+ "f64"
15
+ ];
16
+ //#endregion
17
+ export { integers };
18
+
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,104 @@
1
+ import { integers } from "./types.js";
2
+ //#region ../../node_modules/borsh/lib/esm/utils.js
3
+ var __extends = (function() {
4
+ var extendStatics = function(d, b) {
5
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
6
+ d.__proto__ = b;
7
+ } || function(d, b) {
8
+ for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
9
+ };
10
+ return extendStatics(d, b);
11
+ };
12
+ return function(d, b) {
13
+ if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
14
+ extendStatics(d, b);
15
+ function __() {
16
+ this.constructor = d;
17
+ }
18
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19
+ };
20
+ })();
21
+ function isArrayLike(value) {
22
+ return Array.isArray(value) || !!value && typeof value === "object" && "length" in value && typeof value.length === "number" && (value.length === 0 || value.length > 0 && value.length - 1 in value);
23
+ }
24
+ function expect_type(value, type, fieldPath) {
25
+ if (typeof value !== type) throw new Error("Expected ".concat(type, " not ").concat(typeof value, "(").concat(value, ") at ").concat(fieldPath.join(".")));
26
+ }
27
+ function expect_bigint(value, fieldPath) {
28
+ var basicType = [
29
+ "number",
30
+ "string",
31
+ "bigint",
32
+ "boolean"
33
+ ].includes(typeof value);
34
+ var strObject = typeof value === "object" && value !== null && "toString" in value;
35
+ if (!basicType && !strObject) throw new Error("Expected bigint, number, boolean or string not ".concat(typeof value, "(").concat(value, ") at ").concat(fieldPath.join(".")));
36
+ }
37
+ function expect_same_size(length, expected, fieldPath) {
38
+ if (length !== expected) throw new Error("Array length ".concat(length, " does not match schema length ").concat(expected, " at ").concat(fieldPath.join(".")));
39
+ }
40
+ function expect_enum(value, fieldPath) {
41
+ if (typeof value !== "object" || value === null) throw new Error("Expected object not ".concat(typeof value, "(").concat(value, ") at ").concat(fieldPath.join(".")));
42
+ }
43
+ var VALID_STRING_TYPES = integers.concat(["bool", "string"]);
44
+ var VALID_OBJECT_KEYS = [
45
+ "option",
46
+ "enum",
47
+ "array",
48
+ "set",
49
+ "map",
50
+ "struct"
51
+ ];
52
+ var ErrorSchema = function(_super) {
53
+ __extends(ErrorSchema, _super);
54
+ function ErrorSchema(schema, expected) {
55
+ var message = "Invalid schema: ".concat(JSON.stringify(schema), " expected ").concat(expected);
56
+ return _super.call(this, message) || this;
57
+ }
58
+ return ErrorSchema;
59
+ }(Error);
60
+ function validate_schema(schema) {
61
+ if (typeof schema === "string" && VALID_STRING_TYPES.includes(schema)) return;
62
+ if (schema && typeof schema === "object") {
63
+ var keys = Object.keys(schema);
64
+ if (keys.length === 1 && VALID_OBJECT_KEYS.includes(keys[0])) {
65
+ var key = keys[0];
66
+ if (key === "option") return validate_schema(schema[key]);
67
+ if (key === "enum") return validate_enum_schema(schema[key]);
68
+ if (key === "array") return validate_array_schema(schema[key]);
69
+ if (key === "set") return validate_schema(schema[key]);
70
+ if (key === "map") return validate_map_schema(schema[key]);
71
+ if (key === "struct") return validate_struct_schema(schema[key]);
72
+ }
73
+ }
74
+ throw new ErrorSchema(schema, VALID_OBJECT_KEYS.join(", ") + " or " + VALID_STRING_TYPES.join(", "));
75
+ }
76
+ function validate_enum_schema(schema) {
77
+ if (!Array.isArray(schema)) throw new ErrorSchema(schema, "Array");
78
+ for (var _i = 0, schema_1 = schema; _i < schema_1.length; _i++) {
79
+ var sch = schema_1[_i];
80
+ if (typeof sch !== "object" || !("struct" in sch)) throw new Error("Missing \"struct\" key in enum schema");
81
+ if (typeof sch.struct !== "object" || Object.keys(sch.struct).length !== 1) throw new Error("The \"struct\" in each enum must have a single key");
82
+ validate_schema({ struct: sch.struct });
83
+ }
84
+ }
85
+ function validate_array_schema(schema) {
86
+ if (typeof schema !== "object") throw new ErrorSchema(schema, "{ type, len? }");
87
+ if (schema.len && typeof schema.len !== "number") throw new Error("Invalid schema: ".concat(schema));
88
+ if ("type" in schema) return validate_schema(schema.type);
89
+ throw new ErrorSchema(schema, "{ type, len? }");
90
+ }
91
+ function validate_map_schema(schema) {
92
+ if (typeof schema === "object" && "key" in schema && "value" in schema) {
93
+ validate_schema(schema.key);
94
+ validate_schema(schema.value);
95
+ } else throw new ErrorSchema(schema, "{ key, value }");
96
+ }
97
+ function validate_struct_schema(schema) {
98
+ if (typeof schema !== "object") throw new ErrorSchema(schema, "object");
99
+ for (var key in schema) validate_schema(schema[key]);
100
+ }
101
+ //#endregion
102
+ export { expect_bigint, expect_enum, expect_same_size, expect_type, isArrayLike, validate_schema };
103
+
104
+ //# sourceMappingURL=utils.js.map
@@ -1,4 +1,3 @@
1
- import { escapeHtmlAttribute } from "./SeamsWeb/walletIframe/sanitization.js";
2
1
  import { normalizeWalletHostVariant, walletHostScriptFileForVariant } from "./core/browser/walletIframe/hostVariant.js";
3
2
  //#region src/plugins/plugin-utils.ts
4
3
  function withAssetVersion(url, assetVersion) {
@@ -6,19 +5,17 @@ function withAssetVersion(url, assetVersion) {
6
5
  if (!version) return url;
7
6
  return `${url}${url.includes("?") ? "&" : "?"}v=${encodeURIComponent(version)}`;
8
7
  }
9
- function buildWalletServiceHtml(sdkBasePath = "/sdk", assetVersion, walletHostVariant = "runtime", approvedRelayerOrigins = []) {
8
+ function buildWalletServiceHtml(sdkBasePath = "/sdk", assetVersion, walletHostVariant = "runtime") {
10
9
  const walletUiCss = withAssetVersion(`${sdkBasePath}/wallet-ui.css`, assetVersion);
11
10
  const walletShimsJs = withAssetVersion(`${sdkBasePath}/wallet-shims.js`, assetVersion);
12
11
  const walletHostScript = withAssetVersion(`${sdkBasePath}/${walletHostScriptFileForVariant(normalizeWalletHostVariant(walletHostVariant))}`, assetVersion);
13
- let relayerPolicy = "";
14
- for (const origin of approvedRelayerOrigins) relayerPolicy += ` <meta name="seams-wallet-relayer-origin" content="${escapeHtmlAttribute(origin)}" />\n`;
15
12
  return `<!doctype html>
16
13
  <html lang="en">
17
14
  <head>
18
15
  <meta charset="utf-8" />
19
16
  <meta name="viewport" content="width=device-width, initial-scale=1" />
20
17
  <title>Web3Authn Wallet Service</title>
21
- ${relayerPolicy} <!-- Surface styles are external so strict CSP can keep style-src 'self' -->
18
+ <!-- Surface styles are external so strict CSP can keep style-src 'self' -->
22
19
  <link rel="stylesheet" href="${walletUiCss}" />
23
20
  <!-- Minimal shims some ESM bundles expect (externalized to enable strict CSP) -->
24
21
  <script src="${walletShimsJs}"><\/script>
@@ -6,21 +6,35 @@ import "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import "./ProfileDropdown.css";
8
8
  //#region src/react/components/AccountMenuButton/ProfileDropdown.tsx
9
- const SECURITY_ITEMS = [
9
+ const MENU_ORDER = [
10
+ "accounts",
11
+ "transaction-settings",
10
12
  "authentication-methods",
13
+ "recovery-codes",
14
+ "linked-devices",
11
15
  "scan-link-device",
16
+ "export-keys"
17
+ ];
18
+ const SECURITY_ITEMS = [
19
+ "authentication-methods",
20
+ "recovery-codes",
12
21
  "linked-devices",
13
- "recovery-codes"
22
+ "scan-link-device",
23
+ "export-keys"
14
24
  ];
15
25
  function isSecurityItem(item) {
16
26
  return SECURITY_ITEMS.includes(item.id ?? "");
17
27
  }
18
- function compareSecurityItems(a, b) {
19
- return SECURITY_ITEMS.indexOf(a.id ?? "") - SECURITY_ITEMS.indexOf(b.id ?? "");
20
- }
21
- function isAccountItem(item) {
28
+ function isWalletItem(item) {
22
29
  return !isSecurityItem(item);
23
30
  }
31
+ function menuRank(item) {
32
+ const rank = MENU_ORDER.indexOf(item.id ?? "");
33
+ return rank === -1 ? MENU_ORDER.length : rank;
34
+ }
35
+ function compareMenuItems(a, b) {
36
+ return menuRank(a) - menuRank(b);
37
+ }
24
38
  function storeMenuRef(refs, index, element) {
25
39
  refs.current[index] = element;
26
40
  }
@@ -48,13 +62,13 @@ function ProfileDropdown(props) {
48
62
  className: "seams-profile-dropdown-menu",
49
63
  children: [
50
64
  /* @__PURE__ */ jsx(MenuGroup, {
51
- label: walletText(locale, "Addresses"),
52
- items: props.menuItems.filter(isAccountItem),
65
+ label: walletText(locale, "Wallet"),
66
+ items: props.menuItems.filter(isWalletItem).sort(compareMenuItems),
53
67
  props
54
68
  }),
55
69
  /* @__PURE__ */ jsx(MenuGroup, {
56
70
  label: walletText(locale, "Security & devices"),
57
- items: props.menuItems.filter(isSecurityItem).sort(compareSecurityItems),
71
+ items: props.menuItems.filter(isSecurityItem).sort(compareMenuItems),
58
72
  props
59
73
  }),
60
74
  /* @__PURE__ */ jsx(LockMenuItem, {