@dappworks/kit 0.4.215 → 0.4.217

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/wallet.mjs CHANGED
@@ -1,755 +1,29 @@
1
- import { AIem } from './chunk-3TBJNCTQ.mjs';
1
+ import { AIem } from './chunk-KDYLETUC.mjs';
2
2
  import './chunk-7MDKCI65.mjs';
3
3
  import { StorageState, ObjectPool, PromiseHook } from './chunk-DRTTNPZI.mjs';
4
4
  import './chunk-2QK7O5HJ.mjs';
5
- import { DialogStore } from './chunk-L6XS2K2K.mjs';
5
+ import { DialogStore } from './chunk-GT4R5SDI.mjs';
6
6
  import { ToastPlugin } from './chunk-IMOLRP7I.mjs';
7
7
  import './chunk-K73JTEJQ.mjs';
8
8
  import { RootStore } from './chunk-XSGTWROT.mjs';
9
9
  import { helper } from './chunk-R4N52NI2.mjs';
10
10
  import './chunk-ONVPCAMQ.mjs';
11
11
  import './chunk-K7LFG5BA.mjs';
12
- import { __commonJS, __toESM, __spreadValues, __spreadProps } from './chunk-2EXDWOHY.mjs';
12
+ import { __spreadValues, __spreadProps } from './chunk-R4SQKVDQ.mjs';
13
13
  import { getDefaultConfig, useConnectModal, RainbowKitProvider, darkTheme, lightTheme } from '@rainbow-me/rainbowkit';
14
14
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
15
15
  import React5, { useEffect, useState } from 'react';
16
- import { useWalletClient, useAccount, useSwitchChain, useConnect, useDisconnect, WagmiProvider, useReconnect } from 'wagmi';
16
+ import { useAccount, useSwitchChain, useConnect, useDisconnect, WagmiProvider, useReconnect } from 'wagmi';
17
+ import { createWalletClient, custom, publicActions } from 'viem';
17
18
  import EventEmitter from 'events';
18
19
  import { Icon } from '@iconify/react';
19
- import { encodeFunctionData, hashMessage, hashTypedData } from 'viem';
20
+ import SafeAppsSDK, { TransactionStatus } from '@safe-global/safe-apps-sdk';
20
21
  import { observer } from 'mobx-react-lite';
21
22
  import { iopayWallet, metaMaskWallet, walletConnectWallet, okxWallet, binanceWallet, safeWallet } from '@rainbow-me/rainbowkit/wallets';
22
23
  import { reaction } from 'mobx';
23
24
  import { iotex as iotex$1, iotexTestnet as iotexTestnet$1 } from 'viem/chains';
24
25
  import { Checkbox, Tooltip, Button, Popover, PopoverTrigger, PopoverContent, Input, Table, TableHeader, TableColumn, TableBody, TableRow, TableCell } from '@nextui-org/react';
25
26
 
26
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/utils.js
27
- var require_utils = __commonJS({
28
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/utils.js"(exports) {
29
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
30
- function adopt(value) {
31
- return value instanceof P ? value : new P(function(resolve) {
32
- resolve(value);
33
- });
34
- }
35
- return new (P || (P = Promise))(function(resolve, reject) {
36
- function fulfilled(value) {
37
- try {
38
- step(generator.next(value));
39
- } catch (e) {
40
- reject(e);
41
- }
42
- }
43
- function rejected(value) {
44
- try {
45
- step(generator["throw"](value));
46
- } catch (e) {
47
- reject(e);
48
- }
49
- }
50
- function step(result) {
51
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
52
- }
53
- step((generator = generator.apply(thisArg, _arguments || [])).next());
54
- });
55
- };
56
- Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.getData = exports.fetchData = exports.stringifyQuery = exports.insertParams = void 0;
58
- var isErrorResponse = (data) => {
59
- const isObject = typeof data === "object" && data !== null;
60
- return isObject && "code" in data && "message" in data;
61
- };
62
- function replaceParam(str, key, value) {
63
- return str.replace(new RegExp(`\\{${key}\\}`, "g"), value);
64
- }
65
- function insertParams(template, params) {
66
- return params ? Object.keys(params).reduce((result, key) => {
67
- return replaceParam(result, key, String(params[key]));
68
- }, template) : template;
69
- }
70
- exports.insertParams = insertParams;
71
- function stringifyQuery(query) {
72
- if (!query) {
73
- return "";
74
- }
75
- const searchParams = new URLSearchParams();
76
- Object.keys(query).forEach((key) => {
77
- if (query[key] != null) {
78
- searchParams.append(key, String(query[key]));
79
- }
80
- });
81
- const searchString = searchParams.toString();
82
- return searchString ? `?${searchString}` : "";
83
- }
84
- exports.stringifyQuery = stringifyQuery;
85
- function parseResponse(resp) {
86
- return __awaiter(this, void 0, void 0, function* () {
87
- let json;
88
- try {
89
- json = yield resp.json();
90
- } catch (_a) {
91
- json = {};
92
- }
93
- if (!resp.ok) {
94
- const errTxt = isErrorResponse(json) ? `CGW error - ${json.code}: ${json.message}` : `CGW error - status ${resp.statusText}`;
95
- throw new Error(errTxt);
96
- }
97
- return json;
98
- });
99
- }
100
- function fetchData(url, method, body, headers, credentials) {
101
- return __awaiter(this, void 0, void 0, function* () {
102
- const requestHeaders = Object.assign({ "Content-Type": "application/json" }, headers);
103
- const options = {
104
- method: method !== null && method !== void 0 ? method : "POST",
105
- headers: requestHeaders
106
- };
107
- if (credentials) {
108
- options["credentials"] = credentials;
109
- }
110
- if (body != null) {
111
- options.body = typeof body === "string" ? body : JSON.stringify(body);
112
- }
113
- const resp = yield fetch(url, options);
114
- return parseResponse(resp);
115
- });
116
- }
117
- exports.fetchData = fetchData;
118
- function getData(url, headers, credentials) {
119
- return __awaiter(this, void 0, void 0, function* () {
120
- const options = {
121
- method: "GET"
122
- };
123
- if (headers) {
124
- options["headers"] = Object.assign(Object.assign({}, headers), { "Content-Type": "application/json" });
125
- }
126
- if (credentials) {
127
- options["credentials"] = credentials;
128
- }
129
- const resp = yield fetch(url, options);
130
- return parseResponse(resp);
131
- });
132
- }
133
- exports.getData = getData;
134
- }
135
- });
136
-
137
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/endpoint.js
138
- var require_endpoint = __commonJS({
139
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/endpoint.js"(exports) {
140
- Object.defineProperty(exports, "__esModule", { value: true });
141
- exports.getEndpoint = exports.deleteEndpoint = exports.putEndpoint = exports.postEndpoint = void 0;
142
- var utils_1 = require_utils();
143
- function makeUrl(baseUrl, path, pathParams, query) {
144
- const pathname = (0, utils_1.insertParams)(path, pathParams);
145
- const search = (0, utils_1.stringifyQuery)(query);
146
- return `${baseUrl}${pathname}${search}`;
147
- }
148
- function postEndpoint(baseUrl, path, params) {
149
- const url = makeUrl(baseUrl, path, params === null || params === void 0 ? void 0 : params.path, params === null || params === void 0 ? void 0 : params.query);
150
- return (0, utils_1.fetchData)(url, "POST", params === null || params === void 0 ? void 0 : params.body, params === null || params === void 0 ? void 0 : params.headers, params === null || params === void 0 ? void 0 : params.credentials);
151
- }
152
- exports.postEndpoint = postEndpoint;
153
- function putEndpoint(baseUrl, path, params) {
154
- const url = makeUrl(baseUrl, path, params === null || params === void 0 ? void 0 : params.path, params === null || params === void 0 ? void 0 : params.query);
155
- return (0, utils_1.fetchData)(url, "PUT", params === null || params === void 0 ? void 0 : params.body, params === null || params === void 0 ? void 0 : params.headers, params === null || params === void 0 ? void 0 : params.credentials);
156
- }
157
- exports.putEndpoint = putEndpoint;
158
- function deleteEndpoint(baseUrl, path, params) {
159
- const url = makeUrl(baseUrl, path, params === null || params === void 0 ? void 0 : params.path, params === null || params === void 0 ? void 0 : params.query);
160
- return (0, utils_1.fetchData)(url, "DELETE", params === null || params === void 0 ? void 0 : params.body, params === null || params === void 0 ? void 0 : params.headers, params === null || params === void 0 ? void 0 : params.credentials);
161
- }
162
- exports.deleteEndpoint = deleteEndpoint;
163
- function getEndpoint(baseUrl, path, params, rawUrl) {
164
- if (rawUrl) {
165
- return (0, utils_1.getData)(rawUrl, void 0, params === null || params === void 0 ? void 0 : params.credentials);
166
- }
167
- const url = makeUrl(baseUrl, path, params === null || params === void 0 ? void 0 : params.path, params === null || params === void 0 ? void 0 : params.query);
168
- return (0, utils_1.getData)(url, params === null || params === void 0 ? void 0 : params.headers, params === null || params === void 0 ? void 0 : params.credentials);
169
- }
170
- exports.getEndpoint = getEndpoint;
171
- }
172
- });
173
-
174
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/config.js
175
- var require_config = __commonJS({
176
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/config.js"(exports) {
177
- Object.defineProperty(exports, "__esModule", { value: true });
178
- exports.DEFAULT_BASE_URL = void 0;
179
- exports.DEFAULT_BASE_URL = "https://safe-client.safe.global";
180
- }
181
- });
182
-
183
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/safe-info.js
184
- var require_safe_info = __commonJS({
185
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/safe-info.js"(exports) {
186
- Object.defineProperty(exports, "__esModule", { value: true });
187
- exports.ImplementationVersionState = void 0;
188
- (function(ImplementationVersionState2) {
189
- ImplementationVersionState2["UP_TO_DATE"] = "UP_TO_DATE";
190
- ImplementationVersionState2["OUTDATED"] = "OUTDATED";
191
- ImplementationVersionState2["UNKNOWN"] = "UNKNOWN";
192
- })(exports.ImplementationVersionState || (exports.ImplementationVersionState = {}));
193
- }
194
- });
195
-
196
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/safe-apps.js
197
- var require_safe_apps = __commonJS({
198
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/safe-apps.js"(exports) {
199
- Object.defineProperty(exports, "__esModule", { value: true });
200
- exports.SafeAppSocialPlatforms = exports.SafeAppFeatures = exports.SafeAppAccessPolicyTypes = void 0;
201
- (function(SafeAppAccessPolicyTypes2) {
202
- SafeAppAccessPolicyTypes2["NoRestrictions"] = "NO_RESTRICTIONS";
203
- SafeAppAccessPolicyTypes2["DomainAllowlist"] = "DOMAIN_ALLOWLIST";
204
- })(exports.SafeAppAccessPolicyTypes || (exports.SafeAppAccessPolicyTypes = {}));
205
- (function(SafeAppFeatures2) {
206
- SafeAppFeatures2["BATCHED_TRANSACTIONS"] = "BATCHED_TRANSACTIONS";
207
- })(exports.SafeAppFeatures || (exports.SafeAppFeatures = {}));
208
- (function(SafeAppSocialPlatforms2) {
209
- SafeAppSocialPlatforms2["TWITTER"] = "TWITTER";
210
- SafeAppSocialPlatforms2["GITHUB"] = "GITHUB";
211
- SafeAppSocialPlatforms2["DISCORD"] = "DISCORD";
212
- })(exports.SafeAppSocialPlatforms || (exports.SafeAppSocialPlatforms = {}));
213
- }
214
- });
215
-
216
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/transactions.js
217
- var require_transactions = __commonJS({
218
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/transactions.js"(exports) {
219
- Object.defineProperty(exports, "__esModule", { value: true });
220
- exports.LabelValue = exports.StartTimeValue = exports.DurationType = exports.DetailedExecutionInfoType = exports.TransactionListItemType = exports.ConflictType = exports.TransactionInfoType = exports.SettingsInfoType = exports.TransactionTokenType = exports.TransferDirection = exports.TransactionStatus = exports.Operation = void 0;
221
- (function(Operation3) {
222
- Operation3[Operation3["CALL"] = 0] = "CALL";
223
- Operation3[Operation3["DELEGATE"] = 1] = "DELEGATE";
224
- })(exports.Operation || (exports.Operation = {}));
225
- (function(TransactionStatus3) {
226
- TransactionStatus3["AWAITING_CONFIRMATIONS"] = "AWAITING_CONFIRMATIONS";
227
- TransactionStatus3["AWAITING_EXECUTION"] = "AWAITING_EXECUTION";
228
- TransactionStatus3["CANCELLED"] = "CANCELLED";
229
- TransactionStatus3["FAILED"] = "FAILED";
230
- TransactionStatus3["SUCCESS"] = "SUCCESS";
231
- })(exports.TransactionStatus || (exports.TransactionStatus = {}));
232
- (function(TransferDirection3) {
233
- TransferDirection3["INCOMING"] = "INCOMING";
234
- TransferDirection3["OUTGOING"] = "OUTGOING";
235
- TransferDirection3["UNKNOWN"] = "UNKNOWN";
236
- })(exports.TransferDirection || (exports.TransferDirection = {}));
237
- (function(TransactionTokenType2) {
238
- TransactionTokenType2["ERC20"] = "ERC20";
239
- TransactionTokenType2["ERC721"] = "ERC721";
240
- TransactionTokenType2["NATIVE_COIN"] = "NATIVE_COIN";
241
- })(exports.TransactionTokenType || (exports.TransactionTokenType = {}));
242
- (function(SettingsInfoType2) {
243
- SettingsInfoType2["SET_FALLBACK_HANDLER"] = "SET_FALLBACK_HANDLER";
244
- SettingsInfoType2["ADD_OWNER"] = "ADD_OWNER";
245
- SettingsInfoType2["REMOVE_OWNER"] = "REMOVE_OWNER";
246
- SettingsInfoType2["SWAP_OWNER"] = "SWAP_OWNER";
247
- SettingsInfoType2["CHANGE_THRESHOLD"] = "CHANGE_THRESHOLD";
248
- SettingsInfoType2["CHANGE_IMPLEMENTATION"] = "CHANGE_IMPLEMENTATION";
249
- SettingsInfoType2["ENABLE_MODULE"] = "ENABLE_MODULE";
250
- SettingsInfoType2["DISABLE_MODULE"] = "DISABLE_MODULE";
251
- SettingsInfoType2["SET_GUARD"] = "SET_GUARD";
252
- SettingsInfoType2["DELETE_GUARD"] = "DELETE_GUARD";
253
- })(exports.SettingsInfoType || (exports.SettingsInfoType = {}));
254
- (function(TransactionInfoType2) {
255
- TransactionInfoType2["TRANSFER"] = "Transfer";
256
- TransactionInfoType2["SETTINGS_CHANGE"] = "SettingsChange";
257
- TransactionInfoType2["CUSTOM"] = "Custom";
258
- TransactionInfoType2["CREATION"] = "Creation";
259
- TransactionInfoType2["SWAP_ORDER"] = "SwapOrder";
260
- TransactionInfoType2["TWAP_ORDER"] = "TwapOrder";
261
- TransactionInfoType2["SWAP_TRANSFER"] = "SwapTransfer";
262
- })(exports.TransactionInfoType || (exports.TransactionInfoType = {}));
263
- (function(ConflictType2) {
264
- ConflictType2["NONE"] = "None";
265
- ConflictType2["HAS_NEXT"] = "HasNext";
266
- ConflictType2["END"] = "End";
267
- })(exports.ConflictType || (exports.ConflictType = {}));
268
- (function(TransactionListItemType2) {
269
- TransactionListItemType2["TRANSACTION"] = "TRANSACTION";
270
- TransactionListItemType2["LABEL"] = "LABEL";
271
- TransactionListItemType2["CONFLICT_HEADER"] = "CONFLICT_HEADER";
272
- TransactionListItemType2["DATE_LABEL"] = "DATE_LABEL";
273
- })(exports.TransactionListItemType || (exports.TransactionListItemType = {}));
274
- (function(DetailedExecutionInfoType2) {
275
- DetailedExecutionInfoType2["MULTISIG"] = "MULTISIG";
276
- DetailedExecutionInfoType2["MODULE"] = "MODULE";
277
- })(exports.DetailedExecutionInfoType || (exports.DetailedExecutionInfoType = {}));
278
- (function(DurationType2) {
279
- DurationType2["AUTO"] = "AUTO";
280
- DurationType2["LIMIT_DURATION"] = "LIMIT_DURATION";
281
- })(exports.DurationType || (exports.DurationType = {}));
282
- (function(StartTimeValue2) {
283
- StartTimeValue2["AT_MINING_TIME"] = "AT_MINING_TIME";
284
- StartTimeValue2["AT_EPOCH"] = "AT_EPOCH";
285
- })(exports.StartTimeValue || (exports.StartTimeValue = {}));
286
- (function(LabelValue2) {
287
- LabelValue2["Queued"] = "Queued";
288
- LabelValue2["Next"] = "Next";
289
- })(exports.LabelValue || (exports.LabelValue = {}));
290
- }
291
- });
292
-
293
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/chains.js
294
- var require_chains = __commonJS({
295
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/chains.js"(exports) {
296
- Object.defineProperty(exports, "__esModule", { value: true });
297
- exports.FEATURES = exports.GAS_PRICE_TYPE = exports.RPC_AUTHENTICATION = void 0;
298
- (function(RPC_AUTHENTICATION2) {
299
- RPC_AUTHENTICATION2["API_KEY_PATH"] = "API_KEY_PATH";
300
- RPC_AUTHENTICATION2["NO_AUTHENTICATION"] = "NO_AUTHENTICATION";
301
- RPC_AUTHENTICATION2["UNKNOWN"] = "UNKNOWN";
302
- })(exports.RPC_AUTHENTICATION || (exports.RPC_AUTHENTICATION = {}));
303
- (function(GAS_PRICE_TYPE2) {
304
- GAS_PRICE_TYPE2["ORACLE"] = "ORACLE";
305
- GAS_PRICE_TYPE2["FIXED"] = "FIXED";
306
- GAS_PRICE_TYPE2["FIXED_1559"] = "FIXED1559";
307
- GAS_PRICE_TYPE2["UNKNOWN"] = "UNKNOWN";
308
- })(exports.GAS_PRICE_TYPE || (exports.GAS_PRICE_TYPE = {}));
309
- (function(FEATURES2) {
310
- FEATURES2["ERC721"] = "ERC721";
311
- FEATURES2["SAFE_APPS"] = "SAFE_APPS";
312
- FEATURES2["CONTRACT_INTERACTION"] = "CONTRACT_INTERACTION";
313
- FEATURES2["DOMAIN_LOOKUP"] = "DOMAIN_LOOKUP";
314
- FEATURES2["SPENDING_LIMIT"] = "SPENDING_LIMIT";
315
- FEATURES2["EIP1559"] = "EIP1559";
316
- FEATURES2["SAFE_TX_GAS_OPTIONAL"] = "SAFE_TX_GAS_OPTIONAL";
317
- FEATURES2["TX_SIMULATION"] = "TX_SIMULATION";
318
- FEATURES2["EIP1271"] = "EIP1271";
319
- })(exports.FEATURES || (exports.FEATURES = {}));
320
- }
321
- });
322
-
323
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/common.js
324
- var require_common = __commonJS({
325
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/common.js"(exports) {
326
- Object.defineProperty(exports, "__esModule", { value: true });
327
- exports.TokenType = void 0;
328
- (function(TokenType3) {
329
- TokenType3["ERC20"] = "ERC20";
330
- TokenType3["ERC721"] = "ERC721";
331
- TokenType3["NATIVE_TOKEN"] = "NATIVE_TOKEN";
332
- })(exports.TokenType || (exports.TokenType = {}));
333
- }
334
- });
335
-
336
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/master-copies.js
337
- var require_master_copies = __commonJS({
338
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/master-copies.js"(exports) {
339
- Object.defineProperty(exports, "__esModule", { value: true });
340
- }
341
- });
342
-
343
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/decoded-data.js
344
- var require_decoded_data = __commonJS({
345
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/decoded-data.js"(exports) {
346
- Object.defineProperty(exports, "__esModule", { value: true });
347
- exports.ConfirmationViewTypes = void 0;
348
- (function(ConfirmationViewTypes2) {
349
- ConfirmationViewTypes2["COW_SWAP_ORDER"] = "COW_SWAP_ORDER";
350
- ConfirmationViewTypes2["COW_SWAP_TWAP_ORDER"] = "COW_SWAP_TWAP_ORDER";
351
- })(exports.ConfirmationViewTypes || (exports.ConfirmationViewTypes = {}));
352
- }
353
- });
354
-
355
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/safe-messages.js
356
- var require_safe_messages = __commonJS({
357
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/safe-messages.js"(exports) {
358
- Object.defineProperty(exports, "__esModule", { value: true });
359
- exports.SafeMessageStatus = exports.SafeMessageListItemType = void 0;
360
- (function(SafeMessageListItemType2) {
361
- SafeMessageListItemType2["DATE_LABEL"] = "DATE_LABEL";
362
- SafeMessageListItemType2["MESSAGE"] = "MESSAGE";
363
- })(exports.SafeMessageListItemType || (exports.SafeMessageListItemType = {}));
364
- (function(SafeMessageStatus2) {
365
- SafeMessageStatus2["NEEDS_CONFIRMATION"] = "NEEDS_CONFIRMATION";
366
- SafeMessageStatus2["CONFIRMED"] = "CONFIRMED";
367
- })(exports.SafeMessageStatus || (exports.SafeMessageStatus = {}));
368
- }
369
- });
370
-
371
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/notifications.js
372
- var require_notifications = __commonJS({
373
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/notifications.js"(exports) {
374
- Object.defineProperty(exports, "__esModule", { value: true });
375
- exports.DeviceType = void 0;
376
- (function(DeviceType2) {
377
- DeviceType2["ANDROID"] = "ANDROID";
378
- DeviceType2["IOS"] = "IOS";
379
- DeviceType2["WEB"] = "WEB";
380
- })(exports.DeviceType || (exports.DeviceType = {}));
381
- }
382
- });
383
-
384
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/relay.js
385
- var require_relay = __commonJS({
386
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/types/relay.js"(exports) {
387
- Object.defineProperty(exports, "__esModule", { value: true });
388
- }
389
- });
390
-
391
- // ../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/index.js
392
- var require_dist = __commonJS({
393
- "../../node_modules/@safe-global/safe-gateway-typescript-sdk/dist/index.js"(exports) {
394
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
395
- if (k2 === void 0)
396
- k2 = k;
397
- var desc = Object.getOwnPropertyDescriptor(m, k);
398
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
399
- desc = { enumerable: true, get: function() {
400
- return m[k];
401
- } };
402
- }
403
- Object.defineProperty(o, k2, desc);
404
- } : function(o, m, k, k2) {
405
- if (k2 === void 0)
406
- k2 = k;
407
- o[k2] = m[k];
408
- });
409
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
410
- for (var p in m)
411
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
412
- __createBinding(exports2, m, p);
413
- };
414
- Object.defineProperty(exports, "__esModule", { value: true });
415
- exports.deleteAccount = exports.getAccount = exports.createAccount = exports.verifyAuth = exports.getAuthNonce = exports.getContract = exports.getSafeOverviews = exports.unsubscribeAll = exports.unsubscribeSingle = exports.registerRecoveryModule = exports.deleteRegisteredEmail = exports.getRegisteredEmail = exports.verifyEmail = exports.resendEmailVerificationCode = exports.changeEmail = exports.registerEmail = exports.unregisterDevice = exports.unregisterSafe = exports.registerDevice = exports.getDelegates = exports.confirmSafeMessage = exports.proposeSafeMessage = exports.getSafeMessage = exports.getSafeMessages = exports.getDecodedData = exports.getMasterCopies = exports.getSafeApps = exports.getChainConfig = exports.getChainsConfig = exports.getConfirmationView = exports.proposeTransaction = exports.getNonces = exports.postSafeGasEstimation = exports.deleteTransaction = exports.getTransactionDetails = exports.getTransactionQueue = exports.getTransactionHistory = exports.getCollectiblesPage = exports.getCollectibles = exports.getAllOwnedSafes = exports.getOwnedSafes = exports.getFiatCurrencies = exports.getBalances = exports.getMultisigTransactions = exports.getModuleTransactions = exports.getIncomingTransfers = exports.getSafeInfo = exports.getRelayCount = exports.relayTransaction = exports.setBaseUrl = void 0;
416
- exports.putAccountDataSettings = exports.getAccountDataSettings = exports.getAccountDataTypes = void 0;
417
- var endpoint_1 = require_endpoint();
418
- var config_1 = require_config();
419
- __exportStar(require_safe_info(), exports);
420
- __exportStar(require_safe_apps(), exports);
421
- __exportStar(require_transactions(), exports);
422
- __exportStar(require_chains(), exports);
423
- __exportStar(require_common(), exports);
424
- __exportStar(require_master_copies(), exports);
425
- __exportStar(require_decoded_data(), exports);
426
- __exportStar(require_safe_messages(), exports);
427
- __exportStar(require_notifications(), exports);
428
- __exportStar(require_relay(), exports);
429
- var baseUrl = config_1.DEFAULT_BASE_URL;
430
- var setBaseUrl = (url) => {
431
- baseUrl = url;
432
- };
433
- exports.setBaseUrl = setBaseUrl;
434
- function relayTransaction(chainId, body) {
435
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/chains/{chainId}/relay", { path: { chainId }, body });
436
- }
437
- exports.relayTransaction = relayTransaction;
438
- function getRelayCount(chainId, address) {
439
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/relay/{address}", { path: { chainId, address } });
440
- }
441
- exports.getRelayCount = getRelayCount;
442
- function getSafeInfo(chainId, address) {
443
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{address}", { path: { chainId, address } });
444
- }
445
- exports.getSafeInfo = getSafeInfo;
446
- function getIncomingTransfers(chainId, address, query, pageUrl) {
447
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{address}/incoming-transfers/", {
448
- path: { chainId, address },
449
- query
450
- }, pageUrl);
451
- }
452
- exports.getIncomingTransfers = getIncomingTransfers;
453
- function getModuleTransactions(chainId, address, query, pageUrl) {
454
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{address}/module-transactions/", {
455
- path: { chainId, address },
456
- query
457
- }, pageUrl);
458
- }
459
- exports.getModuleTransactions = getModuleTransactions;
460
- function getMultisigTransactions(chainId, address, query, pageUrl) {
461
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{address}/multisig-transactions/", {
462
- path: { chainId, address },
463
- query
464
- }, pageUrl);
465
- }
466
- exports.getMultisigTransactions = getMultisigTransactions;
467
- function getBalances(chainId, address, currency = "usd", query = {}) {
468
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{address}/balances/{currency}", {
469
- path: { chainId, address, currency },
470
- query
471
- });
472
- }
473
- exports.getBalances = getBalances;
474
- function getFiatCurrencies() {
475
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/balances/supported-fiat-codes");
476
- }
477
- exports.getFiatCurrencies = getFiatCurrencies;
478
- function getOwnedSafes(chainId, address) {
479
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/owners/{address}/safes", { path: { chainId, address } });
480
- }
481
- exports.getOwnedSafes = getOwnedSafes;
482
- function getAllOwnedSafes(address) {
483
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/owners/{address}/safes", { path: { address } });
484
- }
485
- exports.getAllOwnedSafes = getAllOwnedSafes;
486
- function getCollectibles(chainId, address, query = {}) {
487
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{address}/collectibles", {
488
- path: { chainId, address },
489
- query
490
- });
491
- }
492
- exports.getCollectibles = getCollectibles;
493
- function getCollectiblesPage(chainId, address, query = {}, pageUrl) {
494
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v2/chains/{chainId}/safes/{address}/collectibles", { path: { chainId, address }, query }, pageUrl);
495
- }
496
- exports.getCollectiblesPage = getCollectiblesPage;
497
- function getTransactionHistory(chainId, address, query = {}, pageUrl) {
498
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/transactions/history", { path: { chainId, safe_address: address }, query }, pageUrl);
499
- }
500
- exports.getTransactionHistory = getTransactionHistory;
501
- function getTransactionQueue(chainId, address, query = {}, pageUrl) {
502
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/transactions/queued", { path: { chainId, safe_address: address }, query }, pageUrl);
503
- }
504
- exports.getTransactionQueue = getTransactionQueue;
505
- function getTransactionDetails(chainId, transactionId) {
506
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/transactions/{transactionId}", {
507
- path: { chainId, transactionId }
508
- });
509
- }
510
- exports.getTransactionDetails = getTransactionDetails;
511
- function deleteTransaction(chainId, safeTxHash, signature) {
512
- return (0, endpoint_1.deleteEndpoint)(baseUrl, "/v1/chains/{chainId}/transactions/{safeTxHash}", {
513
- path: { chainId, safeTxHash },
514
- body: { signature }
515
- });
516
- }
517
- exports.deleteTransaction = deleteTransaction;
518
- function postSafeGasEstimation(chainId, address, body) {
519
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations", {
520
- path: { chainId, safe_address: address },
521
- body
522
- });
523
- }
524
- exports.postSafeGasEstimation = postSafeGasEstimation;
525
- function getNonces(chainId, address) {
526
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/nonces", {
527
- path: { chainId, safe_address: address }
528
- });
529
- }
530
- exports.getNonces = getNonces;
531
- function proposeTransaction(chainId, address, body) {
532
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/chains/{chainId}/transactions/{safe_address}/propose", {
533
- path: { chainId, safe_address: address },
534
- body
535
- });
536
- }
537
- exports.proposeTransaction = proposeTransaction;
538
- function getConfirmationView(chainId, safeAddress, encodedData, to) {
539
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation", {
540
- path: { chainId, safe_address: safeAddress },
541
- body: { data: encodedData, to }
542
- });
543
- }
544
- exports.getConfirmationView = getConfirmationView;
545
- function getChainsConfig(query) {
546
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains", {
547
- query
548
- });
549
- }
550
- exports.getChainsConfig = getChainsConfig;
551
- function getChainConfig(chainId) {
552
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}", {
553
- path: { chainId }
554
- });
555
- }
556
- exports.getChainConfig = getChainConfig;
557
- function getSafeApps(chainId, query = {}) {
558
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safe-apps", {
559
- path: { chainId },
560
- query
561
- });
562
- }
563
- exports.getSafeApps = getSafeApps;
564
- function getMasterCopies(chainId) {
565
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/about/master-copies", {
566
- path: { chainId }
567
- });
568
- }
569
- exports.getMasterCopies = getMasterCopies;
570
- function getDecodedData(chainId, encodedData, to) {
571
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/chains/{chainId}/data-decoder", {
572
- path: { chainId },
573
- body: { data: encodedData, to }
574
- });
575
- }
576
- exports.getDecodedData = getDecodedData;
577
- function getSafeMessages(chainId, address, pageUrl) {
578
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/messages", { path: { chainId, safe_address: address }, query: {} }, pageUrl);
579
- }
580
- exports.getSafeMessages = getSafeMessages;
581
- function getSafeMessage(chainId, messageHash) {
582
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/messages/{message_hash}", {
583
- path: { chainId, message_hash: messageHash }
584
- });
585
- }
586
- exports.getSafeMessage = getSafeMessage;
587
- function proposeSafeMessage(chainId, address, body) {
588
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/messages", {
589
- path: { chainId, safe_address: address },
590
- body
591
- });
592
- }
593
- exports.proposeSafeMessage = proposeSafeMessage;
594
- function confirmSafeMessage(chainId, messageHash, body) {
595
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/chains/{chainId}/messages/{message_hash}/signatures", {
596
- path: { chainId, message_hash: messageHash },
597
- body
598
- });
599
- }
600
- exports.confirmSafeMessage = confirmSafeMessage;
601
- function getDelegates(chainId, query = {}) {
602
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v2/chains/{chainId}/delegates", {
603
- path: { chainId },
604
- query
605
- });
606
- }
607
- exports.getDelegates = getDelegates;
608
- function registerDevice(body) {
609
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/register/notifications", {
610
- body
611
- });
612
- }
613
- exports.registerDevice = registerDevice;
614
- function unregisterSafe(chainId, address, uuid) {
615
- return (0, endpoint_1.deleteEndpoint)(baseUrl, "/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}", {
616
- path: { chainId, safe_address: address, uuid }
617
- });
618
- }
619
- exports.unregisterSafe = unregisterSafe;
620
- function unregisterDevice(chainId, uuid) {
621
- return (0, endpoint_1.deleteEndpoint)(baseUrl, "/v1/chains/{chainId}/notifications/devices/{uuid}", {
622
- path: { chainId, uuid }
623
- });
624
- }
625
- exports.unregisterDevice = unregisterDevice;
626
- function registerEmail(chainId, safeAddress, body, headers) {
627
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/emails", {
628
- path: { chainId, safe_address: safeAddress },
629
- body,
630
- headers
631
- });
632
- }
633
- exports.registerEmail = registerEmail;
634
- function changeEmail(chainId, safeAddress, signerAddress, body, headers) {
635
- return (0, endpoint_1.putEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
636
- path: { chainId, safe_address: safeAddress, signer: signerAddress },
637
- body,
638
- headers
639
- });
640
- }
641
- exports.changeEmail = changeEmail;
642
- function resendEmailVerificationCode(chainId, safeAddress, signerAddress) {
643
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend", {
644
- path: { chainId, safe_address: safeAddress, signer: signerAddress },
645
- body: ""
646
- });
647
- }
648
- exports.resendEmailVerificationCode = resendEmailVerificationCode;
649
- function verifyEmail(chainId, safeAddress, signerAddress, body) {
650
- return (0, endpoint_1.putEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify", {
651
- path: { chainId, safe_address: safeAddress, signer: signerAddress },
652
- body
653
- });
654
- }
655
- exports.verifyEmail = verifyEmail;
656
- function getRegisteredEmail(chainId, safeAddress, signerAddress, headers) {
657
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
658
- path: { chainId, safe_address: safeAddress, signer: signerAddress },
659
- headers
660
- });
661
- }
662
- exports.getRegisteredEmail = getRegisteredEmail;
663
- function deleteRegisteredEmail(chainId, safeAddress, signerAddress, headers) {
664
- return (0, endpoint_1.deleteEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
665
- path: { chainId, safe_address: safeAddress, signer: signerAddress },
666
- headers
667
- });
668
- }
669
- exports.deleteRegisteredEmail = deleteRegisteredEmail;
670
- function registerRecoveryModule(chainId, safeAddress, body) {
671
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/chains/{chainId}/safes/{safe_address}/recovery", {
672
- path: { chainId, safe_address: safeAddress },
673
- body
674
- });
675
- }
676
- exports.registerRecoveryModule = registerRecoveryModule;
677
- function unsubscribeSingle(query) {
678
- return (0, endpoint_1.deleteEndpoint)(baseUrl, "/v1/subscriptions", { query });
679
- }
680
- exports.unsubscribeSingle = unsubscribeSingle;
681
- function unsubscribeAll(query) {
682
- return (0, endpoint_1.deleteEndpoint)(baseUrl, "/v1/subscriptions/all", { query });
683
- }
684
- exports.unsubscribeAll = unsubscribeAll;
685
- function getSafeOverviews(safes, query) {
686
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/safes", {
687
- query: Object.assign(Object.assign({}, query), { safes: safes.join(",") })
688
- });
689
- }
690
- exports.getSafeOverviews = getSafeOverviews;
691
- function getContract(chainId, contractAddress) {
692
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/chains/{chainId}/contracts/{contractAddress}", {
693
- path: {
694
- chainId,
695
- contractAddress
696
- }
697
- });
698
- }
699
- exports.getContract = getContract;
700
- function getAuthNonce() {
701
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/auth/nonce", { credentials: "include" });
702
- }
703
- exports.getAuthNonce = getAuthNonce;
704
- function verifyAuth(body) {
705
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/auth/verify", {
706
- body,
707
- credentials: "include"
708
- });
709
- }
710
- exports.verifyAuth = verifyAuth;
711
- function createAccount(body) {
712
- return (0, endpoint_1.postEndpoint)(baseUrl, "/v1/accounts", {
713
- body,
714
- credentials: "include"
715
- });
716
- }
717
- exports.createAccount = createAccount;
718
- function getAccount(address) {
719
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/accounts/{address}", {
720
- path: { address },
721
- credentials: "include"
722
- });
723
- }
724
- exports.getAccount = getAccount;
725
- function deleteAccount(address) {
726
- return (0, endpoint_1.deleteEndpoint)(baseUrl, "/v1/accounts/{address}", {
727
- path: { address },
728
- credentials: "include"
729
- });
730
- }
731
- exports.deleteAccount = deleteAccount;
732
- function getAccountDataTypes() {
733
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/accounts/data-types");
734
- }
735
- exports.getAccountDataTypes = getAccountDataTypes;
736
- function getAccountDataSettings(address) {
737
- return (0, endpoint_1.getEndpoint)(baseUrl, "/v1/accounts/{address}/data-settings", {
738
- path: { address },
739
- credentials: "include"
740
- });
741
- }
742
- exports.getAccountDataSettings = getAccountDataSettings;
743
- function putAccountDataSettings(address, body) {
744
- return (0, endpoint_1.putEndpoint)(baseUrl, "/v1/accounts/{address}/data-settings", {
745
- path: { address },
746
- body,
747
- credentials: "include"
748
- });
749
- }
750
- exports.putAccountDataSettings = putAccountDataSettings;
751
- }
752
- });
753
27
  var defaultRPCList = [
754
28
  { name: "https://babel-api.fastblocks.io", latency: 0, height: 0, custom: false },
755
29
  { name: "https://babel-api.mainnet.iotex.one", latency: 0, height: 0 },
@@ -945,556 +219,6 @@ var WalletHistoryStore = class {
945
219
  this.history.setValue(null);
946
220
  }
947
221
  };
948
-
949
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/version.js
950
- var getSDKVersion = () => "9.1.0";
951
-
952
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/communication/utils.js
953
- var dec2hex = (dec) => dec.toString(16).padStart(2, "0");
954
- var generateId = (len) => {
955
- const arr = new Uint8Array((len) / 2);
956
- window.crypto.getRandomValues(arr);
957
- return Array.from(arr, dec2hex).join("");
958
- };
959
- var generateRequestId = () => {
960
- if (typeof window !== "undefined") {
961
- return generateId(10);
962
- }
963
- return (/* @__PURE__ */ new Date()).getTime().toString(36);
964
- };
965
-
966
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/communication/messageFormatter.js
967
- var MessageFormatter = class {
968
- };
969
- MessageFormatter.makeRequest = (method, params) => {
970
- const id = generateRequestId();
971
- return {
972
- id,
973
- method,
974
- params,
975
- env: {
976
- sdkVersion: getSDKVersion()
977
- }
978
- };
979
- };
980
- MessageFormatter.makeResponse = (id, data, version) => ({
981
- id,
982
- success: true,
983
- version,
984
- data
985
- });
986
- MessageFormatter.makeErrorResponse = (id, error, version) => ({
987
- id,
988
- success: false,
989
- error,
990
- version
991
- });
992
-
993
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/communication/methods.js
994
- var Methods;
995
- (function(Methods2) {
996
- Methods2["sendTransactions"] = "sendTransactions";
997
- Methods2["rpcCall"] = "rpcCall";
998
- Methods2["getChainInfo"] = "getChainInfo";
999
- Methods2["getSafeInfo"] = "getSafeInfo";
1000
- Methods2["getTxBySafeTxHash"] = "getTxBySafeTxHash";
1001
- Methods2["getSafeBalances"] = "getSafeBalances";
1002
- Methods2["signMessage"] = "signMessage";
1003
- Methods2["signTypedMessage"] = "signTypedMessage";
1004
- Methods2["getEnvironmentInfo"] = "getEnvironmentInfo";
1005
- Methods2["getOffChainSignature"] = "getOffChainSignature";
1006
- Methods2["requestAddressBook"] = "requestAddressBook";
1007
- Methods2["wallet_getPermissions"] = "wallet_getPermissions";
1008
- Methods2["wallet_requestPermissions"] = "wallet_requestPermissions";
1009
- })(Methods || (Methods = {}));
1010
- var RestrictedMethods;
1011
- (function(RestrictedMethods2) {
1012
- RestrictedMethods2["requestAddressBook"] = "requestAddressBook";
1013
- })(RestrictedMethods || (RestrictedMethods = {}));
1014
-
1015
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/communication/index.js
1016
- var PostMessageCommunicator = class {
1017
- constructor(allowedOrigins = null, debugMode = false) {
1018
- this.allowedOrigins = null;
1019
- this.callbacks = /* @__PURE__ */ new Map();
1020
- this.debugMode = false;
1021
- this.isServer = typeof window === "undefined";
1022
- this.isValidMessage = ({ origin, data, source }) => {
1023
- const emptyOrMalformed = !data;
1024
- const sentFromParentEl = !this.isServer && source === window.parent;
1025
- const majorVersionNumber = typeof data.version !== "undefined" && parseInt(data.version.split(".")[0]);
1026
- const allowedSDKVersion = typeof majorVersionNumber === "number" && majorVersionNumber >= 1;
1027
- let validOrigin = true;
1028
- if (Array.isArray(this.allowedOrigins)) {
1029
- validOrigin = this.allowedOrigins.find((regExp) => regExp.test(origin)) !== void 0;
1030
- }
1031
- return !emptyOrMalformed && sentFromParentEl && allowedSDKVersion && validOrigin;
1032
- };
1033
- this.logIncomingMessage = (msg) => {
1034
- console.info(`Safe Apps SDK v1: A message was received from origin ${msg.origin}. `, msg.data);
1035
- };
1036
- this.onParentMessage = (msg) => {
1037
- if (this.isValidMessage(msg)) {
1038
- this.debugMode && this.logIncomingMessage(msg);
1039
- this.handleIncomingMessage(msg.data);
1040
- }
1041
- };
1042
- this.handleIncomingMessage = (payload) => {
1043
- const { id } = payload;
1044
- const cb = this.callbacks.get(id);
1045
- if (cb) {
1046
- cb(payload);
1047
- this.callbacks.delete(id);
1048
- }
1049
- };
1050
- this.send = (method, params) => {
1051
- const request = MessageFormatter.makeRequest(method, params);
1052
- if (this.isServer) {
1053
- throw new Error("Window doesn't exist");
1054
- }
1055
- window.parent.postMessage(request, "*");
1056
- return new Promise((resolve, reject) => {
1057
- this.callbacks.set(request.id, (response) => {
1058
- if (!response.success) {
1059
- reject(new Error(response.error));
1060
- return;
1061
- }
1062
- resolve(response);
1063
- });
1064
- });
1065
- };
1066
- this.allowedOrigins = allowedOrigins;
1067
- this.debugMode = debugMode;
1068
- if (!this.isServer) {
1069
- window.addEventListener("message", this.onParentMessage);
1070
- }
1071
- }
1072
- };
1073
- var communication_default = PostMessageCommunicator;
1074
-
1075
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/types/sdk.js
1076
- var isObjectEIP712TypedData = (obj) => {
1077
- return typeof obj === "object" && obj != null && "domain" in obj && "types" in obj && "message" in obj;
1078
- };
1079
-
1080
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/types/gateway.js
1081
- var import_safe_gateway_typescript_sdk = __toESM(require_dist(), 1);
1082
-
1083
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/txs/index.js
1084
- var TXs = class {
1085
- constructor(communicator) {
1086
- this.communicator = communicator;
1087
- }
1088
- async getBySafeTxHash(safeTxHash) {
1089
- if (!safeTxHash) {
1090
- throw new Error("Invalid safeTxHash");
1091
- }
1092
- const response = await this.communicator.send(Methods.getTxBySafeTxHash, { safeTxHash });
1093
- return response.data;
1094
- }
1095
- async signMessage(message) {
1096
- const messagePayload = {
1097
- message
1098
- };
1099
- const response = await this.communicator.send(Methods.signMessage, messagePayload);
1100
- return response.data;
1101
- }
1102
- async signTypedMessage(typedData) {
1103
- if (!isObjectEIP712TypedData(typedData)) {
1104
- throw new Error("Invalid typed data");
1105
- }
1106
- const response = await this.communicator.send(Methods.signTypedMessage, { typedData });
1107
- return response.data;
1108
- }
1109
- async send({ txs, params }) {
1110
- if (!txs || !txs.length) {
1111
- throw new Error("No transactions were passed");
1112
- }
1113
- const messagePayload = {
1114
- txs,
1115
- params
1116
- };
1117
- const response = await this.communicator.send(Methods.sendTransactions, messagePayload);
1118
- return response.data;
1119
- }
1120
- };
1121
-
1122
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/eth/constants.js
1123
- var RPC_CALLS = {
1124
- eth_call: "eth_call",
1125
- eth_gasPrice: "eth_gasPrice",
1126
- eth_getLogs: "eth_getLogs",
1127
- eth_getBalance: "eth_getBalance",
1128
- eth_getCode: "eth_getCode",
1129
- eth_getBlockByHash: "eth_getBlockByHash",
1130
- eth_getBlockByNumber: "eth_getBlockByNumber",
1131
- eth_getStorageAt: "eth_getStorageAt",
1132
- eth_getTransactionByHash: "eth_getTransactionByHash",
1133
- eth_getTransactionReceipt: "eth_getTransactionReceipt",
1134
- eth_getTransactionCount: "eth_getTransactionCount",
1135
- eth_estimateGas: "eth_estimateGas",
1136
- safe_setSettings: "safe_setSettings"
1137
- };
1138
-
1139
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/eth/index.js
1140
- var inputFormatters = {
1141
- defaultBlockParam: (arg = "latest") => arg,
1142
- returnFullTxObjectParam: (arg = false) => arg,
1143
- blockNumberToHex: (arg) => Number.isInteger(arg) ? `0x${arg.toString(16)}` : arg
1144
- };
1145
- var Eth = class {
1146
- constructor(communicator) {
1147
- this.communicator = communicator;
1148
- this.call = this.buildRequest({
1149
- call: RPC_CALLS.eth_call,
1150
- formatters: [null, inputFormatters.defaultBlockParam]
1151
- });
1152
- this.getBalance = this.buildRequest({
1153
- call: RPC_CALLS.eth_getBalance,
1154
- formatters: [null, inputFormatters.defaultBlockParam]
1155
- });
1156
- this.getCode = this.buildRequest({
1157
- call: RPC_CALLS.eth_getCode,
1158
- formatters: [null, inputFormatters.defaultBlockParam]
1159
- });
1160
- this.getStorageAt = this.buildRequest({
1161
- call: RPC_CALLS.eth_getStorageAt,
1162
- formatters: [null, inputFormatters.blockNumberToHex, inputFormatters.defaultBlockParam]
1163
- });
1164
- this.getPastLogs = this.buildRequest({
1165
- call: RPC_CALLS.eth_getLogs
1166
- });
1167
- this.getBlockByHash = this.buildRequest({
1168
- call: RPC_CALLS.eth_getBlockByHash,
1169
- formatters: [null, inputFormatters.returnFullTxObjectParam]
1170
- });
1171
- this.getBlockByNumber = this.buildRequest({
1172
- call: RPC_CALLS.eth_getBlockByNumber,
1173
- formatters: [inputFormatters.blockNumberToHex, inputFormatters.returnFullTxObjectParam]
1174
- });
1175
- this.getTransactionByHash = this.buildRequest({
1176
- call: RPC_CALLS.eth_getTransactionByHash
1177
- });
1178
- this.getTransactionReceipt = this.buildRequest({
1179
- call: RPC_CALLS.eth_getTransactionReceipt
1180
- });
1181
- this.getTransactionCount = this.buildRequest({
1182
- call: RPC_CALLS.eth_getTransactionCount,
1183
- formatters: [null, inputFormatters.defaultBlockParam]
1184
- });
1185
- this.getGasPrice = this.buildRequest({
1186
- call: RPC_CALLS.eth_gasPrice
1187
- });
1188
- this.getEstimateGas = (transaction) => this.buildRequest({
1189
- call: RPC_CALLS.eth_estimateGas
1190
- })([transaction]);
1191
- this.setSafeSettings = this.buildRequest({
1192
- call: RPC_CALLS.safe_setSettings
1193
- });
1194
- }
1195
- buildRequest(args) {
1196
- const { call, formatters } = args;
1197
- return async (params) => {
1198
- if (formatters && Array.isArray(params)) {
1199
- formatters.forEach((formatter, i) => {
1200
- if (formatter) {
1201
- params[i] = formatter(params[i]);
1202
- }
1203
- });
1204
- }
1205
- const payload = {
1206
- call,
1207
- params: params || []
1208
- };
1209
- const response = await this.communicator.send(Methods.rpcCall, payload);
1210
- return response.data;
1211
- };
1212
- }
1213
- };
1214
-
1215
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/safe/signatures.js
1216
- var MAGIC_VALUE = "0x1626ba7e";
1217
- var MAGIC_VALUE_BYTES = "0x20c13b0b";
1218
-
1219
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/types/permissions.js
1220
- var PERMISSIONS_REQUEST_REJECTED = 4001;
1221
- var PermissionsError = class _PermissionsError extends Error {
1222
- constructor(message, code, data) {
1223
- super(message);
1224
- this.code = code;
1225
- this.data = data;
1226
- Object.setPrototypeOf(this, _PermissionsError.prototype);
1227
- }
1228
- };
1229
-
1230
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/wallet/index.js
1231
- var Wallet = class {
1232
- constructor(communicator) {
1233
- this.communicator = communicator;
1234
- }
1235
- async getPermissions() {
1236
- const response = await this.communicator.send(Methods.wallet_getPermissions, void 0);
1237
- return response.data;
1238
- }
1239
- async requestPermissions(permissions) {
1240
- if (!this.isPermissionRequestValid(permissions)) {
1241
- throw new PermissionsError("Permissions request is invalid", PERMISSIONS_REQUEST_REJECTED);
1242
- }
1243
- try {
1244
- const response = await this.communicator.send(Methods.wallet_requestPermissions, permissions);
1245
- return response.data;
1246
- } catch (e) {
1247
- throw new PermissionsError("Permissions rejected", PERMISSIONS_REQUEST_REJECTED);
1248
- }
1249
- }
1250
- isPermissionRequestValid(permissions) {
1251
- return permissions.every((pr) => {
1252
- if (typeof pr === "object") {
1253
- return Object.keys(pr).every((method) => {
1254
- if (Object.values(RestrictedMethods).includes(method)) {
1255
- return true;
1256
- }
1257
- return false;
1258
- });
1259
- }
1260
- return false;
1261
- });
1262
- }
1263
- };
1264
-
1265
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/decorators/requirePermissions.js
1266
- var hasPermission = (required, permissions) => permissions.some((permission) => permission.parentCapability === required);
1267
- var requirePermission = () => (_, propertyKey, descriptor) => {
1268
- const originalMethod = descriptor.value;
1269
- descriptor.value = async function() {
1270
- const wallet = new Wallet(this.communicator);
1271
- let currentPermissions = await wallet.getPermissions();
1272
- if (!hasPermission(propertyKey, currentPermissions)) {
1273
- currentPermissions = await wallet.requestPermissions([{ [propertyKey]: {} }]);
1274
- }
1275
- if (!hasPermission(propertyKey, currentPermissions)) {
1276
- throw new PermissionsError("Permissions rejected", PERMISSIONS_REQUEST_REJECTED);
1277
- }
1278
- return originalMethod.apply(this);
1279
- };
1280
- return descriptor;
1281
- };
1282
- var requirePermissions_default = requirePermission;
1283
-
1284
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/safe/index.js
1285
- var __decorate = function(decorators, target, key, desc) {
1286
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1287
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1288
- r = Reflect.decorate(decorators, target, key, desc);
1289
- else
1290
- for (var i = decorators.length - 1; i >= 0; i--)
1291
- if (d = decorators[i])
1292
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1293
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1294
- };
1295
- var Safe = class {
1296
- constructor(communicator) {
1297
- this.communicator = communicator;
1298
- }
1299
- async getChainInfo() {
1300
- const response = await this.communicator.send(Methods.getChainInfo, void 0);
1301
- return response.data;
1302
- }
1303
- async getInfo() {
1304
- const response = await this.communicator.send(Methods.getSafeInfo, void 0);
1305
- return response.data;
1306
- }
1307
- // There is a possibility that this method will change because we may add pagination to the endpoint
1308
- async experimental_getBalances({ currency = "usd" } = {}) {
1309
- const response = await this.communicator.send(Methods.getSafeBalances, {
1310
- currency
1311
- });
1312
- return response.data;
1313
- }
1314
- async check1271Signature(messageHash, signature = "0x") {
1315
- const safeInfo = await this.getInfo();
1316
- const encodedIsValidSignatureCall = encodeFunctionData({
1317
- abi: [
1318
- {
1319
- constant: false,
1320
- inputs: [
1321
- {
1322
- name: "_dataHash",
1323
- type: "bytes32"
1324
- },
1325
- {
1326
- name: "_signature",
1327
- type: "bytes"
1328
- }
1329
- ],
1330
- name: "isValidSignature",
1331
- outputs: [
1332
- {
1333
- name: "",
1334
- type: "bytes4"
1335
- }
1336
- ],
1337
- payable: false,
1338
- stateMutability: "nonpayable",
1339
- type: "function"
1340
- }
1341
- ],
1342
- functionName: "isValidSignature",
1343
- args: [messageHash, signature]
1344
- });
1345
- const payload = {
1346
- call: RPC_CALLS.eth_call,
1347
- params: [
1348
- {
1349
- to: safeInfo.safeAddress,
1350
- data: encodedIsValidSignatureCall
1351
- },
1352
- "latest"
1353
- ]
1354
- };
1355
- try {
1356
- const response = await this.communicator.send(Methods.rpcCall, payload);
1357
- return response.data.slice(0, 10).toLowerCase() === MAGIC_VALUE;
1358
- } catch (err) {
1359
- return false;
1360
- }
1361
- }
1362
- async check1271SignatureBytes(messageHash, signature = "0x") {
1363
- const safeInfo = await this.getInfo();
1364
- const encodedIsValidSignatureCall = encodeFunctionData({
1365
- abi: [
1366
- {
1367
- constant: false,
1368
- inputs: [
1369
- {
1370
- name: "_data",
1371
- type: "bytes"
1372
- },
1373
- {
1374
- name: "_signature",
1375
- type: "bytes"
1376
- }
1377
- ],
1378
- name: "isValidSignature",
1379
- outputs: [
1380
- {
1381
- name: "",
1382
- type: "bytes4"
1383
- }
1384
- ],
1385
- payable: false,
1386
- stateMutability: "nonpayable",
1387
- type: "function"
1388
- }
1389
- ],
1390
- functionName: "isValidSignature",
1391
- args: [messageHash, signature]
1392
- });
1393
- const payload = {
1394
- call: RPC_CALLS.eth_call,
1395
- params: [
1396
- {
1397
- to: safeInfo.safeAddress,
1398
- data: encodedIsValidSignatureCall
1399
- },
1400
- "latest"
1401
- ]
1402
- };
1403
- try {
1404
- const response = await this.communicator.send(Methods.rpcCall, payload);
1405
- return response.data.slice(0, 10).toLowerCase() === MAGIC_VALUE_BYTES;
1406
- } catch (err) {
1407
- return false;
1408
- }
1409
- }
1410
- calculateMessageHash(message) {
1411
- return hashMessage(message);
1412
- }
1413
- calculateTypedMessageHash(typedMessage) {
1414
- const chainId = typeof typedMessage.domain.chainId === "object" ? typedMessage.domain.chainId.toNumber() : Number(typedMessage.domain.chainId);
1415
- let primaryType = typedMessage.primaryType;
1416
- if (!primaryType) {
1417
- const fields = Object.values(typedMessage.types);
1418
- const primaryTypes = Object.keys(typedMessage.types).filter((typeName) => fields.every((dataTypes) => dataTypes.every(({ type }) => type.replace("[", "").replace("]", "") !== typeName)));
1419
- if (primaryTypes.length === 0 || primaryTypes.length > 1)
1420
- throw new Error("Please specify primaryType");
1421
- primaryType = primaryTypes[0];
1422
- }
1423
- return hashTypedData({
1424
- message: typedMessage.message,
1425
- domain: __spreadProps(__spreadValues({}, typedMessage.domain), {
1426
- chainId,
1427
- verifyingContract: typedMessage.domain.verifyingContract,
1428
- salt: typedMessage.domain.salt
1429
- }),
1430
- types: typedMessage.types,
1431
- primaryType
1432
- });
1433
- }
1434
- async getOffChainSignature(messageHash) {
1435
- const response = await this.communicator.send(Methods.getOffChainSignature, messageHash);
1436
- return response.data;
1437
- }
1438
- async isMessageSigned(message, signature = "0x") {
1439
- let check;
1440
- if (typeof message === "string") {
1441
- check = async () => {
1442
- const messageHash = this.calculateMessageHash(message);
1443
- const messageHashSigned = await this.isMessageHashSigned(messageHash, signature);
1444
- return messageHashSigned;
1445
- };
1446
- }
1447
- if (isObjectEIP712TypedData(message)) {
1448
- check = async () => {
1449
- const messageHash = this.calculateTypedMessageHash(message);
1450
- const messageHashSigned = await this.isMessageHashSigned(messageHash, signature);
1451
- return messageHashSigned;
1452
- };
1453
- }
1454
- if (check) {
1455
- const isValid = await check();
1456
- return isValid;
1457
- }
1458
- throw new Error("Invalid message type");
1459
- }
1460
- async isMessageHashSigned(messageHash, signature = "0x") {
1461
- const checks = [this.check1271Signature.bind(this), this.check1271SignatureBytes.bind(this)];
1462
- for (const check of checks) {
1463
- const isValid = await check(messageHash, signature);
1464
- if (isValid) {
1465
- return true;
1466
- }
1467
- }
1468
- return false;
1469
- }
1470
- async getEnvironmentInfo() {
1471
- const response = await this.communicator.send(Methods.getEnvironmentInfo, void 0);
1472
- return response.data;
1473
- }
1474
- async requestAddressBook() {
1475
- const response = await this.communicator.send(Methods.requestAddressBook, void 0);
1476
- return response.data;
1477
- }
1478
- };
1479
- __decorate([
1480
- requirePermissions_default()
1481
- ], Safe.prototype, "requestAddressBook", null);
1482
-
1483
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/sdk.js
1484
- var SafeAppsSDK = class {
1485
- constructor(opts = {}) {
1486
- const { allowedDomains = null, debug = false } = opts;
1487
- this.communicator = new communication_default(allowedDomains, debug);
1488
- this.eth = new Eth(this.communicator);
1489
- this.txs = new TXs(this.communicator);
1490
- this.safe = new Safe(this.communicator);
1491
- this.wallet = new Wallet(this.communicator);
1492
- }
1493
- };
1494
- var sdk_default = SafeAppsSDK;
1495
-
1496
- // ../../node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js
1497
- var esm_default = sdk_default;
1498
222
  var SuccessTxDialog = observer((props) => {
1499
223
  return /* @__PURE__ */ React5.createElement("div", { className: "flex-col gap-4 py-10" }, /* @__PURE__ */ React5.createElement("div", { className: "w-full flex items-center justify-center" }, /* @__PURE__ */ React5.createElement(Icon, { icon: "icon-park-solid:check-one", width: "48", height: "48", className: "text-green-500" })), /* @__PURE__ */ React5.createElement("div", { className: "text-2xl font-[900] text-center mt-4" }, props.msg), /* @__PURE__ */ React5.createElement(
1500
224
  "div",
@@ -1621,7 +345,6 @@ var WalletStore = class _WalletStore {
1621
345
  return RootStore.Get(WalletConfigStore).supportedChains;
1622
346
  }
1623
347
  use(router) {
1624
- const { data: walletClient, isSuccess } = useWalletClient();
1625
348
  const { chain, address, isConnected } = useAccount();
1626
349
  const { switchChain } = useSwitchChain();
1627
350
  const { openConnectModal } = useConnectModal();
@@ -1632,12 +355,21 @@ var WalletStore = class _WalletStore {
1632
355
  //@ts-ignore
1633
356
  connect,
1634
357
  // @ts-ignore
1635
- walletClient,
358
+ // walletClient,
1636
359
  openConnectModal,
1637
360
  switchChain,
1638
361
  disconnect
1639
362
  });
1640
363
  useEffect(() => {
364
+ if (address) {
365
+ this.walletClient = createWalletClient({
366
+ account: address,
367
+ chain: this.chain,
368
+ transport: custom(window.ethereum)
369
+ }).extend(publicActions);
370
+ } else {
371
+ this.walletClient = null;
372
+ }
1641
373
  RootStore.Get(WalletHistoryStore).set({ isRender: true });
1642
374
  this.set({
1643
375
  isConnect: isConnected,
@@ -1721,10 +453,10 @@ var WalletStore = class _WalletStore {
1721
453
  }
1722
454
  async waitForTransactionReceipt({ hash }) {
1723
455
  if (this.isInSafeApp) {
1724
- const sdk = new esm_default();
456
+ const sdk = new SafeAppsSDK();
1725
457
  while (true) {
1726
458
  const queued = await sdk.txs.getBySafeTxHash(hash);
1727
- if (queued.txStatus === import_safe_gateway_typescript_sdk.TransactionStatus.AWAITING_CONFIRMATIONS || queued.txStatus === import_safe_gateway_typescript_sdk.TransactionStatus.AWAITING_EXECUTION || queued.txStatus === import_safe_gateway_typescript_sdk.TransactionStatus.CANCELLED) {
459
+ if (queued.txStatus === TransactionStatus.AWAITING_CONFIRMATIONS || queued.txStatus === TransactionStatus.AWAITING_EXECUTION || queued.txStatus === TransactionStatus.CANCELLED) {
1728
460
  await new Promise((resolve) => setTimeout(resolve, 2e3));
1729
461
  } else {
1730
462
  return this.publicClient.waitForTransactionReceipt({ hash: queued.txHash });
@@ -1914,8 +646,6 @@ var iotex = __spreadValues({
1914
646
  var iotexTestnet = __spreadValues({
1915
647
  iconUrl: "https://cdn-dapp-works.s3.us-east-1.amazonaws.com/1dd84d927ae959c508392be62e6eb549.png"
1916
648
  }, iotexTestnet$1);
1917
-
1918
- // module/Wallet/provider.tsx
1919
649
  var queryClient = new QueryClient();
1920
650
  var WalletProvider = ({
1921
651
  children,
@@ -1936,18 +666,6 @@ var WalletProvider = ({
1936
666
  );
1937
667
  return () => disposer();
1938
668
  });
1939
- useEffect(() => {
1940
- try {
1941
- if (typeof window != "undefined") {
1942
- window.addEventListener("message", (msg) => {
1943
- if (msg.origin.includes("safe")) {
1944
- walletConfig.isInSafeApp = true;
1945
- }
1946
- });
1947
- }
1948
- } catch (error) {
1949
- }
1950
- }, []);
1951
669
  useEffect(() => {
1952
670
  if (appName) {
1953
671
  walletConfig.appName = appName;
@@ -1956,10 +674,15 @@ var WalletProvider = ({
1956
674
  walletConfig.compatibleMode = compatibleMode;
1957
675
  }
1958
676
  }, [appName, compatibleMode]);
1959
- return (
1960
- //@ts-ignore
1961
- /* @__PURE__ */ React5.createElement(WagmiProvider, { config, reconnectOnMount: compatibleMode ? false : true }, /* @__PURE__ */ React5.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React5.createElement(RainbowKitProvider, { locale: "en", theme: theme == "dark" ? darkTheme() : lightTheme() }, children, /* @__PURE__ */ React5.createElement(WalletConnect, { compatibleMode, router }))))
1962
- );
677
+ useEffect(() => {
678
+ const sdk = new SafeAppsSDK();
679
+ sdk.safe.getEnvironmentInfo().then(({ origin }) => {
680
+ if (origin) {
681
+ walletConfig.isInSafeApp = true;
682
+ }
683
+ });
684
+ }, []);
685
+ return /* @__PURE__ */ React5.createElement(WagmiProvider, { config, reconnectOnMount: compatibleMode ? false : true }, /* @__PURE__ */ React5.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React5.createElement(RainbowKitProvider, { locale: "en", theme: theme == "dark" ? darkTheme() : lightTheme() }, children, /* @__PURE__ */ React5.createElement(WalletConnect, { compatibleMode, router }))));
1963
686
  };
1964
687
  var WalletConnect = ({ compatibleMode = true, router }) => {
1965
688
  const { reconnect } = useReconnect();