@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
package/dist/client.js DELETED
@@ -1,173 +0,0 @@
1
- import { isBrowser } from "browser-or-node";
2
- import { zeroAddress } from "viem";
3
- import { createAbstractSigner } from "@polymarket/abstract-signer";
4
- import { GET, POST, HttpClient, } from "./http-helpers/index.js";
5
- import { TransactionType } from "./types.js";
6
- import { GET_ADDRESS, GET_NONCE, GET_RELAY_PAYLOAD, GET_TRANSACTION, SUBMIT_TRANSACTION, } from "./endpoints.js";
7
- import { buildProxyTransactionRequest, buildSafeTransactionRequest, buildSafeCreateTransactionRequest, } from "./builder/index.js";
8
- import { encodeProxyTransactionData } from "./encode/index.js";
9
- import { AuthHandler } from "./auth/handler.js";
10
- import { sleep } from "./utils/index.js";
11
- import { executeManualTransactions } from "./manual/index.js";
12
- import { ClientRelayerTransactionResponse } from "./response/index.js";
13
- import { getContractConfig } from "./config/index.js";
14
- export class RelayClient {
15
- relayerUrl;
16
- chainId;
17
- contractConfig;
18
- httpClient;
19
- signer;
20
- authHandler;
21
- constructor(relayerUrl, chainId, signer, authArgs) {
22
- this.relayerUrl = relayerUrl.endsWith("/") ? relayerUrl.slice(0, -1) : relayerUrl;
23
- this.chainId = chainId;
24
- this.contractConfig = getContractConfig(chainId);
25
- this.httpClient = new HttpClient();
26
- if (signer != undefined) {
27
- this.signer = createAbstractSigner(chainId, signer);
28
- }
29
- if (authArgs !== undefined) {
30
- this.authHandler = new AuthHandler(this.httpClient, authArgs);
31
- }
32
- }
33
- async getRelayAddress() {
34
- return this.send(`${this.relayerUrl}${GET_ADDRESS}`, GET);
35
- }
36
- async getNonce(signerAddress, signerType) {
37
- return this.send(`${this.relayerUrl}${GET_NONCE}?address=${signerAddress}&type=${signerType}`, GET);
38
- }
39
- async getRelayPayload(signerAddress, signerType) {
40
- return this.send(`${this.relayerUrl}${GET_RELAY_PAYLOAD}?address=${signerAddress}&type=${signerType}`, GET);
41
- }
42
- async getTransaction(transactionId) {
43
- return this.send(`${this.relayerUrl}${GET_TRANSACTION}?id=${transactionId}`, GET);
44
- }
45
- async getTransactions() {
46
- return this.send(`${this.relayerUrl}${GET_TRANSACTION}s`, GET);
47
- }
48
- async executeProxyTransactions(txns, metadata) {
49
- if (this.signer == undefined) {
50
- throw new Error("missing signer");
51
- }
52
- const start = Date.now();
53
- const from = await this.signer.getAddress();
54
- const rp = await this.getRelayPayload(from, TransactionType.PROXY);
55
- const args = {
56
- from: from,
57
- gasPrice: "0",
58
- data: encodeProxyTransactionData(txns),
59
- relay: rp.address,
60
- nonce: rp.nonce,
61
- };
62
- const proxyContractConfig = this.contractConfig.ProxyContracts;
63
- const request = await buildProxyTransactionRequest(this.signer, args, proxyContractConfig, metadata);
64
- console.log(`Client side proxy request creation took: ${(Date.now() - start) / 1000} seconds`);
65
- const resp = await this.submitTransaction(request);
66
- return new ClientRelayerTransactionResponse(resp.transactionID, resp.state, resp.transactionHash, this);
67
- }
68
- async executeSafeTransactions(txns, metadata) {
69
- if (this.signer == undefined) {
70
- throw new Error("missing signer");
71
- }
72
- const start = Date.now();
73
- const from = await this.signer.getAddress();
74
- const noncePayload = await this.getNonce(from, TransactionType.SAFE);
75
- const args = {
76
- transactions: txns,
77
- from,
78
- nonce: noncePayload.nonce,
79
- chainId: this.chainId,
80
- };
81
- const safeContractConfig = this.contractConfig.SafeContracts;
82
- const request = await buildSafeTransactionRequest(this.signer, args, safeContractConfig, metadata);
83
- console.log(`Client side safe request creation took: ${(Date.now() - start) / 1000} seconds`);
84
- const resp = await this.submitTransaction(request);
85
- return new ClientRelayerTransactionResponse(resp.transactionID, resp.state, resp.transactionHash, this);
86
- }
87
- async executeManualTransactions(txns, overrides) {
88
- if (overrides == undefined) {
89
- overrides = {};
90
- }
91
- if (this.signer == undefined) {
92
- throw new Error("missing signer");
93
- }
94
- return executeManualTransactions(this.signer, this.contractConfig.SafeContracts, txns, overrides);
95
- }
96
- async deploySafe() {
97
- if (this.signer == undefined) {
98
- throw new Error("missing signer");
99
- }
100
- const start = Date.now();
101
- const from = await this.signer?.getAddress();
102
- const args = {
103
- from: from,
104
- chainId: this.chainId,
105
- paymentToken: zeroAddress,
106
- payment: "0",
107
- paymentReceiver: zeroAddress,
108
- };
109
- const safeContractConfig = this.contractConfig.SafeContracts;
110
- const request = await buildSafeCreateTransactionRequest(this.signer, safeContractConfig, args);
111
- console.log(`Client side deploy request creation took: ${(Date.now() - start) / 1000} seconds`);
112
- const resp = await this.submitTransaction(request);
113
- return new ClientRelayerTransactionResponse(resp.transactionID, resp.state, resp.transactionHash, this);
114
- }
115
- /**
116
- * Periodically polls the transaction id until it reaches a desired state
117
- * Returns the relayer transaction if it does each the desired state
118
- * Returns undefined if the transaction hits the failed state
119
- * Times out after maxPolls is reached
120
- * @param transactionId
121
- * @param states
122
- * @param failState
123
- * @param maxPolls
124
- * @param pollFrequency
125
- * @returns
126
- */
127
- async pollUntilState(transactionId, states, failState, maxPolls, pollFrequency) {
128
- console.log(`Waiting for transaction ${transactionId} matching states: ${states}...`);
129
- const maxPollCount = maxPolls != undefined ? maxPolls : 10;
130
- let pollFreq = 2000; // Default to polling every 2 seconds
131
- if (pollFrequency != undefined) {
132
- if (pollFrequency >= 1000) {
133
- pollFreq = pollFrequency;
134
- }
135
- }
136
- let pollCount = 0;
137
- while (pollCount < maxPollCount) {
138
- const txns = await this.getTransaction(transactionId);
139
- if (txns.length > 0) {
140
- const txn = txns[0];
141
- if (states.includes(txn.state)) {
142
- return txn;
143
- }
144
- if (failState != undefined && txn.state == failState) {
145
- // Return undefined if txn reaches the fail state
146
- return undefined;
147
- }
148
- }
149
- pollCount++;
150
- await sleep(pollFreq);
151
- }
152
- console.log(`Transaction not found or not in given states, timing out`);
153
- }
154
- async submitTransaction(req) {
155
- return this.send(`${this.relayerUrl}${SUBMIT_TRANSACTION}`, POST, undefined, req);
156
- }
157
- async send(endpoint, method, headers, data, params) {
158
- // Explicitly inject the polymarket session cookies
159
- // In prod environments, this will be unnecessary as the browser will have the needed cookies
160
- // Needed only for local testing
161
- if (!isBrowser && this.authHandler !== undefined) {
162
- const cookie = await this.authHandler.getPolymarketCookies();
163
- if (headers != undefined) {
164
- headers["Cookie"] = cookie;
165
- }
166
- else {
167
- headers = { "Cookie": cookie };
168
- }
169
- }
170
- const resp = await this.httpClient.send(endpoint, method, headers, data, params);
171
- return resp.data;
172
- }
173
- }
@@ -1,13 +0,0 @@
1
- export interface ProxyContractConfig {
2
- RelayHub: string;
3
- ProxyFactory: string;
4
- }
5
- export interface SafeContractConfig {
6
- SafeFactory: string;
7
- SafeMultisend: string;
8
- }
9
- export interface ContractConfig {
10
- ProxyContracts: ProxyContractConfig;
11
- SafeContracts: SafeContractConfig;
12
- }
13
- export declare const getContractConfig: (chainId: number) => ContractConfig;
@@ -1,31 +0,0 @@
1
- ;
2
- const AMOY = {
3
- ProxyContracts: {
4
- ProxyFactory: "",
5
- RelayHub: ""
6
- },
7
- SafeContracts: {
8
- SafeFactory: "",
9
- SafeMultisend: "",
10
- }
11
- };
12
- const POL = {
13
- ProxyContracts: {
14
- ProxyFactory: "0xaB45c5A4B0c941a2F231C04C3f49182e1A254052",
15
- RelayHub: "0xD216153c06E857cD7f72665E0aF1d7D82172F494"
16
- },
17
- SafeContracts: {
18
- SafeFactory: "0xaacFeEa03eb1561C4e67d661e40682Bd20E3541b",
19
- SafeMultisend: "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761",
20
- }
21
- };
22
- export const getContractConfig = (chainId) => {
23
- switch (chainId) {
24
- case 137:
25
- return POL;
26
- case 80002:
27
- return AMOY;
28
- default:
29
- throw new Error("Invalid network");
30
- }
31
- };
@@ -1,3 +0,0 @@
1
- export declare const PROXY_INIT_CODE_HASH = "0xd21df8dc65880a8606f09fe0ce3df9b8869287ab0b058be05aa9e8af6330a00b";
2
- export declare const SAFE_INIT_CODE_HASH = "0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf";
3
- export declare const SAFE_FACTORY_NAME = "Polymarket Contract Proxy Factory";
@@ -1,3 +0,0 @@
1
- export const PROXY_INIT_CODE_HASH = "0xd21df8dc65880a8606f09fe0ce3df9b8869287ab0b058be05aa9e8af6330a00b";
2
- export const SAFE_INIT_CODE_HASH = "0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf";
3
- export const SAFE_FACTORY_NAME = "Polymarket Contract Proxy Factory";
@@ -1,2 +0,0 @@
1
- export * from "./proxy.ts";
2
- export * from "./safe.ts";
@@ -1,2 +0,0 @@
1
- export * from "./proxy.js";
2
- export * from "./safe.js";
@@ -1,2 +0,0 @@
1
- import { ProxyTransaction } from "../types.ts";
2
- export declare function encodeProxyTransactionData(txns: ProxyTransaction[]): string;
@@ -1,12 +0,0 @@
1
- import { proxyWalletFactory } from "../abis/index.js";
2
- import { encodeFunctionData, prepareEncodeFunctionData } from "viem";
3
- const proxy = prepareEncodeFunctionData({
4
- abi: proxyWalletFactory,
5
- functionName: 'proxy',
6
- });
7
- export function encodeProxyTransactionData(txns) {
8
- return encodeFunctionData({
9
- ...proxy,
10
- args: [txns],
11
- });
12
- }
@@ -1,2 +0,0 @@
1
- import { SafeTransaction } from "../types.ts";
2
- export declare const createSafeMultisendTransaction: (txns: SafeTransaction[], safeMultisendAddress: string) => SafeTransaction;
@@ -1,19 +0,0 @@
1
- import { concatHex, encodeFunctionData, encodePacked, prepareEncodeFunctionData, size } from "viem";
2
- import { multisendAbi } from "../abis/index.js";
3
- import { OperationType } from "../types.js";
4
- const multisend = prepareEncodeFunctionData({
5
- abi: multisendAbi,
6
- functionName: "multiSend",
7
- });
8
- export const createSafeMultisendTransaction = (txns, safeMultisendAddress) => {
9
- const args = [
10
- concatHex(txns.map(tx => encodePacked(["uint8", "address", "uint256", "uint256", "bytes"], [tx.operation, tx.to, BigInt(tx.value), BigInt(size(tx.data)), tx.data]))),
11
- ];
12
- const data = encodeFunctionData({ ...multisend, args: args });
13
- return {
14
- to: safeMultisendAddress,
15
- value: "0",
16
- data: data,
17
- operation: OperationType.DelegateCall,
18
- };
19
- };
@@ -1,5 +0,0 @@
1
- export declare const GET_ADDRESS = "/address";
2
- export declare const GET_NONCE = "/nonce";
3
- export declare const GET_RELAY_PAYLOAD = "/relay-payload";
4
- export declare const GET_TRANSACTION = "/transaction";
5
- export declare const SUBMIT_TRANSACTION = "/submit";
package/dist/endpoints.js DELETED
@@ -1,5 +0,0 @@
1
- export const GET_ADDRESS = "/address";
2
- export const GET_NONCE = "/nonce";
3
- export const GET_RELAY_PAYLOAD = "/relay-payload";
4
- export const GET_TRANSACTION = "/transaction";
5
- export const SUBMIT_TRANSACTION = "/submit";
@@ -1,10 +0,0 @@
1
- import { AxiosInstance, AxiosResponse, Method } from "axios";
2
- export declare const GET = "GET";
3
- export declare const POST = "POST";
4
- export declare const DELETE = "DELETE";
5
- export declare const PUT = "PUT";
6
- export declare class HttpClient {
7
- readonly instance: AxiosInstance;
8
- constructor();
9
- send(endpoint: string, method: Method, headers?: any, data?: any, params?: any): Promise<AxiosResponse>;
10
- }
@@ -1,46 +0,0 @@
1
- import axios from "axios";
2
- export const GET = "GET";
3
- export const POST = "POST";
4
- export const DELETE = "DELETE";
5
- export const PUT = "PUT";
6
- export class HttpClient {
7
- instance;
8
- constructor() {
9
- this.instance = axios.create({ withCredentials: true });
10
- }
11
- async send(endpoint, method, headers, data, params) {
12
- if (headers != undefined) {
13
- headers["Access-Control-Allow-Credentials"] = true;
14
- }
15
- try {
16
- const resp = await this.instance.request({
17
- method,
18
- url: endpoint,
19
- headers,
20
- data,
21
- params
22
- });
23
- return resp;
24
- }
25
- catch (err) {
26
- if (axios.isAxiosError(err)) {
27
- if (err.response) {
28
- const errPayload = {
29
- error: "request error",
30
- status: err.response?.status,
31
- statusText: err.response?.statusText,
32
- data: err.response?.data,
33
- };
34
- console.error("request error", errPayload);
35
- throw new Error(JSON.stringify(errPayload));
36
- }
37
- else {
38
- const errPayload = { error: "connection error" };
39
- console.error("connection error", errPayload);
40
- throw new Error(JSON.stringify(errPayload));
41
- }
42
- }
43
- throw new Error(JSON.stringify({ error: err }));
44
- }
45
- }
46
- }
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./client.ts";
2
- export * from "./encode/index.ts";
3
- export * from "./types.ts";
4
- export * from "./response/index.ts";
package/dist/index.js DELETED
@@ -1,4 +0,0 @@
1
- export * from "./client.js";
2
- export * from "./encode/index.js";
3
- export * from "./types.js";
4
- export * from "./response/index.js";
@@ -1,5 +0,0 @@
1
- import { IAbstractSigner } from "@polymarket/abstract-signer";
2
- import { SafeContractConfig } from "../config/index.ts";
3
- import { SafeTransaction, ManualOverrides } from "../types.ts";
4
- import { ManualTransactionResponse } from "../response/index.ts";
5
- export declare function executeManualTransactions(signer: IAbstractSigner, safeContractConfig: SafeContractConfig, transactions: SafeTransaction[], overrides: ManualOverrides): Promise<ManualTransactionResponse>;
@@ -1,47 +0,0 @@
1
- import { encodePacked, hexToBigInt, zeroAddress } from "viem";
2
- import { encodeFunctionData, prepareEncodeFunctionData } from "viem";
3
- import { safeAbi } from "../abis/index.js";
4
- import { aggregateTransaction, deriveSafe } from "../builder/index.js";
5
- import { ManualTransactionResponse } from "../response/index.js";
6
- const safeExecTransaction = prepareEncodeFunctionData({
7
- abi: safeAbi,
8
- functionName: 'execTransaction',
9
- });
10
- export async function executeManualTransactions(signer, safeContractConfig, transactions, overrides) {
11
- const from = await signer.getAddress();
12
- const aggTxn = aggregateTransaction(transactions, safeContractConfig.SafeMultisend);
13
- const sig = encodePacked(["uint256", "uint256", "uint8"], [BigInt(hexToBigInt(from)), BigInt(0), 1]);
14
- const safeAddress = deriveSafe(from, safeContractConfig.SafeFactory);
15
- // calldata
16
- const data = encodeFunctionData({ ...safeExecTransaction, args: [
17
- aggTxn.to,
18
- aggTxn.value,
19
- aggTxn.data,
20
- aggTxn.operation,
21
- 0,
22
- 0,
23
- 0,
24
- zeroAddress,
25
- zeroAddress,
26
- sig,
27
- ] });
28
- if (overrides.gasLimit == undefined) {
29
- const gasLimit = await signer.estimateGas({
30
- to: safeAddress,
31
- data: data,
32
- from: from,
33
- });
34
- console.log(`Estimated gas Limit: ${gasLimit}`);
35
- overrides.gasLimit = gasLimit;
36
- }
37
- const txHash = await signer.sendTransaction({
38
- data: data,
39
- to: safeAddress,
40
- gasPrice: overrides.gasPrice,
41
- gasLimit: overrides.gasLimit,
42
- });
43
- const waitFunc = (txHash) => {
44
- return signer.waitTillMined(txHash);
45
- };
46
- return new ManualTransactionResponse(txHash, waitFunc);
47
- }
@@ -1,21 +0,0 @@
1
- import { RelayClient } from "../client.ts";
2
- import { IManualTransactionResponse, RelayerTransaction, RelayerTransactionResponse } from "../types.ts";
3
- export declare class ClientRelayerTransactionResponse implements RelayerTransactionResponse {
4
- readonly client: RelayClient;
5
- readonly transactionID: string;
6
- readonly transactionHash: string;
7
- readonly hash: string;
8
- readonly state: string;
9
- constructor(transactionID: string, state: string, transactionHash: string, client: RelayClient);
10
- getTransaction(): Promise<RelayerTransaction[]>;
11
- wait(): Promise<RelayerTransaction | undefined>;
12
- }
13
- type WaitUntilMinedFunction = (transactionHash: string) => Promise<any>;
14
- export declare class ManualTransactionResponse implements IManualTransactionResponse {
15
- readonly hash: string;
16
- readonly transactionHash: string;
17
- private waitTillMined;
18
- constructor(transactionHash: string, waitTillMinedFunc: WaitUntilMinedFunction);
19
- wait(): Promise<any>;
20
- }
21
- export {};
@@ -1,37 +0,0 @@
1
- import { RelayerTransactionState } from "../types.js";
2
- export class ClientRelayerTransactionResponse {
3
- client;
4
- transactionID;
5
- transactionHash;
6
- hash;
7
- state;
8
- constructor(transactionID, state, transactionHash, client) {
9
- this.transactionID = transactionID;
10
- this.state = state;
11
- this.transactionHash = transactionHash;
12
- this.hash = transactionHash;
13
- this.client = client;
14
- }
15
- async getTransaction() {
16
- return this.client.getTransaction(this.transactionID);
17
- }
18
- async wait() {
19
- return this.client.pollUntilState(this.transactionID, [
20
- RelayerTransactionState.STATE_MINED,
21
- RelayerTransactionState.STATE_CONFIRMED,
22
- ], RelayerTransactionState.STATE_FAILED, 30);
23
- }
24
- }
25
- export class ManualTransactionResponse {
26
- hash;
27
- transactionHash;
28
- waitTillMined;
29
- constructor(transactionHash, waitTillMinedFunc) {
30
- this.transactionHash = transactionHash;
31
- this.hash = transactionHash;
32
- this.waitTillMined = waitTillMinedFunc;
33
- }
34
- async wait() {
35
- return this.waitTillMined(this.hash);
36
- }
37
- }
package/dist/types.d.ts DELETED
@@ -1,132 +0,0 @@
1
- export declare enum TransactionType {
2
- PROXY = "PROXY",
3
- SAFE = "SAFE",
4
- SAFE_CREATE = "SAFE-CREATE"
5
- }
6
- export interface SignatureParams {
7
- gasPrice?: string;
8
- relayerFee?: string;
9
- gasLimit?: string;
10
- relayHub?: string;
11
- relay?: string;
12
- operation?: string;
13
- safeTxnGas?: string;
14
- baseGas?: string;
15
- gasToken?: string;
16
- refundReceiver?: string;
17
- paymentToken?: string;
18
- payment?: string;
19
- paymentReceiver?: string;
20
- }
21
- export interface AddressPayload {
22
- address: string;
23
- }
24
- export interface NoncePayload {
25
- nonce: string;
26
- }
27
- export interface RelayPayload {
28
- address: string;
29
- nonce: string;
30
- }
31
- export interface TransactionRequest {
32
- type: string;
33
- from: string;
34
- to: string;
35
- proxyWallet?: string;
36
- data: string;
37
- nonce?: string;
38
- signature: string;
39
- signatureParams: SignatureParams;
40
- metadata?: string;
41
- }
42
- export declare enum CallType {
43
- Invalid = "0",
44
- Call = "1",
45
- DelegateCall = "2"
46
- }
47
- export interface ProxyTransaction {
48
- to: string;
49
- typeCode: CallType;
50
- data: string;
51
- value: string;
52
- }
53
- export declare enum OperationType {
54
- Call = 0,// 0
55
- DelegateCall = 1
56
- }
57
- export interface SafeTransaction {
58
- to: string;
59
- operation: OperationType;
60
- data: string;
61
- value: string;
62
- }
63
- export interface ProxyTransactionArgs {
64
- from: string;
65
- nonce: string;
66
- gasPrice: string;
67
- gasLimit?: string;
68
- data: string;
69
- relay: string;
70
- }
71
- export interface SafeTransactionArgs {
72
- from: string;
73
- nonce: string;
74
- chainId: number;
75
- transactions: SafeTransaction[];
76
- }
77
- export interface SafeCreateTransactionArgs {
78
- from: string;
79
- chainId: number;
80
- paymentToken: string;
81
- payment: string;
82
- paymentReceiver: string;
83
- }
84
- export declare enum RelayerTransactionState {
85
- STATE_NEW = "STATE_NEW",
86
- STATE_EXECUTED = "STATE_EXECUTED",
87
- STATE_MINED = "STATE_MINED",
88
- STATE_INVALID = "STATE_INVALID",
89
- STATE_CONFIRMED = "STATE_CONFIRMED",
90
- STATE_FAILED = "STATE_FAILED"
91
- }
92
- export interface RelayerSubRequest {
93
- address: string;
94
- transactions: string[];
95
- cookies?: string;
96
- }
97
- export interface AuthArgs {
98
- authUrl: string;
99
- authToken: string;
100
- }
101
- export interface RelayerTransaction {
102
- transactionID: string;
103
- transactionHash: string;
104
- from: string;
105
- to: string;
106
- proxyAddress: string;
107
- data: string;
108
- nonce: string;
109
- value: string;
110
- state: string;
111
- type: string;
112
- metadata: string;
113
- createdAt: Date;
114
- updatedAt: Date;
115
- }
116
- export interface IManualTransactionResponse {
117
- hash: string;
118
- transactionHash: string;
119
- wait: () => Promise<any>;
120
- }
121
- export interface RelayerTransactionResponse {
122
- transactionID: string;
123
- state: string;
124
- hash: string;
125
- transactionHash: string;
126
- getTransaction: () => Promise<RelayerTransaction[]>;
127
- wait: () => Promise<RelayerTransaction | undefined>;
128
- }
129
- export interface ManualOverrides {
130
- gasLimit?: bigint;
131
- gasPrice?: bigint;
132
- }
package/dist/types.js DELETED
@@ -1,28 +0,0 @@
1
- export var TransactionType;
2
- (function (TransactionType) {
3
- TransactionType["PROXY"] = "PROXY";
4
- TransactionType["SAFE"] = "SAFE";
5
- TransactionType["SAFE_CREATE"] = "SAFE-CREATE";
6
- })(TransactionType || (TransactionType = {}));
7
- export var CallType;
8
- (function (CallType) {
9
- CallType["Invalid"] = "0";
10
- CallType["Call"] = "1";
11
- CallType["DelegateCall"] = "2";
12
- })(CallType || (CallType = {}));
13
- // Safe Transactions
14
- export var OperationType;
15
- (function (OperationType) {
16
- OperationType[OperationType["Call"] = 0] = "Call";
17
- OperationType[OperationType["DelegateCall"] = 1] = "DelegateCall";
18
- })(OperationType || (OperationType = {}));
19
- export var RelayerTransactionState;
20
- (function (RelayerTransactionState) {
21
- RelayerTransactionState["STATE_NEW"] = "STATE_NEW";
22
- RelayerTransactionState["STATE_EXECUTED"] = "STATE_EXECUTED";
23
- RelayerTransactionState["STATE_MINED"] = "STATE_MINED";
24
- RelayerTransactionState["STATE_INVALID"] = "STATE_INVALID";
25
- RelayerTransactionState["STATE_CONFIRMED"] = "STATE_CONFIRMED";
26
- RelayerTransactionState["STATE_FAILED"] = "STATE_FAILED";
27
- })(RelayerTransactionState || (RelayerTransactionState = {}));
28
- ;
@@ -1,7 +0,0 @@
1
- export interface SplitSig {
2
- r: string;
3
- s: string;
4
- v: string;
5
- }
6
- export declare function splitAndPackSig(sig: string): string;
7
- export declare function sleep(ms: number): Promise<unknown>;