@rabby-wallet/gnosis-sdk 1.3.10-alpha.0 → 1.3.10

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/api.d.ts CHANGED
@@ -41,6 +41,84 @@ export interface SafeTransactionItem {
41
41
  confirmations: ConfirmationItem[];
42
42
  signatures: string | null;
43
43
  }
44
+ export declare const HOST_MAP: {
45
+ /**
46
+ * eth
47
+ */
48
+ "1": string;
49
+ /**
50
+ * polygon
51
+ */
52
+ "137": string;
53
+ /**
54
+ * bsc
55
+ */
56
+ "56": string;
57
+ /**
58
+ * Gnosis Chain
59
+ */
60
+ "100": string;
61
+ /**
62
+ * avalanche
63
+ */
64
+ "43114": string;
65
+ /**
66
+ * arbitrum
67
+ */
68
+ "42161": string;
69
+ /**
70
+ * Optimism
71
+ */
72
+ "10": string;
73
+ /**
74
+ * Aurora
75
+ */
76
+ "1313161554": string;
77
+ /**
78
+ * Base
79
+ */
80
+ "8453": string;
81
+ /**
82
+ * Celo
83
+ */
84
+ "42220": string;
85
+ /**
86
+ * Polygon zkEVM
87
+ */
88
+ "1101": string;
89
+ /**
90
+ * zksync era
91
+ */
92
+ "324": string;
93
+ /**
94
+ * scroll
95
+ */
96
+ "534352": string;
97
+ /**
98
+ * linea
99
+ */
100
+ "59144": string;
101
+ /**
102
+ * X Layer
103
+ */
104
+ "196": string;
105
+ /**
106
+ * mantle
107
+ */
108
+ "5000": string;
109
+ /**
110
+ * World Chain
111
+ */
112
+ "480": string;
113
+ /**
114
+ * blast
115
+ */
116
+ "81457": string;
117
+ /**
118
+ * Sonic
119
+ */
120
+ "146": string;
121
+ };
44
122
  export default class RequestProvider {
45
123
  host: string;
46
124
  request: Axios;
package/dist/api.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isLegacyVersion } from "./utils";
2
2
  import axios from "axios";
3
3
  import { toChecksumAddress } from "web3-utils";
4
- const HOST_MAP = {
4
+ export const HOST_MAP = {
5
5
  /**
6
6
  * eth
7
7
  */
@@ -65,19 +65,19 @@ const HOST_MAP = {
65
65
  /**
66
66
  * mantle
67
67
  */
68
- "5000": "https://safe-transaction-mantle.safe.global",
68
+ "5000": "https://safe-transaction-mantle.safe.global/api/v1",
69
69
  /**
70
70
  * World Chain
71
71
  */
72
- "480": "https://safe-transaction-worldchain.safe.global",
72
+ "480": "https://safe-transaction-worldchain.safe.global/api/v1",
73
73
  /**
74
74
  * blast
75
75
  */
76
- "81457": "https://safe-transaction-blast.safe.global",
76
+ "81457": "https://safe-transaction-blast.safe.global/api/v1",
77
77
  /**
78
78
  * Sonic
79
79
  */
80
- "146": "https://safe-transaction-sonic.safe.global",
80
+ "146": "https://safe-transaction-sonic.safe.global/api/v1",
81
81
  };
82
82
  export default class RequestProvider {
83
83
  constructor(networkId, adapter) {
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { BigNumber } from "@ethersproject/bignumber";
2
2
  import { SafeSignature, SafeTransactionDataPartial } from "@gnosis.pm/safe-core-sdk-types";
3
3
  import SafeTransaction from "@gnosis.pm/safe-core-sdk/dist/src/utils/transactions/SafeTransaction";
4
4
  import { TransactionOptions, TransactionResult } from "@gnosis.pm/safe-core-sdk/dist/src/utils/transactions/types";
5
- import SafeApiKit from "@safe-global/api-kit";
5
+ import SafeApiKit, { SafeMessage as ApiKitSafeMessage } from "@safe-global/api-kit";
6
6
  import SafeMessage from "@safe-global/protocol-kit/dist/src/utils/messages/SafeMessage";
7
7
  import { SafeClientResult } from "@safe-global/sdk-starter-kit";
8
8
  import { AxiosAdapter } from "axios";
@@ -30,6 +30,7 @@ declare class Safe {
30
30
  static getPendingTransactions(safeAddress: string, network: string, nonce: number): Promise<{
31
31
  results: import("./api").SafeTransactionItem[];
32
32
  }>;
33
+ static createSafeApiKit: (network: string) => SafeApiKit;
33
34
  getPendingTransactions(): Promise<{
34
35
  results: import("./api").SafeTransactionItem[];
35
36
  }>;
@@ -79,3 +80,4 @@ declare class Safe {
79
80
  }
80
81
  export default Safe;
81
82
  export type BasicSafeInfo = Awaited<ReturnType<Safe["getBasicSafeInfo"]>>;
83
+ export { ApiKitSafeMessage as SafeMessage };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { BigNumber } from "@ethersproject/bignumber";
2
2
  import SafeTransaction from "@gnosis.pm/safe-core-sdk/dist/src/utils/transactions/SafeTransaction";
3
3
  import SafeApiKit from "@safe-global/api-kit";
4
+ import { TRANSACTION_SERVICE_URLS } from "@safe-global/api-kit/dist/src/utils/config";
4
5
  import { hashSafeMessage } from "@safe-global/protocol-kit";
5
6
  import { calculateSafeMessageHash } from "@safe-global/protocol-kit/dist/src/utils";
6
7
  import { getSafeSingletonDeployment } from "@safe-global/safe-deployments";
@@ -9,7 +10,7 @@ import { createSafeClientResult } from "@safe-global/sdk-starter-kit/dist/src/ut
9
10
  import BN from "bignumber.js";
10
11
  import { Contract } from "ethers";
11
12
  import { toChecksumAddress } from "web3-utils";
12
- import RequestProvider from "./api";
13
+ import RequestProvider, { HOST_MAP } from "./api";
13
14
  import { estimateGasForTransactionExecution, generatePreValidatedSignature, generateSignature, sameString, standardizeSafeTransactionData, } from "./utils";
14
15
  class Safe {
15
16
  constructor(safeAddress, version, provider, network = "1") {
@@ -58,9 +59,7 @@ class Safe {
58
59
  this.safeAddress = safeAddress;
59
60
  this.network = network;
60
61
  this.request = new RequestProvider(network, Safe.adapter);
61
- this.apiKit = new SafeApiKit({
62
- chainId: BigInt(network),
63
- });
62
+ this.apiKit = Safe.createSafeApiKit(network);
64
63
  // this.init();
65
64
  }
66
65
  /**
@@ -259,4 +258,13 @@ class Safe {
259
258
  });
260
259
  }
261
260
  }
261
+ Safe.createSafeApiKit = (network) => {
262
+ var _a;
263
+ return new SafeApiKit({
264
+ chainId: BigInt(network),
265
+ txServiceUrl: TRANSACTION_SERVICE_URLS[network] ||
266
+ ((_a = HOST_MAP[network]) === null || _a === void 0 ? void 0 : _a.replace(/\/v1$/, "")) ||
267
+ undefined,
268
+ });
269
+ };
262
270
  export default Safe;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/gnosis-sdk",
3
- "version": "1.3.10-alpha.0",
3
+ "version": "1.3.10",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -19,8 +19,8 @@
19
19
  "@safe-global/api-kit": "2.5.6",
20
20
  "@safe-global/protocol-kit": "5.0.2",
21
21
  "@safe-global/safe-deployments": "1.37.22",
22
- "@safe-global/sdk-starter-kit": "1.0.2",
23
- "@safe-global/types-kit": "1.0.0",
22
+ "@safe-global/sdk-starter-kit": "1.1.1",
23
+ "@safe-global/types-kit": "1.0.1",
24
24
  "axios": "0.24.0",
25
25
  "bignumber.js": "9.0.2",
26
26
  "ethereumjs-util": "7.1.3",
package/src/api.ts CHANGED
@@ -47,7 +47,7 @@ export interface SafeTransactionItem {
47
47
  signatures: string | null;
48
48
  }
49
49
 
50
- const HOST_MAP = {
50
+ export const HOST_MAP = {
51
51
  /**
52
52
  * eth
53
53
  */
@@ -112,19 +112,19 @@ const HOST_MAP = {
112
112
  /**
113
113
  * mantle
114
114
  */
115
- "5000": "https://safe-transaction-mantle.safe.global",
115
+ "5000": "https://safe-transaction-mantle.safe.global/api/v1",
116
116
  /**
117
117
  * World Chain
118
118
  */
119
- "480": "https://safe-transaction-worldchain.safe.global",
119
+ "480": "https://safe-transaction-worldchain.safe.global/api/v1",
120
120
  /**
121
121
  * blast
122
122
  */
123
- "81457": "https://safe-transaction-blast.safe.global",
123
+ "81457": "https://safe-transaction-blast.safe.global/api/v1",
124
124
  /**
125
125
  * Sonic
126
126
  */
127
- "146": "https://safe-transaction-sonic.safe.global",
127
+ "146": "https://safe-transaction-sonic.safe.global/api/v1",
128
128
  };
129
129
 
130
130
  export default class RequestProvider {
package/src/index.ts CHANGED
@@ -10,7 +10,9 @@ import {
10
10
  } from "@gnosis.pm/safe-core-sdk/dist/src/utils/transactions/types";
11
11
  import SafeApiKit, {
12
12
  EIP712TypedData as ApiKitEIP712TypedData,
13
+ SafeMessage as ApiKitSafeMessage,
13
14
  } from "@safe-global/api-kit";
15
+ import { TRANSACTION_SERVICE_URLS } from "@safe-global/api-kit/dist/src/utils/config";
14
16
  import { hashSafeMessage } from "@safe-global/protocol-kit";
15
17
  import { calculateSafeMessageHash } from "@safe-global/protocol-kit/dist/src/utils";
16
18
  import SafeMessage from "@safe-global/protocol-kit/dist/src/utils/messages/SafeMessage";
@@ -22,7 +24,7 @@ import { AxiosAdapter } from "axios";
22
24
  import BN from "bignumber.js";
23
25
  import { Contract, providers } from "ethers";
24
26
  import { toChecksumAddress } from "web3-utils";
25
- import RequestProvider, { SafeInfo } from "./api";
27
+ import RequestProvider, { HOST_MAP, SafeInfo } from "./api";
26
28
  import {
27
29
  estimateGasForTransactionExecution,
28
30
  generatePreValidatedSignature,
@@ -63,9 +65,7 @@ class Safe {
63
65
  this.safeAddress = safeAddress;
64
66
  this.network = network;
65
67
  this.request = new RequestProvider(network, Safe.adapter);
66
- this.apiKit = new SafeApiKit({
67
- chainId: BigInt(network),
68
- });
68
+ this.apiKit = Safe.createSafeApiKit(network);
69
69
 
70
70
  // this.init();
71
71
  }
@@ -95,6 +95,16 @@ class Safe {
95
95
  return transactions;
96
96
  }
97
97
 
98
+ static createSafeApiKit = (network: string) => {
99
+ return new SafeApiKit({
100
+ chainId: BigInt(network),
101
+ txServiceUrl:
102
+ TRANSACTION_SERVICE_URLS[network] ||
103
+ HOST_MAP[network]?.replace(/\/v1$/, "") ||
104
+ undefined,
105
+ });
106
+ };
107
+
98
108
  async getPendingTransactions() {
99
109
  const nonce = await this.getNonce();
100
110
  const transactions = await this.request.getPendingTransactions(
@@ -412,3 +422,5 @@ class Safe {
412
422
  export default Safe;
413
423
 
414
424
  export type BasicSafeInfo = Awaited<ReturnType<Safe["getBasicSafeInfo"]>>;
425
+
426
+ export { ApiKitSafeMessage as SafeMessage };