@polymarket/relayer-client 3.0.0 → 4.0.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 (54) hide show
  1. package/README.md +7 -9
  2. package/package.json +10 -23
  3. package/dist/abis/erc20Abi.d.ts +0 -38
  4. package/dist/abis/erc20Abi.js +0 -222
  5. package/dist/abis/index.d.ts +0 -5
  6. package/dist/abis/index.js +0 -5
  7. package/dist/abis/multisend.d.ts +0 -13
  8. package/dist/abis/multisend.js +0 -17
  9. package/dist/abis/proxyFactory.d.ts +0 -66
  10. package/dist/abis/proxyFactory.js +0 -319
  11. package/dist/abis/safe.d.ts +0 -35
  12. package/dist/abis/safe.js +0 -1138
  13. package/dist/abis/safeFactory.d.ts +0 -60
  14. package/dist/abis/safeFactory.js +0 -224
  15. package/dist/auth/handler.d.ts +0 -15
  16. package/dist/auth/handler.js +0 -44
  17. package/dist/auth/index.d.ts +0 -1
  18. package/dist/auth/index.js +0 -1
  19. package/dist/builder/create.d.ts +0 -4
  20. package/dist/builder/create.js +0 -48
  21. package/dist/builder/derive.d.ts +0 -2
  22. package/dist/builder/derive.js +0 -16
  23. package/dist/builder/index.d.ts +0 -4
  24. package/dist/builder/index.js +0 -4
  25. package/dist/builder/proxy.d.ts +0 -4
  26. package/dist/builder/proxy.js +0 -70
  27. package/dist/builder/safe.d.ts +0 -5
  28. package/dist/builder/safe.js +0 -100
  29. package/dist/client.d.ts +0 -41
  30. package/dist/client.js +0 -173
  31. package/dist/config/index.d.ts +0 -13
  32. package/dist/config/index.js +0 -31
  33. package/dist/constants/index.d.ts +0 -3
  34. package/dist/constants/index.js +0 -3
  35. package/dist/encode/index.d.ts +0 -2
  36. package/dist/encode/index.js +0 -2
  37. package/dist/encode/proxy.d.ts +0 -2
  38. package/dist/encode/proxy.js +0 -12
  39. package/dist/encode/safe.d.ts +0 -2
  40. package/dist/encode/safe.js +0 -19
  41. package/dist/endpoints.d.ts +0 -5
  42. package/dist/endpoints.js +0 -5
  43. package/dist/http-helpers/index.d.ts +0 -10
  44. package/dist/http-helpers/index.js +0 -46
  45. package/dist/index.d.ts +0 -4
  46. package/dist/index.js +0 -4
  47. package/dist/manual/index.d.ts +0 -5
  48. package/dist/manual/index.js +0 -47
  49. package/dist/response/index.d.ts +0 -21
  50. package/dist/response/index.js +0 -37
  51. package/dist/types.d.ts +0 -132
  52. package/dist/types.js +0 -28
  53. package/dist/utils/index.d.ts +0 -7
  54. package/dist/utils/index.js +0 -30
@@ -1,60 +0,0 @@
1
- export declare const safeFactoryAbi: ({
2
- inputs: {
3
- internalType: string;
4
- name: string;
5
- type: string;
6
- }[];
7
- stateMutability: string;
8
- type: string;
9
- anonymous?: undefined;
10
- name?: undefined;
11
- outputs?: undefined;
12
- } | {
13
- anonymous: boolean;
14
- inputs: {
15
- indexed: boolean;
16
- internalType: string;
17
- name: string;
18
- type: string;
19
- }[];
20
- name: string;
21
- type: string;
22
- stateMutability?: undefined;
23
- outputs?: undefined;
24
- } | {
25
- inputs: {
26
- internalType: string;
27
- name: string;
28
- type: string;
29
- }[];
30
- name: string;
31
- outputs: {
32
- internalType: string;
33
- name: string;
34
- type: string;
35
- }[];
36
- stateMutability: string;
37
- type: string;
38
- anonymous?: undefined;
39
- } | {
40
- inputs: ({
41
- internalType: string;
42
- name: string;
43
- type: string;
44
- components?: undefined;
45
- } | {
46
- components: {
47
- internalType: string;
48
- name: string;
49
- type: string;
50
- }[];
51
- internalType: string;
52
- name: string;
53
- type: string;
54
- })[];
55
- name: string;
56
- outputs: never[];
57
- stateMutability: string;
58
- type: string;
59
- anonymous?: undefined;
60
- })[];
@@ -1,224 +0,0 @@
1
- export const safeFactoryAbi = [
2
- {
3
- "inputs": [
4
- {
5
- "internalType": "address",
6
- "name": "_masterCopy",
7
- "type": "address"
8
- },
9
- {
10
- "internalType": "address",
11
- "name": "_fallbackHandler",
12
- "type": "address"
13
- }
14
- ],
15
- "stateMutability": "nonpayable",
16
- "type": "constructor"
17
- },
18
- {
19
- "anonymous": false,
20
- "inputs": [
21
- {
22
- "indexed": false,
23
- "internalType": "contract GnosisSafe",
24
- "name": "proxy",
25
- "type": "address"
26
- },
27
- {
28
- "indexed": false,
29
- "internalType": "address",
30
- "name": "owner",
31
- "type": "address"
32
- }
33
- ],
34
- "name": "ProxyCreation",
35
- "type": "event"
36
- },
37
- {
38
- "inputs": [],
39
- "name": "CREATE_PROXY_TYPEHASH",
40
- "outputs": [
41
- {
42
- "internalType": "bytes32",
43
- "name": "",
44
- "type": "bytes32"
45
- }
46
- ],
47
- "stateMutability": "view",
48
- "type": "function"
49
- },
50
- {
51
- "inputs": [],
52
- "name": "DOMAIN_TYPEHASH",
53
- "outputs": [
54
- {
55
- "internalType": "bytes32",
56
- "name": "",
57
- "type": "bytes32"
58
- }
59
- ],
60
- "stateMutability": "view",
61
- "type": "function"
62
- },
63
- {
64
- "inputs": [],
65
- "name": "NAME",
66
- "outputs": [
67
- {
68
- "internalType": "string",
69
- "name": "",
70
- "type": "string"
71
- }
72
- ],
73
- "stateMutability": "view",
74
- "type": "function"
75
- },
76
- {
77
- "inputs": [
78
- {
79
- "internalType": "address",
80
- "name": "user",
81
- "type": "address"
82
- }
83
- ],
84
- "name": "computeProxyAddress",
85
- "outputs": [
86
- {
87
- "internalType": "address",
88
- "name": "",
89
- "type": "address"
90
- }
91
- ],
92
- "stateMutability": "view",
93
- "type": "function"
94
- },
95
- {
96
- "inputs": [
97
- {
98
- "internalType": "address",
99
- "name": "paymentToken",
100
- "type": "address"
101
- },
102
- {
103
- "internalType": "uint256",
104
- "name": "payment",
105
- "type": "uint256"
106
- },
107
- {
108
- "internalType": "address payable",
109
- "name": "paymentReceiver",
110
- "type": "address"
111
- },
112
- {
113
- "components": [
114
- {
115
- "internalType": "uint8",
116
- "name": "v",
117
- "type": "uint8"
118
- },
119
- {
120
- "internalType": "bytes32",
121
- "name": "r",
122
- "type": "bytes32"
123
- },
124
- {
125
- "internalType": "bytes32",
126
- "name": "s",
127
- "type": "bytes32"
128
- }
129
- ],
130
- "internalType": "struct SafeProxyFactory.Sig",
131
- "name": "createSig",
132
- "type": "tuple"
133
- }
134
- ],
135
- "name": "createProxy",
136
- "outputs": [],
137
- "stateMutability": "nonpayable",
138
- "type": "function"
139
- },
140
- {
141
- "inputs": [],
142
- "name": "domainSeparator",
143
- "outputs": [
144
- {
145
- "internalType": "bytes32",
146
- "name": "",
147
- "type": "bytes32"
148
- }
149
- ],
150
- "stateMutability": "view",
151
- "type": "function"
152
- },
153
- {
154
- "inputs": [],
155
- "name": "fallbackHandler",
156
- "outputs": [
157
- {
158
- "internalType": "address",
159
- "name": "",
160
- "type": "address"
161
- }
162
- ],
163
- "stateMutability": "view",
164
- "type": "function"
165
- },
166
- {
167
- "inputs": [],
168
- "name": "getContractBytecode",
169
- "outputs": [
170
- {
171
- "internalType": "bytes",
172
- "name": "",
173
- "type": "bytes"
174
- }
175
- ],
176
- "stateMutability": "view",
177
- "type": "function"
178
- },
179
- {
180
- "inputs": [
181
- {
182
- "internalType": "address",
183
- "name": "user",
184
- "type": "address"
185
- }
186
- ],
187
- "name": "getSalt",
188
- "outputs": [
189
- {
190
- "internalType": "bytes32",
191
- "name": "",
192
- "type": "bytes32"
193
- }
194
- ],
195
- "stateMutability": "pure",
196
- "type": "function"
197
- },
198
- {
199
- "inputs": [],
200
- "name": "masterCopy",
201
- "outputs": [
202
- {
203
- "internalType": "address",
204
- "name": "",
205
- "type": "address"
206
- }
207
- ],
208
- "stateMutability": "view",
209
- "type": "function"
210
- },
211
- {
212
- "inputs": [],
213
- "name": "proxyCreationCode",
214
- "outputs": [
215
- {
216
- "internalType": "bytes",
217
- "name": "",
218
- "type": "bytes"
219
- }
220
- ],
221
- "stateMutability": "pure",
222
- "type": "function"
223
- }
224
- ];
@@ -1,15 +0,0 @@
1
- import { HttpClient } from "../http-helpers/index.ts";
2
- import { AuthArgs } from "../types.ts";
3
- export declare class AuthHandler {
4
- readonly url: string;
5
- readonly httpClient: HttpClient;
6
- readonly token?: string;
7
- private cookie?;
8
- constructor(httpClient: HttpClient, args: AuthArgs);
9
- /**
10
- * Logs in to the auth url
11
- * Extracts polymarket session cookies from the auth response header and cache it locally.
12
- */
13
- login(): Promise<void>;
14
- getPolymarketCookies(): Promise<string>;
15
- }
@@ -1,44 +0,0 @@
1
- import { GET } from "../http-helpers/index.js";
2
- const POLYMARKET_COOKIE_NAME = "polymarket";
3
- export class AuthHandler {
4
- url;
5
- httpClient;
6
- token;
7
- cookie;
8
- constructor(httpClient, args) {
9
- if (args.authUrl == undefined || args.authToken == undefined) {
10
- throw new Error("invalid authorization arguments");
11
- }
12
- this.url = args.authUrl.endsWith("/") ? args.authUrl.slice(0, -1) : args.authUrl;
13
- this.token = args.authToken;
14
- this.httpClient = httpClient;
15
- }
16
- /**
17
- * Logs in to the auth url
18
- * Extracts polymarket session cookies from the auth response header and cache it locally.
19
- */
20
- async login() {
21
- if (this.cookie == undefined) {
22
- // Logging in will set the session cookies on the httpClient
23
- const resp = await this.httpClient.send(`${this.url}/login/internal`, GET, { Authorization: `Bearer ${this.token}` });
24
- const cookies = resp.headers['set-cookie'];
25
- let aggregatedCookie = "";
26
- for (const cookie of cookies) {
27
- if (cookie.includes(POLYMARKET_COOKIE_NAME)) {
28
- aggregatedCookie += `${cookie}; `;
29
- }
30
- }
31
- if (aggregatedCookie != "") {
32
- this.cookie = aggregatedCookie;
33
- }
34
- console.log(`Successfully logged in!`);
35
- }
36
- }
37
- async getPolymarketCookies() {
38
- if (this.cookie == undefined) {
39
- console.log("Authorization not set, logging in...");
40
- await this.login();
41
- }
42
- return this.cookie;
43
- }
44
- }
@@ -1 +0,0 @@
1
- export * from "./handler.ts";
@@ -1 +0,0 @@
1
- export * from "./handler.js";
@@ -1,4 +0,0 @@
1
- import { SafeCreateTransactionArgs, TransactionRequest } from "../types.ts";
2
- import { IAbstractSigner } from "@polymarket/abstract-signer";
3
- import { SafeContractConfig } from "../config/index.ts";
4
- export declare function buildSafeCreateTransactionRequest(signer: IAbstractSigner, safeContractConfig: SafeContractConfig, args: SafeCreateTransactionArgs): Promise<TransactionRequest>;
@@ -1,48 +0,0 @@
1
- import { TransactionType } from "../types.js";
2
- import { SAFE_FACTORY_NAME } from "../constants/index.js";
3
- import { deriveSafe } from "./derive.js";
4
- async function createSafeCreateSignature(signer, safeFactory, chainId, paymentToken, payment, paymentReceiver) {
5
- const domain = {
6
- name: SAFE_FACTORY_NAME,
7
- chainId: BigInt(chainId),
8
- verifyingContract: safeFactory,
9
- };
10
- const types = {
11
- CreateProxy: [
12
- { name: "paymentToken", type: "address" },
13
- { name: "payment", type: "uint256" },
14
- { name: "paymentReceiver", type: "address" },
15
- ],
16
- };
17
- const values = {
18
- paymentToken,
19
- payment: BigInt(payment),
20
- paymentReceiver,
21
- };
22
- const sig = await signer.signTypedData(domain, types, values, "CreateProxy");
23
- console.log(`Sig: ${sig}`);
24
- return sig;
25
- }
26
- export async function buildSafeCreateTransactionRequest(signer, safeContractConfig, args) {
27
- const safeFactory = safeContractConfig.SafeFactory;
28
- const sig = await createSafeCreateSignature(signer, safeFactory, args.chainId, args.paymentToken, args.payment, args.paymentReceiver);
29
- const sigParams = {
30
- paymentToken: args.paymentToken,
31
- payment: args.payment,
32
- paymentReceiver: args.paymentReceiver,
33
- };
34
- const safeAddress = deriveSafe(args.from, safeFactory);
35
- const request = {
36
- from: args.from,
37
- to: safeFactory,
38
- // Note: obviously the safe here does not exist yet but useful to have this data in the db
39
- proxyWallet: safeAddress,
40
- data: "0x",
41
- signature: sig,
42
- signatureParams: sigParams,
43
- type: TransactionType.SAFE_CREATE,
44
- };
45
- console.log(`Created a SAFE-CREATE Transaction:`);
46
- console.log(request);
47
- return request;
48
- }
@@ -1,2 +0,0 @@
1
- export declare const deriveProxyWallet: (address: string, proxyFactory: string) => string;
2
- export declare const deriveSafe: (address: string, safeFactory: string) => string;
@@ -1,16 +0,0 @@
1
- import { keccak256, encodePacked, getCreate2Address, encodeAbiParameters } from 'viem';
2
- import { SAFE_INIT_CODE_HASH, PROXY_INIT_CODE_HASH } from "../constants/index.js";
3
- export const deriveProxyWallet = (address, proxyFactory) => {
4
- return getCreate2Address({
5
- bytecodeHash: PROXY_INIT_CODE_HASH,
6
- from: proxyFactory,
7
- salt: keccak256(encodePacked(["address"], [address]))
8
- });
9
- };
10
- export const deriveSafe = (address, safeFactory) => {
11
- return getCreate2Address({
12
- bytecodeHash: SAFE_INIT_CODE_HASH,
13
- from: safeFactory,
14
- salt: keccak256(encodeAbiParameters([{ name: 'address', type: 'address' }], [address]))
15
- });
16
- };
@@ -1,4 +0,0 @@
1
- export * from "./proxy.ts";
2
- export * from "./safe.ts";
3
- export * from "./create.ts";
4
- export * from "./derive.ts";
@@ -1,4 +0,0 @@
1
- export * from "./proxy.js";
2
- export * from "./safe.js";
3
- export * from "./create.js";
4
- export * from "./derive.js";
@@ -1,4 +0,0 @@
1
- import { IAbstractSigner } from "@polymarket/abstract-signer";
2
- import { ProxyTransactionArgs, TransactionRequest } from "../types.ts";
3
- import { ProxyContractConfig } from "../config/index.ts";
4
- export declare function buildProxyTransactionRequest(signer: IAbstractSigner, args: ProxyTransactionArgs, proxyContractConfig: ProxyContractConfig, metadata?: string): Promise<TransactionRequest>;
@@ -1,70 +0,0 @@
1
- import { concat, keccak256, toHex } from "viem";
2
- import { TransactionType } from "../types.js";
3
- import { deriveProxyWallet } from "./derive.js";
4
- function createStructHash(from, to, data, txFee, gasPrice, gasLimit, nonce, relayHubAddress, relayAddress) {
5
- const relayHubPrefix = toHex("rlx:");
6
- const encodedFrom = from;
7
- const encodedTo = to;
8
- const encodedData = data;
9
- const encodedTxFee = toHex(BigInt(txFee), { size: 32 });
10
- const encodedGasPrice = toHex(BigInt(gasPrice), { size: 32 });
11
- const encodedGasLimit = toHex(BigInt(gasLimit), { size: 32 });
12
- const encodedNonce = toHex(BigInt(nonce), { size: 32 });
13
- const encodedRelayHubAddress = relayHubAddress;
14
- const encodedRelayAddress = relayAddress;
15
- const dataToHash = concat([
16
- relayHubPrefix,
17
- encodedFrom,
18
- encodedTo,
19
- encodedData,
20
- encodedTxFee,
21
- encodedGasPrice,
22
- encodedGasLimit,
23
- encodedNonce,
24
- encodedRelayHubAddress,
25
- encodedRelayAddress,
26
- ]);
27
- return keccak256(dataToHash);
28
- }
29
- async function createProxySignature(signer, structHash) {
30
- return signer.signMessage(structHash);
31
- }
32
- export async function buildProxyTransactionRequest(signer, args, proxyContractConfig, metadata) {
33
- const proxyWalletFactory = proxyContractConfig.ProxyFactory;
34
- const to = proxyWalletFactory;
35
- const proxy = deriveProxyWallet(args.from, proxyWalletFactory);
36
- const relayerFee = "0";
37
- const relayHub = proxyContractConfig.RelayHub;
38
- const gasLimit = args.gasLimit ? args.gasLimit : await signer.estimateGas({
39
- from: args.from,
40
- to: to,
41
- data: args.data,
42
- });
43
- const gasLimitStr = gasLimit.toString();
44
- const sigParams = {
45
- gasPrice: args.gasPrice,
46
- gasLimit: gasLimitStr,
47
- relayerFee: relayerFee,
48
- relayHub: relayHub,
49
- relay: args.relay,
50
- };
51
- const txHash = createStructHash(args.from, to, args.data, relayerFee, args.gasPrice, gasLimitStr, args.nonce, relayHub, args.relay);
52
- const sig = await createProxySignature(signer, txHash);
53
- if (metadata == undefined) {
54
- metadata = "";
55
- }
56
- const req = {
57
- from: args.from,
58
- to: to,
59
- proxyWallet: proxy,
60
- data: args.data,
61
- nonce: args.nonce,
62
- signature: sig,
63
- signatureParams: sigParams,
64
- type: TransactionType.PROXY,
65
- metadata: metadata,
66
- };
67
- console.log(`Created Proxy Transaction Request:`);
68
- console.log(req);
69
- return req;
70
- }
@@ -1,5 +0,0 @@
1
- import { IAbstractSigner } from "@polymarket/abstract-signer";
2
- import { SafeTransaction, SafeTransactionArgs, TransactionRequest } from "../types.ts";
3
- import { SafeContractConfig } from "../config/index.ts";
4
- export declare function aggregateTransaction(txns: SafeTransaction[], safeMultisend: string): SafeTransaction;
5
- export declare function buildSafeTransactionRequest(signer: IAbstractSigner, args: SafeTransactionArgs, safeContractConfig: SafeContractConfig, metadata?: string): Promise<TransactionRequest>;
@@ -1,100 +0,0 @@
1
- import { hashTypedData, zeroAddress } from "viem";
2
- import { TransactionType } from "../types.js";
3
- import { deriveSafe } from "./derive.js";
4
- import { createSafeMultisendTransaction } from "../encode/safe.js";
5
- import { splitAndPackSig } from "../utils/index.js";
6
- async function createSafeSignature(signer, structHash) {
7
- return signer.signMessage(structHash);
8
- }
9
- function createStructHash(chainId, safe, to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, nonce) {
10
- const domain = {
11
- chainId: chainId,
12
- verifyingContract: safe,
13
- };
14
- const types = {
15
- // keccak256(
16
- // "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)"
17
- // );
18
- SafeTx: [
19
- { name: 'to', type: 'address' },
20
- { name: 'value', type: 'uint256' },
21
- { name: 'data', type: 'bytes' },
22
- { name: 'operation', type: 'uint8' },
23
- { name: 'safeTxGas', type: 'uint256' },
24
- { name: 'baseGas', type: 'uint256' },
25
- { name: 'gasPrice', type: 'uint256' },
26
- { name: 'gasToken', type: 'address' },
27
- { name: 'refundReceiver', type: 'address' },
28
- { name: 'nonce', type: 'uint256' },
29
- ],
30
- };
31
- const values = {
32
- to: to,
33
- value: value,
34
- data: data,
35
- operation: operation,
36
- safeTxGas: safeTxGas,
37
- baseGas: baseGas,
38
- gasPrice: gasPrice,
39
- gasToken: gasToken,
40
- refundReceiver: refundReceiver,
41
- nonce: nonce,
42
- };
43
- // // viem hashTypedData
44
- // const structHash = _TypedDataEncoder.hash(domain, types, values);
45
- const structHash = hashTypedData({ primaryType: "SafeTx", domain: domain, types: types, message: values });
46
- return structHash;
47
- }
48
- export function aggregateTransaction(txns, safeMultisend) {
49
- let transaction;
50
- if (txns.length == 1) {
51
- transaction = txns[0];
52
- }
53
- else {
54
- transaction = createSafeMultisendTransaction(txns, safeMultisend);
55
- }
56
- return transaction;
57
- }
58
- export async function buildSafeTransactionRequest(signer, args, safeContractConfig, metadata) {
59
- const safeFactory = safeContractConfig.SafeFactory;
60
- const safeMultisend = safeContractConfig.SafeMultisend;
61
- const transaction = aggregateTransaction(args.transactions, safeMultisend);
62
- const safeTxnGas = "0";
63
- const baseGas = "0";
64
- const gasPrice = "0";
65
- const gasToken = zeroAddress;
66
- const refundReceiver = zeroAddress;
67
- const safeAddress = deriveSafe(args.from, safeFactory);
68
- // Generate the struct hash
69
- // NOTE: this includes a client side optimization over the current relayers
70
- // Generates struct hash locally instead of going across the network using the RPC call
71
- const structHash = createStructHash(args.chainId, safeAddress, transaction.to, transaction.value, transaction.data, transaction.operation, safeTxnGas, baseGas, gasPrice, gasToken, refundReceiver, args.nonce);
72
- const sig = await createSafeSignature(signer, structHash);
73
- // Split the sig then pack it into Gnosis accepted rsv format
74
- const packedSig = splitAndPackSig(sig);
75
- const sigParams = {
76
- gasPrice,
77
- operation: `${transaction.operation}`,
78
- safeTxnGas,
79
- baseGas,
80
- gasToken,
81
- refundReceiver,
82
- };
83
- if (metadata == undefined) {
84
- metadata = "";
85
- }
86
- const req = {
87
- from: args.from,
88
- to: transaction.to,
89
- proxyWallet: safeAddress,
90
- data: transaction.data,
91
- nonce: args.nonce,
92
- signature: packedSig,
93
- signatureParams: sigParams,
94
- type: TransactionType.SAFE,
95
- metadata: metadata,
96
- };
97
- console.log(`Created Safe Transaction Request: `);
98
- console.log(req);
99
- return req;
100
- }
package/dist/client.d.ts DELETED
@@ -1,41 +0,0 @@
1
- import { Wallet } from "@ethersproject/wallet";
2
- import { JsonRpcSigner } from "@ethersproject/providers";
3
- import { WalletClient } from "viem";
4
- import { IAbstractSigner } from "@polymarket/abstract-signer";
5
- import { HttpClient } from "./http-helpers/index.ts";
6
- import { AddressPayload, AuthArgs, IManualTransactionResponse, ManualOverrides, NoncePayload, ProxyTransaction, RelayerTransaction, RelayerTransactionResponse, RelayPayload, SafeTransaction } from "./types.ts";
7
- import { AuthHandler } from "./auth/handler.ts";
8
- import { ContractConfig } from "./config/index.ts";
9
- export declare class RelayClient {
10
- readonly relayerUrl: string;
11
- readonly chainId: number;
12
- readonly contractConfig: ContractConfig;
13
- readonly httpClient: HttpClient;
14
- readonly signer?: IAbstractSigner;
15
- readonly authHandler?: AuthHandler;
16
- constructor(relayerUrl: string, chainId: number, signer?: Wallet | JsonRpcSigner | WalletClient, authArgs?: AuthArgs);
17
- getRelayAddress(): Promise<AddressPayload>;
18
- getNonce(signerAddress: string, signerType: string): Promise<NoncePayload>;
19
- getRelayPayload(signerAddress: string, signerType: string): Promise<RelayPayload>;
20
- getTransaction(transactionId: string): Promise<RelayerTransaction[]>;
21
- getTransactions(): Promise<RelayerTransaction[]>;
22
- executeProxyTransactions(txns: ProxyTransaction[], metadata?: string): Promise<RelayerTransactionResponse>;
23
- executeSafeTransactions(txns: SafeTransaction[], metadata?: string): Promise<RelayerTransactionResponse>;
24
- executeManualTransactions(txns: SafeTransaction[], overrides?: ManualOverrides): Promise<IManualTransactionResponse>;
25
- deploySafe(): Promise<RelayerTransactionResponse>;
26
- /**
27
- * Periodically polls the transaction id until it reaches a desired state
28
- * Returns the relayer transaction if it does each the desired state
29
- * Returns undefined if the transaction hits the failed state
30
- * Times out after maxPolls is reached
31
- * @param transactionId
32
- * @param states
33
- * @param failState
34
- * @param maxPolls
35
- * @param pollFrequency
36
- * @returns
37
- */
38
- pollUntilState(transactionId: string, states: string[], failState?: string, maxPolls?: number, pollFrequency?: number): Promise<RelayerTransaction | undefined>;
39
- private submitTransaction;
40
- private send;
41
- }