@thru/wallet 0.2.28 → 0.2.30

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.
@@ -475,7 +475,7 @@ var NativeThruChain = class {
475
475
 
476
476
  // src/native/provider/WebViewBridge.ts
477
477
  var PRODUCTION_WALLET_ORIGINS = [
478
- "https://wallet.thru.org",
478
+ "https://app.tid.sh",
479
479
  "https://wallet.tid.sh"
480
480
  ];
481
481
  function isDevelopmentBuild() {
@@ -711,7 +711,7 @@ var WebViewBridge = class {
711
711
  };
712
712
 
713
713
  // src/native/provider/NativeProvider.ts
714
- var DEFAULT_WALLET_URL = "https://wallet.thru.org/embedded/native";
714
+ var DEFAULT_WALLET_URL = "https://app.tid.sh/embedded/native";
715
715
  var DEFAULT_ORIGIN = "thru-mobile://app";
716
716
  var TRANSPARENT_FOCUS_SETTLE_MS = 500;
717
717
  var NativeProvider = class {
@@ -771,7 +771,7 @@ var NativeProvider = class {
771
771
  getIframeSrc() {
772
772
  return this.bridge.getIframeSrc();
773
773
  }
774
- /** Wallet origin (e.g. https://wallet.thru.org). The shell template
774
+ /** Wallet origin (e.g. https://app.tid.sh). The shell template
775
775
  should substitute this for WALLET_ORIGIN_PLACEHOLDER. */
776
776
  getWalletOrigin() {
777
777
  return this.bridge.walletOrigin;
@@ -845,6 +845,11 @@ var NativeProvider = class {
845
845
  const payload = {};
846
846
  if (options?.accountName) payload.accountName = options.accountName;
847
847
  if (options?.metadata) payload.metadata = options.metadata;
848
+ if (options?.createSigningSession) {
849
+ payload.createSigningSession = {
850
+ expiresAt: String(resolveSessionExpirySeconds(options.createSigningSession))
851
+ };
852
+ }
848
853
  const response = await this.bridge.sendMessage({
849
854
  id: createRequestId(),
850
855
  type: POST_MESSAGE_REQUEST_TYPES.CREATE_ACCOUNT,
@@ -1033,8 +1038,8 @@ var NativeProvider = class {
1033
1038
  var DEFAULT_STORAGE_KEY = "thru.native-sdk.connection.v1";
1034
1039
  var SELECTED_ACCOUNT_STORAGE_KEY_SUFFIX = ".selected-account.v1";
1035
1040
  var SIGNING_SESSION_STORAGE_KEY_SUFFIX = ".signing-sessions.v1";
1036
- var DEFAULT_NATIVE_WALLET_URL = "https://wallet.thru.org/embedded/native";
1037
- var DEFAULT_TRANSPARENT_WALLET_URL = "https://wallet.thru.org/embedded/native/transparent";
1041
+ var DEFAULT_NATIVE_WALLET_URL = "https://app.tid.sh/embedded/native";
1042
+ var DEFAULT_TRANSPARENT_WALLET_URL = "https://app.tid.sh/embedded/native/transparent";
1038
1043
  var CHECKING_WALLET_AVAILABILITY = {
1039
1044
  status: "checking",
1040
1045
  isAuthorized: false,
@@ -1058,6 +1063,16 @@ function completeAppMetadata(metadata) {
1058
1063
  ...metadata.imageUrl ? { imageUrl: metadata.imageUrl } : {}
1059
1064
  };
1060
1065
  }
1066
+ function signingSessionDescriptorFromWire(session) {
1067
+ return {
1068
+ id: session.id,
1069
+ walletAddress: session.walletAddress,
1070
+ publicKey: session.publicKey,
1071
+ authIdx: session.authIdx,
1072
+ expiresAt: Number(BigInt(session.expiresAt)),
1073
+ createdAt: Number(BigInt(session.createdAt))
1074
+ };
1075
+ }
1061
1076
  var NativeSDK = class {
1062
1077
  constructor(config = {}) {
1063
1078
  this.eventListeners = /* @__PURE__ */ new Map();
@@ -1088,6 +1103,7 @@ var NativeSDK = class {
1088
1103
  storageKey: config.signingSessionStorageKey ?? `${this.storageKey}${SIGNING_SESSION_STORAGE_KEY_SUFFIX}`
1089
1104
  })
1090
1105
  ) : void 0;
1106
+ this.signingSessions = signingSessions;
1091
1107
  this.provider = new NativeProvider({
1092
1108
  walletUrl,
1093
1109
  origin: this.origin,
@@ -1110,7 +1126,7 @@ var NativeSDK = class {
1110
1126
  getIframeSrc() {
1111
1127
  return this.provider.getIframeSrc();
1112
1128
  }
1113
- /** Wallet origin (e.g. https://wallet.thru.org). */
1129
+ /** Wallet origin (e.g. https://app.tid.sh). */
1114
1130
  getWalletOrigin() {
1115
1131
  return this.provider.getWalletOrigin();
1116
1132
  }
@@ -1209,7 +1225,8 @@ var NativeSDK = class {
1209
1225
  const metadata = this.resolveMetadata(options.metadata);
1210
1226
  const result = await this.provider.createAccount({
1211
1227
  ...options.accountName ? { accountName: options.accountName } : {},
1212
- ...metadata ? { metadata } : {}
1228
+ ...metadata ? { metadata } : {},
1229
+ ...options.createSigningSession ? { createSigningSession: options.createSigningSession } : {}
1213
1230
  });
1214
1231
  const selectedAccount = result.selectedAccount ?? result.account;
1215
1232
  const activeResult = {
@@ -1228,6 +1245,14 @@ var NativeSDK = class {
1228
1245
  await this.persistSelectedAccountAddress(
1229
1246
  activeResult.selectedAccount.address
1230
1247
  );
1248
+ if (activeResult.signingSession) {
1249
+ if (!this.signingSessions) {
1250
+ throw new Error("NativeSDKStorage is required for signing sessions");
1251
+ }
1252
+ await this.signingSessions.saveReplacingWalletSessions(
1253
+ signingSessionDescriptorFromWire(activeResult.signingSession)
1254
+ );
1255
+ }
1231
1256
  await this.clearPersistedConnection();
1232
1257
  this.setWalletAvailability(
1233
1258
  walletAvailabilityFromConnectResult(completedResult)