@rabby-wallet/gnosis-sdk 1.4.7-alpha-1 → 1.4.7
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 +1 -2
- package/dist/api.js +1 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -4
- package/dist/utils.js +0 -1
- package/package.json +1 -1
- package/src/api.ts +0 -8
- package/src/index.ts +15 -20
- package/src/utils.ts +0 -1
package/dist/api.d.ts
CHANGED
|
@@ -52,10 +52,9 @@ export declare const getTxServiceUrl: (chainId: string) => any;
|
|
|
52
52
|
export default class RequestProvider {
|
|
53
53
|
host: string;
|
|
54
54
|
request: Axios;
|
|
55
|
-
constructor({ networkId, adapter,
|
|
55
|
+
constructor({ networkId, adapter, }: {
|
|
56
56
|
networkId: string;
|
|
57
57
|
adapter?: AxiosAdapter;
|
|
58
|
-
apiKey: string;
|
|
59
58
|
});
|
|
60
59
|
getPendingTransactions(safeAddress: string, nonce: number): Promise<{
|
|
61
60
|
results: SafeTransactionItem[];
|
package/dist/api.js
CHANGED
|
@@ -213,7 +213,7 @@ export const getTxServiceUrl = (chainId) => {
|
|
|
213
213
|
return HOST_MAP[chainId];
|
|
214
214
|
};
|
|
215
215
|
export default class RequestProvider {
|
|
216
|
-
constructor({ networkId, adapter,
|
|
216
|
+
constructor({ networkId, adapter, }) {
|
|
217
217
|
const txServiceUrl = getTxServiceUrl(networkId);
|
|
218
218
|
if (!txServiceUrl) {
|
|
219
219
|
throw new Error("Wrong networkId");
|
|
@@ -222,11 +222,6 @@ export default class RequestProvider {
|
|
|
222
222
|
this.request = axios.create({
|
|
223
223
|
baseURL: this.host,
|
|
224
224
|
adapter,
|
|
225
|
-
headers: apiKey
|
|
226
|
-
? {
|
|
227
|
-
Authorization: `Bearer ${apiKey}`,
|
|
228
|
-
}
|
|
229
|
-
: undefined,
|
|
230
225
|
});
|
|
231
226
|
this.request.interceptors.response.use((response) => {
|
|
232
227
|
return response.data;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -56,7 +56,6 @@ class Safe {
|
|
|
56
56
|
this.request = new RequestProvider({
|
|
57
57
|
networkId: network,
|
|
58
58
|
adapter: Safe.adapter,
|
|
59
|
-
apiKey: Safe.apiKey,
|
|
60
59
|
});
|
|
61
60
|
this.apiKit = Safe.createSafeApiKit(network);
|
|
62
61
|
// this.init();
|
|
@@ -71,7 +70,6 @@ class Safe {
|
|
|
71
70
|
const request = new RequestProvider({
|
|
72
71
|
networkId: network,
|
|
73
72
|
adapter: Safe.adapter,
|
|
74
|
-
apiKey: Safe.apiKey,
|
|
75
73
|
});
|
|
76
74
|
return request.getSafeInfo(ethers.utils.getAddress(safeAddress));
|
|
77
75
|
}
|
|
@@ -79,7 +77,6 @@ class Safe {
|
|
|
79
77
|
const request = new RequestProvider({
|
|
80
78
|
networkId: network,
|
|
81
79
|
adapter: Safe.adapter,
|
|
82
|
-
apiKey: Safe.apiKey,
|
|
83
80
|
});
|
|
84
81
|
const transactions = await request.getPendingTransactions(safeAddress, nonce);
|
|
85
82
|
return transactions;
|
|
@@ -263,7 +260,6 @@ Safe.createSafeApiKit = (network) => {
|
|
|
263
260
|
return new SafeApiKit({
|
|
264
261
|
chainId: BigInt(network),
|
|
265
262
|
txServiceUrl: getTxServiceUrl(network) || undefined,
|
|
266
|
-
apiKey: Safe.apiKey,
|
|
267
263
|
});
|
|
268
264
|
};
|
|
269
265
|
export default Safe;
|
package/dist/utils.js
CHANGED
|
@@ -100,7 +100,6 @@ export async function standardizeSafeTransactionData(safeAddress, safeContract,
|
|
|
100
100
|
const request = new RequestProvider({
|
|
101
101
|
networkId: network,
|
|
102
102
|
adapter: Safe.adapter,
|
|
103
|
-
apiKey: Safe.apiKey,
|
|
104
103
|
});
|
|
105
104
|
const safeTxGas = tx.safeTxGas ??
|
|
106
105
|
(await request.getSafeTxGas(safeAddress, version, standardizedTxs));
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -279,11 +279,9 @@ export default class RequestProvider {
|
|
|
279
279
|
constructor({
|
|
280
280
|
networkId,
|
|
281
281
|
adapter,
|
|
282
|
-
apiKey,
|
|
283
282
|
}: {
|
|
284
283
|
networkId: string;
|
|
285
284
|
adapter?: AxiosAdapter;
|
|
286
|
-
apiKey: string;
|
|
287
285
|
}) {
|
|
288
286
|
const txServiceUrl = getTxServiceUrl(networkId);
|
|
289
287
|
if (!txServiceUrl) {
|
|
@@ -295,12 +293,6 @@ export default class RequestProvider {
|
|
|
295
293
|
this.request = axios.create({
|
|
296
294
|
baseURL: this.host,
|
|
297
295
|
adapter,
|
|
298
|
-
|
|
299
|
-
headers: apiKey
|
|
300
|
-
? {
|
|
301
|
-
Authorization: `Bearer ${apiKey}`,
|
|
302
|
-
}
|
|
303
|
-
: undefined,
|
|
304
296
|
});
|
|
305
297
|
|
|
306
298
|
this.request.interceptors.response.use((response) => {
|
package/src/index.ts
CHANGED
|
@@ -37,13 +37,12 @@ class Safe {
|
|
|
37
37
|
apiKit: SafeApiKit;
|
|
38
38
|
|
|
39
39
|
static adapter: AxiosAdapter;
|
|
40
|
-
static apiKey: string;
|
|
41
40
|
|
|
42
41
|
constructor(
|
|
43
42
|
safeAddress: string,
|
|
44
43
|
version: string,
|
|
45
44
|
provider: providers.Web3Provider,
|
|
46
|
-
network = "1"
|
|
45
|
+
network = "1",
|
|
47
46
|
) {
|
|
48
47
|
const contract = getSafeSingletonDeployment({
|
|
49
48
|
version,
|
|
@@ -60,7 +59,6 @@ class Safe {
|
|
|
60
59
|
this.request = new RequestProvider({
|
|
61
60
|
networkId: network,
|
|
62
61
|
adapter: Safe.adapter,
|
|
63
|
-
apiKey: Safe.apiKey,
|
|
64
62
|
});
|
|
65
63
|
this.apiKit = Safe.createSafeApiKit(network);
|
|
66
64
|
|
|
@@ -77,7 +75,6 @@ class Safe {
|
|
|
77
75
|
const request = new RequestProvider({
|
|
78
76
|
networkId: network,
|
|
79
77
|
adapter: Safe.adapter,
|
|
80
|
-
apiKey: Safe.apiKey,
|
|
81
78
|
});
|
|
82
79
|
return request.getSafeInfo(ethers.utils.getAddress(safeAddress));
|
|
83
80
|
}
|
|
@@ -85,16 +82,15 @@ class Safe {
|
|
|
85
82
|
static async getPendingTransactions(
|
|
86
83
|
safeAddress: string,
|
|
87
84
|
network: string,
|
|
88
|
-
nonce: number
|
|
85
|
+
nonce: number,
|
|
89
86
|
) {
|
|
90
87
|
const request = new RequestProvider({
|
|
91
88
|
networkId: network,
|
|
92
89
|
adapter: Safe.adapter,
|
|
93
|
-
apiKey: Safe.apiKey,
|
|
94
90
|
});
|
|
95
91
|
const transactions = await request.getPendingTransactions(
|
|
96
92
|
safeAddress,
|
|
97
|
-
nonce
|
|
93
|
+
nonce,
|
|
98
94
|
);
|
|
99
95
|
|
|
100
96
|
return transactions;
|
|
@@ -104,7 +100,6 @@ class Safe {
|
|
|
104
100
|
return new SafeApiKit({
|
|
105
101
|
chainId: BigInt(network),
|
|
106
102
|
txServiceUrl: getTxServiceUrl(network) || undefined,
|
|
107
|
-
apiKey: Safe.apiKey,
|
|
108
103
|
});
|
|
109
104
|
};
|
|
110
105
|
|
|
@@ -112,7 +107,7 @@ class Safe {
|
|
|
112
107
|
const nonce = await this.getNonce();
|
|
113
108
|
const transactions = await this.request.getPendingTransactions(
|
|
114
109
|
this.safeAddress,
|
|
115
|
-
nonce
|
|
110
|
+
nonce,
|
|
116
111
|
);
|
|
117
112
|
|
|
118
113
|
return transactions;
|
|
@@ -144,7 +139,7 @@ class Safe {
|
|
|
144
139
|
type: "function",
|
|
145
140
|
},
|
|
146
141
|
],
|
|
147
|
-
provider
|
|
142
|
+
provider,
|
|
148
143
|
);
|
|
149
144
|
|
|
150
145
|
const version = await contract.VERSION();
|
|
@@ -157,7 +152,7 @@ class Safe {
|
|
|
157
152
|
this.safeInfo = safeInfo;
|
|
158
153
|
if (this.version !== safeInfo.version) {
|
|
159
154
|
throw new Error(
|
|
160
|
-
`Current version ${this.version} not matched address version ${safeInfo.version}
|
|
155
|
+
`Current version ${this.version} not matched address version ${safeInfo.version}`,
|
|
161
156
|
);
|
|
162
157
|
}
|
|
163
158
|
this.version = safeInfo.version;
|
|
@@ -202,7 +197,7 @@ class Safe {
|
|
|
202
197
|
this.provider,
|
|
203
198
|
data,
|
|
204
199
|
this.network,
|
|
205
|
-
this.version
|
|
200
|
+
this.version,
|
|
206
201
|
);
|
|
207
202
|
return new EthSafeTransaction(transaction);
|
|
208
203
|
}
|
|
@@ -219,7 +214,7 @@ class Safe {
|
|
|
219
214
|
transactionData.gasPrice,
|
|
220
215
|
transactionData.gasToken,
|
|
221
216
|
transactionData.refundReceiver,
|
|
222
|
-
transactionData.nonce
|
|
217
|
+
transactionData.nonce,
|
|
223
218
|
);
|
|
224
219
|
}
|
|
225
220
|
|
|
@@ -228,7 +223,7 @@ class Safe {
|
|
|
228
223
|
const signer = await this.provider.getSigner(0);
|
|
229
224
|
const signerAddress = await signer.getAddress();
|
|
230
225
|
const addressIsOwner = owners.find(
|
|
231
|
-
(owner: string) => signerAddress && sameString(owner, signerAddress)
|
|
226
|
+
(owner: string) => signerAddress && sameString(owner, signerAddress),
|
|
232
227
|
);
|
|
233
228
|
if (!addressIsOwner) {
|
|
234
229
|
throw new Error("Transactions can only be signed by Safe owners");
|
|
@@ -294,7 +289,7 @@ class Safe {
|
|
|
294
289
|
|
|
295
290
|
async executeTransaction(
|
|
296
291
|
safeTransaction: SafeTransaction,
|
|
297
|
-
options?: TransactionOptions
|
|
292
|
+
options?: TransactionOptions,
|
|
298
293
|
): Promise<TransactionResult> {
|
|
299
294
|
const txHash = await this.getTransactionHash(safeTransaction);
|
|
300
295
|
const ownersWhoApprovedTx = await this.getOwnersWhoApprovedTx(txHash);
|
|
@@ -307,7 +302,7 @@ class Safe {
|
|
|
307
302
|
const signerAddress = await signer.getAddress();
|
|
308
303
|
if (owners.includes(signerAddress)) {
|
|
309
304
|
safeTransaction.addSignature(
|
|
310
|
-
generatePreValidatedSignature(signerAddress)
|
|
305
|
+
generatePreValidatedSignature(signerAddress),
|
|
311
306
|
);
|
|
312
307
|
}
|
|
313
308
|
|
|
@@ -319,7 +314,7 @@ class Safe {
|
|
|
319
314
|
signaturesMissing > 1 ? "are" : "is"
|
|
320
315
|
} ${signaturesMissing} signature${
|
|
321
316
|
signaturesMissing > 1 ? "s" : ""
|
|
322
|
-
} missing
|
|
317
|
+
} missing`,
|
|
323
318
|
);
|
|
324
319
|
}
|
|
325
320
|
|
|
@@ -353,7 +348,7 @@ class Safe {
|
|
|
353
348
|
safeTransaction.data.gasToken,
|
|
354
349
|
safeTransaction.data.refundReceiver,
|
|
355
350
|
safeTransaction.encodedSignatures(),
|
|
356
|
-
executionOptions
|
|
351
|
+
executionOptions,
|
|
357
352
|
);
|
|
358
353
|
|
|
359
354
|
return txResponse;
|
|
@@ -379,7 +374,7 @@ class Safe {
|
|
|
379
374
|
ethers.utils.getAddress(safeAddress),
|
|
380
375
|
messageHash,
|
|
381
376
|
safeVersion,
|
|
382
|
-
chainId
|
|
377
|
+
chainId,
|
|
383
378
|
);
|
|
384
379
|
};
|
|
385
380
|
|
|
@@ -405,7 +400,7 @@ class Safe {
|
|
|
405
400
|
});
|
|
406
401
|
} catch (error) {
|
|
407
402
|
throw new Error(
|
|
408
|
-
"Could not add a new off-chain message to the Safe account"
|
|
403
|
+
"Could not add a new off-chain message to the Safe account",
|
|
409
404
|
);
|
|
410
405
|
}
|
|
411
406
|
}
|