Socket
Socket
Sign inDemoInstall

@openzeppelin/defender-relay-client

Package Overview
Dependencies
Maintainers
7
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openzeppelin/defender-relay-client - npm Package Compare versions

Comparing version 1.54.1 to 1.54.2

74

lib/api/index.d.ts
import { BaseApiClient, ApiVersion } from '@openzeppelin/defender-base-client';
import {
ApiRelayerParams,
IRelayer,
JsonRpcResponse,
ListTransactionsRequest,
RelayerGetResponse,
RelayerTransaction,
RelayerTransactionPayload,
SignedMessagePayload,
SignTypedDataPayload,
SignMessagePayload,
CreateRelayerRequest,
RelayerListResponse,
UpdateRelayerRequest,
RelayerApiKey,
DeleteRelayerApiKeyResponse,
PaginatedTransactionListResponse,
RelayerStatus,
} from '../relayer';
import { ApiRelayerParams, IRelayer, JsonRpcResponse, ListTransactionsRequest, RelayerGetResponse, RelayerTransaction, RelayerTransactionPayload, SignedMessagePayload, SignTypedDataPayload, SignMessagePayload, CreateRelayerRequest, RelayerListResponse, UpdateRelayerRequest, RelayerApiKey, DeleteRelayerApiKeyResponse, PaginatedTransactionListResponse, RelayerStatus } from '../relayer';
export declare const RelaySignerApiUrl: () => string;
export declare class RelayClient extends BaseApiClient {
protected getPoolId(): string;
protected getPoolClientId(): string;
protected getApiUrl(v?: ApiVersion): string;
get(relayerId: string): Promise<RelayerGetResponse>;
list(): Promise<RelayerListResponse>;
create(relayer: CreateRelayerRequest): Promise<RelayerGetResponse>;
update(relayerId: string, relayerUpdateParams: UpdateRelayerRequest): Promise<RelayerGetResponse>;
private updatePolicies;
createKey(relayerId: string, stackResourceId?: string): Promise<RelayerApiKey>;
listKeys(relayerId: string): Promise<RelayerApiKey[]>;
deleteKey(relayerId: string, keyId: string): Promise<DeleteRelayerApiKeyResponse>;
protected getPoolId(): string;
protected getPoolClientId(): string;
protected getApiUrl(v?: ApiVersion): string;
get(relayerId: string): Promise<RelayerGetResponse>;
list(): Promise<RelayerListResponse>;
create(relayer: CreateRelayerRequest): Promise<RelayerGetResponse>;
update(relayerId: string, relayerUpdateParams: UpdateRelayerRequest): Promise<RelayerGetResponse>;
private updatePolicies;
createKey(relayerId: string, stackResourceId?: string): Promise<RelayerApiKey>;
listKeys(relayerId: string): Promise<RelayerApiKey[]>;
deleteKey(relayerId: string, keyId: string): Promise<DeleteRelayerApiKeyResponse>;
}
export declare class ApiRelayer extends BaseApiClient implements IRelayer {
private jsonRpcRequestNextId;
constructor(params: ApiRelayerParams);
protected getPoolId(): string;
protected getPoolClientId(): string;
protected getApiUrl(_: ApiVersion): string;
getRelayer(): Promise<RelayerGetResponse>;
getRelayerStatus(): Promise<RelayerStatus>;
sendTransaction(payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionById(id: string, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionByNonce(nonce: number, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
signTypedData(payload: SignTypedDataPayload): Promise<SignedMessagePayload>;
sign(payload: SignMessagePayload): Promise<SignedMessagePayload>;
query(id: string): Promise<RelayerTransaction>;
list(criteria?: ListTransactionsRequest): Promise<RelayerTransaction[] | PaginatedTransactionListResponse>;
call(method: string, params: string[]): Promise<JsonRpcResponse>;
private jsonRpcRequestNextId;
constructor(params: ApiRelayerParams);
protected getPoolId(): string;
protected getPoolClientId(): string;
protected getApiUrl(_: ApiVersion): string;
getRelayer(): Promise<RelayerGetResponse>;
getRelayerStatus(): Promise<RelayerStatus>;
sendTransaction(payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionById(id: string, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionByNonce(nonce: number, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
signTypedData(payload: SignTypedDataPayload): Promise<SignedMessagePayload>;
sign(payload: SignMessagePayload): Promise<SignedMessagePayload>;
query(id: string): Promise<RelayerTransaction>;
list(criteria?: ListTransactionsRequest): Promise<RelayerTransaction[] | PaginatedTransactionListResponse>;
call(method: string, params: string[]): Promise<JsonRpcResponse>;
}
//# sourceMappingURL=index.d.ts.map
//# sourceMappingURL=index.d.ts.map

@@ -1,148 +0,149 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiRelayer = exports.RelayClient = exports.RelaySignerApiUrl = void 0;
const defender_base_client_1 = require('@openzeppelin/defender-base-client');
const defender_base_client_1 = require("@openzeppelin/defender-base-client");
const RelaySignerApiUrl = () => process.env.DEFENDER_RELAY_SIGNER_API_URL || 'https://api.defender.openzeppelin.com/';
exports.RelaySignerApiUrl = RelaySignerApiUrl;
class RelayClient extends defender_base_client_1.BaseApiClient {
getPoolId() {
return process.env.DEFENDER_RELAY_POOL_ID || 'us-west-2_94f3puJWv';
}
getPoolClientId() {
return process.env.DEFENDER_RELAY_POOL_CLIENT_ID || '40e58hbc7pktmnp9i26hh5nsav';
}
getApiUrl(v = 'v1') {
if (v === 'v2') {
return process.env.DEFENDER_API_V2_URL || 'https://defender-api.openzeppelin.com/v2/';
getPoolId() {
return process.env.DEFENDER_RELAY_POOL_ID || 'us-west-2_94f3puJWv';
}
return process.env.DEFENDER_RELAY_API_URL || 'https://defender-api.openzeppelin.com/relayer/';
}
async get(relayerId) {
return this.apiCall(async (api) => {
return await api.get(`/relayers/${relayerId}`);
});
}
async list() {
return this.apiCall(async (api) => {
return await api.get('/relayers/summary');
});
}
async create(relayer) {
return this.apiCall(async (api) => {
return await api.post('/relayers', relayer);
});
}
async update(relayerId, relayerUpdateParams) {
const currentRelayer = await this.get(relayerId);
if (relayerUpdateParams.policies) {
const updatedRelayer = await this.updatePolicies(relayerId, {
...currentRelayer.policies,
...relayerUpdateParams.policies,
});
// if policies are the only update, return
if (Object.keys(relayerUpdateParams).length === 1) return updatedRelayer;
getPoolClientId() {
return process.env.DEFENDER_RELAY_POOL_CLIENT_ID || '40e58hbc7pktmnp9i26hh5nsav';
}
return this.apiCall(async (api) => {
return await api.put(`/relayers`, {
...currentRelayer,
...relayerUpdateParams,
});
});
}
async updatePolicies(relayerId, relayerPolicies) {
return this.apiCall(async (api) => {
return await api.put(`/relayers/${relayerId}`, relayerPolicies);
});
}
async createKey(relayerId, stackResourceId) {
return this.apiCall(async (api) => {
return await api.post(`/relayers/${relayerId}/keys`, { stackResourceId });
});
}
async listKeys(relayerId) {
return this.apiCall(async (api) => {
return await api.get(`/relayers/${relayerId}/keys`);
});
}
async deleteKey(relayerId, keyId) {
return this.apiCall(async (api) => {
return await api.delete(`/relayers/${relayerId}/keys/${keyId}`);
});
}
getApiUrl(v = 'v1') {
if (v === 'v2') {
return process.env.DEFENDER_API_V2_URL || 'https://defender-api.openzeppelin.com/v2/';
}
return process.env.DEFENDER_RELAY_API_URL || 'https://defender-api.openzeppelin.com/relayer/';
}
async get(relayerId) {
return this.apiCall(async (api) => {
return await api.get(`/relayers/${relayerId}`);
});
}
async list() {
return this.apiCall(async (api) => {
return await api.get('/relayers/summary');
});
}
async create(relayer) {
return this.apiCall(async (api) => {
return await api.post('/relayers', relayer);
});
}
async update(relayerId, relayerUpdateParams) {
const currentRelayer = await this.get(relayerId);
if (relayerUpdateParams.policies) {
const updatedRelayer = await this.updatePolicies(relayerId, {
...currentRelayer.policies,
...relayerUpdateParams.policies,
});
// if policies are the only update, return
if (Object.keys(relayerUpdateParams).length === 1)
return updatedRelayer;
}
return this.apiCall(async (api) => {
return await api.put(`/relayers`, {
...currentRelayer,
...relayerUpdateParams,
});
});
}
async updatePolicies(relayerId, relayerPolicies) {
return this.apiCall(async (api) => {
return await api.put(`/relayers/${relayerId}`, relayerPolicies);
});
}
async createKey(relayerId, stackResourceId) {
return this.apiCall(async (api) => {
return await api.post(`/relayers/${relayerId}/keys`, { stackResourceId });
});
}
async listKeys(relayerId) {
return this.apiCall(async (api) => {
return await api.get(`/relayers/${relayerId}/keys`);
});
}
async deleteKey(relayerId, keyId) {
return this.apiCall(async (api) => {
return await api.delete(`/relayers/${relayerId}/keys/${keyId}`);
});
}
}
exports.RelayClient = RelayClient;
class ApiRelayer extends defender_base_client_1.BaseApiClient {
constructor(params) {
super(params);
this.jsonRpcRequestNextId = 1;
}
getPoolId() {
return process.env.DEFENDER_RELAY_SIGNER_POOL_ID || 'us-west-2_iLmIggsiy';
}
getPoolClientId() {
return process.env.DEFENDER_RELAY_SIGNER_POOL_CLIENT_ID || '1bpd19lcr33qvg5cr3oi79rdap';
}
getApiUrl(_) {
return (0, exports.RelaySignerApiUrl)();
}
async getRelayer() {
return this.apiCall(async (api) => {
return await api.get('/relayer');
});
}
async getRelayerStatus() {
return this.apiCall(async (api) => {
return await api.get('/relayer/status');
});
}
async sendTransaction(payload) {
return this.apiCall(async (api) => {
return await api.post('/txs', payload);
});
}
async replaceTransactionById(id, payload) {
return this.apiCall(async (api) => {
return await api.put(`/txs/${id}`, payload);
});
}
async replaceTransactionByNonce(nonce, payload) {
return this.apiCall(async (api) => {
return await api.put(`/txs/${nonce}`, payload);
});
}
async signTypedData(payload) {
return this.apiCall(async (api) => {
return await api.post('/sign-typed-data', payload);
});
}
async sign(payload) {
return this.apiCall(async (api) => {
return await api.post('/sign', payload);
});
}
async query(id) {
return this.apiCall(async (api) => {
return await api.get(`txs/${id}`);
});
}
async list(criteria) {
return this.apiCall(async (api) => {
const result = await api.get(`txs`, { params: criteria ?? {} });
if (criteria?.usePagination) {
return result;
}
return result;
});
}
async call(method, params) {
return this.apiCall(async (api) => {
return await api.post(`/relayer/jsonrpc`, {
method,
params,
jsonrpc: '2.0',
id: this.jsonRpcRequestNextId++,
});
});
}
constructor(params) {
super(params);
this.jsonRpcRequestNextId = 1;
}
getPoolId() {
return process.env.DEFENDER_RELAY_SIGNER_POOL_ID || 'us-west-2_iLmIggsiy';
}
getPoolClientId() {
return process.env.DEFENDER_RELAY_SIGNER_POOL_CLIENT_ID || '1bpd19lcr33qvg5cr3oi79rdap';
}
getApiUrl(_) {
return (0, exports.RelaySignerApiUrl)();
}
async getRelayer() {
return this.apiCall(async (api) => {
return (await api.get('/relayer'));
});
}
async getRelayerStatus() {
return this.apiCall(async (api) => {
return (await api.get('/relayer/status'));
});
}
async sendTransaction(payload) {
return this.apiCall(async (api) => {
return (await api.post('/txs', payload));
});
}
async replaceTransactionById(id, payload) {
return this.apiCall(async (api) => {
return (await api.put(`/txs/${id}`, payload));
});
}
async replaceTransactionByNonce(nonce, payload) {
return this.apiCall(async (api) => {
return (await api.put(`/txs/${nonce}`, payload));
});
}
async signTypedData(payload) {
return this.apiCall(async (api) => {
return (await api.post('/sign-typed-data', payload));
});
}
async sign(payload) {
return this.apiCall(async (api) => {
return (await api.post('/sign', payload));
});
}
async query(id) {
return this.apiCall(async (api) => {
return (await api.get(`txs/${id}`));
});
}
async list(criteria) {
return this.apiCall(async (api) => {
const result = (await api.get(`txs`, { params: criteria ?? {} }));
if (criteria?.usePagination) {
return result;
}
return result;
});
}
async call(method, params) {
return this.apiCall(async (api) => {
return (await api.post(`/relayer/jsonrpc`, {
method,
params,
jsonrpc: '2.0',
id: this.jsonRpcRequestNextId++,
}));
});
}
}
exports.ApiRelayer = ApiRelayer;

@@ -1,50 +0,38 @@

import {
AutotaskRelayerParams,
IRelayer,
JsonRpcRequest,
JsonRpcResponse,
ListTransactionsRequest,
RelayerGetResponse,
RelayerStatus,
RelayerTransaction,
RelayerTransactionPayload,
SignedMessagePayload,
SignMessagePayload,
} from '../relayer';
import { AutotaskRelayerParams, IRelayer, JsonRpcRequest, JsonRpcResponse, ListTransactionsRequest, RelayerGetResponse, RelayerStatus, RelayerTransaction, RelayerTransactionPayload, SignedMessagePayload, SignMessagePayload } from '../relayer';
import { BaseAutotaskClient } from '@openzeppelin/defender-base-client/lib/autotask';
import { SignTypedDataPayload } from '..';
export type SendTxRequest = {
action: 'send-tx';
payload: RelayerTransactionPayload;
action: 'send-tx';
payload: RelayerTransactionPayload;
};
export type GetTxRequest = {
action: 'get-tx';
payload: string;
action: 'get-tx';
payload: string;
};
export type SignRequest = {
action: 'sign';
payload: SignMessagePayload;
action: 'sign';
payload: SignMessagePayload;
};
export type GetSelfRequest = {
action: 'get-self';
action: 'get-self';
};
export type JsonRpcCallRequest = {
action: 'json-rpc-query';
payload: JsonRpcRequest;
action: 'json-rpc-query';
payload: JsonRpcRequest;
};
export type Request = SendTxRequest | GetTxRequest | SignRequest | GetSelfRequest | JsonRpcCallRequest;
export declare class AutotaskRelayer extends BaseAutotaskClient implements IRelayer {
private jsonRpcRequestNextId;
constructor(params: AutotaskRelayerParams);
sendTransaction(payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionById(transactionId: string, txPayload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionByNonce(nonce: number, txPayload: RelayerTransactionPayload): Promise<RelayerTransaction>;
getRelayer(): Promise<RelayerGetResponse>;
getRelayerStatus(): Promise<RelayerStatus>;
query(id: string): Promise<RelayerTransaction>;
list(criteria?: ListTransactionsRequest): Promise<RelayerTransaction[]>;
sign(payload: SignMessagePayload): Promise<SignedMessagePayload>;
signTypedData(payload: SignTypedDataPayload): Promise<SignedMessagePayload>;
call(method: string, params: string[]): Promise<JsonRpcResponse>;
private jsonRpcRequestNextId;
constructor(params: AutotaskRelayerParams);
sendTransaction(payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionById(transactionId: string, txPayload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionByNonce(nonce: number, txPayload: RelayerTransactionPayload): Promise<RelayerTransaction>;
getRelayer(): Promise<RelayerGetResponse>;
getRelayerStatus(): Promise<RelayerStatus>;
query(id: string): Promise<RelayerTransaction>;
list(criteria?: ListTransactionsRequest): Promise<RelayerTransaction[]>;
sign(payload: SignMessagePayload): Promise<SignedMessagePayload>;
signTypedData(payload: SignTypedDataPayload): Promise<SignedMessagePayload>;
call(method: string, params: string[]): Promise<JsonRpcResponse>;
}
//# sourceMappingURL=index.d.ts.map
//# sourceMappingURL=index.d.ts.map

@@ -1,62 +0,62 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AutotaskRelayer = void 0;
const autotask_1 = require('@openzeppelin/defender-base-client/lib/autotask');
const autotask_1 = require("@openzeppelin/defender-base-client/lib/autotask");
class AutotaskRelayer extends autotask_1.BaseAutotaskClient {
constructor(params) {
super(params.credentials, params.relayerARN);
this.jsonRpcRequestNextId = 0;
}
async sendTransaction(payload) {
return this.execute({ action: 'send-tx', payload });
}
async replaceTransactionById(transactionId, txPayload) {
const payload = { ...txPayload, transactionId };
return this.execute({ action: 'replace-tx', payload });
}
async replaceTransactionByNonce(nonce, txPayload) {
const payload = { ...txPayload, nonce };
return this.execute({ action: 'replace-tx', payload });
}
async getRelayer() {
return this.execute({
action: 'get-self',
});
}
async getRelayerStatus() {
return this.execute({
action: 'get-self-status',
});
}
async query(id) {
return this.execute({
action: 'get-tx',
payload: id,
});
}
async list(criteria) {
return this.execute({
action: 'list-txs',
payload: criteria ?? {},
});
}
async sign(payload) {
return this.execute({
action: 'sign',
payload: payload,
});
}
async signTypedData(payload) {
return this.execute({
action: 'signTypedData',
payload: payload,
});
}
async call(method, params) {
return this.execute({
action: 'json-rpc-query',
payload: { method, params, jsonrpc: '2.0', id: this.jsonRpcRequestNextId++ },
});
}
constructor(params) {
super(params.credentials, params.relayerARN);
this.jsonRpcRequestNextId = 0;
}
async sendTransaction(payload) {
return this.execute({ action: 'send-tx', payload });
}
async replaceTransactionById(transactionId, txPayload) {
const payload = { ...txPayload, transactionId };
return this.execute({ action: 'replace-tx', payload });
}
async replaceTransactionByNonce(nonce, txPayload) {
const payload = { ...txPayload, nonce };
return this.execute({ action: 'replace-tx', payload });
}
async getRelayer() {
return this.execute({
action: 'get-self',
});
}
async getRelayerStatus() {
return this.execute({
action: 'get-self-status',
});
}
async query(id) {
return this.execute({
action: 'get-tx',
payload: id,
});
}
async list(criteria) {
return this.execute({
action: 'list-txs',
payload: criteria ?? {},
});
}
async sign(payload) {
return this.execute({
action: 'sign',
payload: payload,
});
}
async signTypedData(payload) {
return this.execute({
action: 'signTypedData',
payload: payload,
});
}
async call(method, params) {
return this.execute({
action: 'json-rpc-query',
payload: { method, params, jsonrpc: '2.0', id: this.jsonRpcRequestNextId++ },
});
}
}
exports.AutotaskRelayer = AutotaskRelayer;
export * from './signer';
export * from './provider';
//# sourceMappingURL=index.d.ts.map
//# sourceMappingURL=index.d.ts.map

@@ -1,30 +0,18 @@

'use strict';
var __createBinding =
(this && this.__createBinding) ||
(Object.create
? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
},
};
}
Object.defineProperty(o, k2, desc);
}
: function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar =
(this && this.__exportStar) ||
function (m, exports) {
for (var p in m)
if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, '__esModule', { value: true });
__exportStar(require('./signer'), exports);
__exportStar(require('./provider'), exports);
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./signer"), exports);
__exportStar(require("./provider"), exports);
import { JsonRpcSigner, Network, StaticJsonRpcProvider } from '@ethersproject/providers';
import { RelayerParams } from '../relayer';
export declare class DefenderRelayProvider extends StaticJsonRpcProvider {
readonly credentials: RelayerParams;
private relayer;
constructor(credentials: RelayerParams);
detectNetwork(): Promise<Network>;
send(method: string, params: Array<any>): Promise<any>;
getSigner(): JsonRpcSigner;
readonly credentials: RelayerParams;
private relayer;
constructor(credentials: RelayerParams);
detectNetwork(): Promise<Network>;
send(method: string, params: Array<any>): Promise<any>;
getSigner(): JsonRpcSigner;
}
//# sourceMappingURL=provider.d.ts.map
//# sourceMappingURL=provider.d.ts.map

@@ -1,71 +0,74 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefenderRelayProvider = void 0;
const providers_1 = require('@ethersproject/providers');
const relayer_1 = require('../relayer');
const signer_1 = require('./signer');
const properties_1 = require('@ethersproject/properties');
const bignumber_1 = require('@ethersproject/bignumber');
const api_1 = require('../api');
const providers_1 = require("@ethersproject/providers");
const relayer_1 = require("../relayer");
const signer_1 = require("./signer");
const properties_1 = require("@ethersproject/properties");
const bignumber_1 = require("@ethersproject/bignumber");
const api_1 = require("../api");
class DefenderRelayProvider extends providers_1.StaticJsonRpcProvider {
constructor(credentials) {
super((0, api_1.RelaySignerApiUrl)());
this.credentials = credentials;
this.relayer = new relayer_1.Relayer(credentials);
}
async detectNetwork() {
if (this.network != null) {
return this.network;
constructor(credentials) {
super((0, api_1.RelaySignerApiUrl)());
this.credentials = credentials;
this.relayer = new relayer_1.Relayer(credentials);
}
// Logic from JsonRpcProvider.detectNetwork
let chainId = null;
try {
chainId = await this.send('eth_chainId', []);
} catch (error) {
try {
chainId = await this.send('net_version', []);
} catch (error) {
// Key difference from JsonRpcProvider.detectNetwork logic
// This surfaces error to caller (like QuotaExceeded) instead of squashing it
throw error;
}
async detectNetwork() {
if (this.network != null) {
return this.network;
}
// Logic from JsonRpcProvider.detectNetwork
let chainId = null;
try {
chainId = await this.send('eth_chainId', []);
}
catch (error) {
try {
chainId = await this.send('net_version', []);
}
catch (error) {
// Key difference from JsonRpcProvider.detectNetwork logic
// This surfaces error to caller (like QuotaExceeded) instead of squashing it
throw error;
}
}
if (chainId === null) {
throw new Error('could not detect chainId');
}
// Logic from JsonRpcProvider.detectNetwork
const getNetwork = (0, properties_1.getStatic)(this.constructor, 'getNetwork');
const network = getNetwork(bignumber_1.BigNumber.from(chainId).toNumber());
if (!network) {
throw new Error('could not detect network');
}
// Logic from StaticJsonRpcProvider.detectNetwork
if (this._network == null) {
(0, properties_1.defineReadOnly)(this, '_network', network);
this.emit('network', network, null);
}
return network;
}
if (chainId === null) {
throw new Error('could not detect chainId');
async send(method, params) {
const request = { method, params };
this.emit('debug', { action: 'request', request, provider: this });
try {
const result = await this.relayer.call(method, params);
this.emit('debug', { action: 'response', request, response: result, provider: this });
if (result.error) {
const error = new Error(result.error.message);
error.code = result.error.code;
error.data = result.error.data;
throw error;
}
return result.result;
}
catch (error) {
this.emit('debug', { action: 'response', error, request: request, provider: this });
throw error;
}
}
// Logic from JsonRpcProvider.detectNetwork
const getNetwork = (0, properties_1.getStatic)(this.constructor, 'getNetwork');
const network = getNetwork(bignumber_1.BigNumber.from(chainId).toNumber());
if (!network) {
throw new Error('could not detect network');
getSigner() {
return new signer_1.DefenderRelaySigner(this.relayer, this, {});
}
// Logic from StaticJsonRpcProvider.detectNetwork
if (this._network == null) {
(0, properties_1.defineReadOnly)(this, '_network', network);
this.emit('network', network, null);
}
return network;
}
async send(method, params) {
const request = { method, params };
this.emit('debug', { action: 'request', request, provider: this });
try {
const result = await this.relayer.call(method, params);
this.emit('debug', { action: 'response', request, response: result, provider: this });
if (result.error) {
const error = new Error(result.error.message);
error.code = result.error.code;
error.data = result.error.data;
throw error;
}
return result.result;
} catch (error) {
this.emit('debug', { action: 'response', error, request: request, provider: this });
throw error;
}
}
getSigner() {
return new signer_1.DefenderRelaySigner(this.relayer, this, {});
}
}
exports.DefenderRelayProvider = DefenderRelayProvider;

@@ -7,44 +7,37 @@ import { Provider, TransactionRequest, TransactionResponse } from '@ethersproject/abstract-provider';

type GasOptions = Pick<TransactionRequest, 'gasPrice' | 'maxFeePerGas' | 'maxPriorityFeePerGas'>;
export type DefenderTransactionRequest = TransactionRequest &
Partial<{
export type DefenderTransactionRequest = TransactionRequest & Partial<{
speed: Speed;
validUntil: Date | string;
isPrivate?: boolean;
}>;
export type DefenderRelaySignerOptions = Partial<
GasOptions & {
}>;
export type DefenderRelaySignerOptions = Partial<GasOptions & {
speed: Speed;
validForSeconds: number;
}
>;
}>;
export declare class DefenderRelaySigner extends Signer implements TypedDataSigner {
readonly relayerCredentials: RelayerParams | Relayer;
readonly provider: Provider;
readonly options: DefenderRelaySignerOptions;
private readonly relayer;
private address?;
constructor(relayerCredentials: RelayerParams | Relayer, provider: Provider, options?: DefenderRelaySignerOptions);
getAddress(): Promise<string>;
signMessage(message: string | Bytes): Promise<string>;
signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
connect(provider: Provider): Signer;
sendTransaction(transaction: Deferrable<DefenderTransactionRequest>): Promise<TransactionResponse>;
populateTransaction(transaction: Deferrable<DefenderTransactionRequest>): Promise<DefenderTransactionRequest>;
checkTransaction(transaction: Deferrable<DefenderTransactionRequest>): Deferrable<DefenderTransactionRequest>;
/**
* Signs the typed data value with types data structure for domain using the EIP-712 specification.
* https://eips.ethereum.org/EIPS/eip-712
*
* @param domain EIP712Domain containing name, version, chainId, verifyingContract and salt. All optional
* @param types set of all types encompassed by struct
* @param value typed data to sign matching provided types
* @returns typed data signature
*/
_signTypedData(
domain: TypedDataDomain,
types: Record<string, Array<TypedDataField>>,
value: Record<string, any>,
): Promise<string>;
readonly relayerCredentials: RelayerParams | Relayer;
readonly provider: Provider;
readonly options: DefenderRelaySignerOptions;
private readonly relayer;
private address?;
constructor(relayerCredentials: RelayerParams | Relayer, provider: Provider, options?: DefenderRelaySignerOptions);
getAddress(): Promise<string>;
signMessage(message: string | Bytes): Promise<string>;
signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
connect(provider: Provider): Signer;
sendTransaction(transaction: Deferrable<DefenderTransactionRequest>): Promise<TransactionResponse>;
populateTransaction(transaction: Deferrable<DefenderTransactionRequest>): Promise<DefenderTransactionRequest>;
checkTransaction(transaction: Deferrable<DefenderTransactionRequest>): Deferrable<DefenderTransactionRequest>;
/**
* Signs the typed data value with types data structure for domain using the EIP-712 specification.
* https://eips.ethereum.org/EIPS/eip-712
*
* @param domain EIP712Domain containing name, version, chainId, verifyingContract and salt. All optional
* @param types set of all types encompassed by struct
* @param value typed data to sign matching provided types
* @returns typed data signature
*/
_signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
}
export {};
//# sourceMappingURL=signer.d.ts.map
//# sourceMappingURL=signer.d.ts.map

@@ -1,218 +0,213 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefenderRelaySigner = void 0;
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unused-vars */
const strings_1 = require('@ethersproject/strings');
const abstract_signer_1 = require('@ethersproject/abstract-signer');
const bytes_1 = require('@ethersproject/bytes');
const bignumber_1 = require('@ethersproject/bignumber');
const logger_1 = require('@ethersproject/logger');
const hash_1 = require('@ethersproject/hash');
const properties_1 = require('@ethersproject/properties');
const relayer_1 = require('../relayer');
const lodash_1 = require('lodash');
const strings_1 = require("@ethersproject/strings");
const abstract_signer_1 = require("@ethersproject/abstract-signer");
const bytes_1 = require("@ethersproject/bytes");
const bignumber_1 = require("@ethersproject/bignumber");
const logger_1 = require("@ethersproject/logger");
const hash_1 = require("@ethersproject/hash");
const properties_1 = require("@ethersproject/properties");
const relayer_1 = require("../relayer");
const lodash_1 = require("lodash");
const logger = new logger_1.Logger(`@openzeppelin/defender-relay-client`);
const allowedTransactionKeys = [
'chainId',
'data',
'from',
'gasLimit',
'gasPrice',
'maxFeePerGas',
'maxPriorityFeePerGas',
'nonce',
'to',
'value',
'speed',
'isPrivate',
'chainId',
'data',
'from',
'gasLimit',
'gasPrice',
'maxFeePerGas',
'maxPriorityFeePerGas',
'nonce',
'to',
'value',
'speed',
'isPrivate',
];
class DefenderRelaySigner extends abstract_signer_1.Signer {
constructor(relayerCredentials, provider, options = {}) {
super();
this.relayerCredentials = relayerCredentials;
this.provider = provider;
this.options = options;
this.relayer = (0, relayer_1.isRelayer)(relayerCredentials)
? relayerCredentials
: new relayer_1.Relayer(relayerCredentials);
if (options) {
const getUnnecesaryExtraFields = (invalidFields) => invalidFields.map((field) => options[field]).filter(Boolean);
if (options.speed) {
const unnecesaryExtraFields = getUnnecesaryExtraFields(['maxFeePerGas', 'maxPriorityFeePerGas', 'gasPrice']);
if (unnecesaryExtraFields.length > 0)
throw new Error(`Inconsistent options: speed + (${unnecesaryExtraFields}) not allowed`);
} else if (options.gasPrice) {
const unnecesaryExtraFields = getUnnecesaryExtraFields([
'maxFeePerGas',
'maxPriorityFeePerGas',
// speed already checked
]);
if (unnecesaryExtraFields.length > 0)
throw new Error(`Inconsistent options: gasPrice + (${unnecesaryExtraFields}) not allowed`);
} else if (options.maxFeePerGas && options.maxPriorityFeePerGas) {
if (options.maxFeePerGas < options.maxPriorityFeePerGas)
throw new Error('Inconsistent options: maxFeePerGas should be greater or equal to maxPriorityFeePerGas');
} else if (options.maxFeePerGas)
throw new Error('Inconsistent options: maxFeePerGas without maxPriorityFeePerGas specified');
else if (options.maxPriorityFeePerGas)
throw new Error('Inconsistent options: maxPriorityFeePerGas without maxFeePerGas specified');
constructor(relayerCredentials, provider, options = {}) {
super();
this.relayerCredentials = relayerCredentials;
this.provider = provider;
this.options = options;
this.relayer = (0, relayer_1.isRelayer)(relayerCredentials) ? relayerCredentials : new relayer_1.Relayer(relayerCredentials);
if (options) {
const getUnnecesaryExtraFields = (invalidFields) => invalidFields.map((field) => options[field]).filter(Boolean);
if (options.speed) {
const unnecesaryExtraFields = getUnnecesaryExtraFields(['maxFeePerGas', 'maxPriorityFeePerGas', 'gasPrice']);
if (unnecesaryExtraFields.length > 0)
throw new Error(`Inconsistent options: speed + (${unnecesaryExtraFields}) not allowed`);
}
else if (options.gasPrice) {
const unnecesaryExtraFields = getUnnecesaryExtraFields([
'maxFeePerGas',
'maxPriorityFeePerGas',
// speed already checked
]);
if (unnecesaryExtraFields.length > 0)
throw new Error(`Inconsistent options: gasPrice + (${unnecesaryExtraFields}) not allowed`);
}
else if (options.maxFeePerGas && options.maxPriorityFeePerGas) {
if (options.maxFeePerGas < options.maxPriorityFeePerGas)
throw new Error('Inconsistent options: maxFeePerGas should be greater or equal to maxPriorityFeePerGas');
}
else if (options.maxFeePerGas)
throw new Error('Inconsistent options: maxFeePerGas without maxPriorityFeePerGas specified');
else if (options.maxPriorityFeePerGas)
throw new Error('Inconsistent options: maxPriorityFeePerGas without maxFeePerGas specified');
}
}
}
async getAddress() {
// cache value because it does not change
if (!this.address) {
const r = await this.relayer.getRelayer();
this.address = r.address;
async getAddress() {
// cache value because it does not change
if (!this.address) {
const r = await this.relayer.getRelayer();
this.address = r.address;
}
return this.address;
}
return this.address;
}
// Returns the signed prefixed-message. This MUST treat:
// - Bytes as a binary message
// - string as a UTF8-message
// i.e. "0x1234" is a SIX (6) byte string, NOT 2 bytes of data
async signMessage(message) {
if (typeof message === 'string') {
message = (0, strings_1.toUtf8Bytes)(message);
// Returns the signed prefixed-message. This MUST treat:
// - Bytes as a binary message
// - string as a UTF8-message
// i.e. "0x1234" is a SIX (6) byte string, NOT 2 bytes of data
async signMessage(message) {
if (typeof message === 'string') {
message = (0, strings_1.toUtf8Bytes)(message);
}
const sig = await this.relayer.sign({
message: (0, bytes_1.hexlify)(message),
});
return (0, bytes_1.joinSignature)(sig);
}
const sig = await this.relayer.sign({
message: (0, bytes_1.hexlify)(message),
});
return (0, bytes_1.joinSignature)(sig);
}
// Signs a transaction and returns the fully serialized, signed transaction.
// The EXACT transaction MUST be signed, and NO additional properties to be added.
// - This MAY throw if signing transactions is not supports, but if
// it does, sentTransaction MUST be overridden.
async signTransaction(transaction) {
throw new Error('DefenderRelaySigner#signTransaction: method not yet supported');
}
connect(provider) {
return new DefenderRelaySigner(this.relayerCredentials, provider, this.options);
}
async sendTransaction(transaction) {
this._checkProvider('sendTransaction');
const tx = await this.populateTransaction(transaction);
if (!tx.gasLimit) throw new Error('DefenderRelaySigner#sendTransacton: relayer gas estimation not yet supported');
const nonce = tx.nonce === undefined ? undefined : bignumber_1.BigNumber.from(tx.nonce).toNumber();
let payloadGasParams;
if ((0, relayer_1.isLegacyTx)(tx) && tx.gasPrice !== undefined) {
payloadGasParams = {
gasPrice: (0, bytes_1.hexlify)(tx.gasPrice),
};
} else if (
(0, relayer_1.isEIP1559Tx)(tx) &&
tx.maxFeePerGas !== undefined &&
tx.maxPriorityFeePerGas !== undefined
) {
payloadGasParams = {
maxFeePerGas: (0, bytes_1.hexlify)(tx.maxFeePerGas),
maxPriorityFeePerGas: (0, bytes_1.hexlify)(tx.maxPriorityFeePerGas),
};
// Signs a transaction and returns the fully serialized, signed transaction.
// The EXACT transaction MUST be signed, and NO additional properties to be added.
// - This MAY throw if signing transactions is not supports, but if
// it does, sentTransaction MUST be overridden.
async signTransaction(transaction) {
throw new Error('DefenderRelaySigner#signTransaction: method not yet supported');
}
const payload = {
to: tx.to,
gasLimit: (0, bytes_1.hexlify)(tx.gasLimit),
data: tx.data ? (0, bytes_1.hexlify)(tx.data) : undefined,
speed: tx.speed,
value: tx.value ? (0, bytes_1.hexlify)(tx.value) : undefined,
validUntil: tx.validUntil ? new Date(tx.validUntil).toISOString() : undefined,
isPrivate: tx.isPrivate,
...payloadGasParams,
};
const relayedTransaction = nonce
? await this.relayer.replaceTransactionByNonce(nonce, payload)
: await this.relayer.sendTransaction(payload);
let gasParams;
if ((0, relayer_1.isEIP1559Tx)(relayedTransaction)) {
gasParams = {
maxFeePerGas: bignumber_1.BigNumber.from(relayedTransaction.maxFeePerGas),
maxPriorityFeePerGas: bignumber_1.BigNumber.from(relayedTransaction.maxPriorityFeePerGas),
};
} else {
gasParams = {
gasPrice: bignumber_1.BigNumber.from(relayedTransaction.gasPrice),
};
connect(provider) {
return new DefenderRelaySigner(this.relayerCredentials, provider, this.options);
}
return this.provider._wrapTransaction(
{
...(0, lodash_1.omit)(relayedTransaction, 'gasPrice', 'maxPriorityFeePerGas', 'maxFeePerGas'),
...gasParams,
gasLimit: bignumber_1.BigNumber.from(relayedTransaction.gasLimit),
value: bignumber_1.BigNumber.from(relayedTransaction.value ?? 0),
data: relayedTransaction.data ?? '',
},
relayedTransaction.hash,
);
}
// Adapted from ethers-io/ethers.js/packages/abstract-signer/src.ts/index.ts
// Defender relay does not require all fields to be populated
async populateTransaction(transaction) {
const tx = await (0, properties_1.resolveProperties)(this.checkTransaction(transaction));
if (tx.to != null) {
tx.to = Promise.resolve(tx.to).then((to) => this.resolveName(to));
async sendTransaction(transaction) {
this._checkProvider('sendTransaction');
const tx = await this.populateTransaction(transaction);
if (!tx.gasLimit)
throw new Error('DefenderRelaySigner#sendTransacton: relayer gas estimation not yet supported');
const nonce = tx.nonce === undefined ? undefined : bignumber_1.BigNumber.from(tx.nonce).toNumber();
let payloadGasParams;
if ((0, relayer_1.isLegacyTx)(tx) && tx.gasPrice !== undefined) {
payloadGasParams = {
gasPrice: (0, bytes_1.hexlify)(tx.gasPrice),
};
}
else if ((0, relayer_1.isEIP1559Tx)(tx) && tx.maxFeePerGas !== undefined && tx.maxPriorityFeePerGas !== undefined) {
payloadGasParams = {
maxFeePerGas: (0, bytes_1.hexlify)(tx.maxFeePerGas),
maxPriorityFeePerGas: (0, bytes_1.hexlify)(tx.maxPriorityFeePerGas),
};
}
const payload = {
to: tx.to,
gasLimit: (0, bytes_1.hexlify)(tx.gasLimit),
data: tx.data ? (0, bytes_1.hexlify)(tx.data) : undefined,
speed: tx.speed,
value: tx.value ? (0, bytes_1.hexlify)(tx.value) : undefined,
validUntil: tx.validUntil ? new Date(tx.validUntil).toISOString() : undefined,
isPrivate: tx.isPrivate,
...payloadGasParams,
};
const relayedTransaction = nonce
? await this.relayer.replaceTransactionByNonce(nonce, payload)
: await this.relayer.sendTransaction(payload);
let gasParams;
if ((0, relayer_1.isEIP1559Tx)(relayedTransaction)) {
gasParams = {
maxFeePerGas: bignumber_1.BigNumber.from(relayedTransaction.maxFeePerGas),
maxPriorityFeePerGas: bignumber_1.BigNumber.from(relayedTransaction.maxPriorityFeePerGas),
};
}
else {
gasParams = {
gasPrice: bignumber_1.BigNumber.from(relayedTransaction.gasPrice),
};
}
return this.provider._wrapTransaction({
...(0, lodash_1.omit)(relayedTransaction, 'gasPrice', 'maxPriorityFeePerGas', 'maxFeePerGas'),
...gasParams,
gasLimit: bignumber_1.BigNumber.from(relayedTransaction.gasLimit),
value: bignumber_1.BigNumber.from(relayedTransaction.value ?? 0),
data: relayedTransaction.data ?? '',
}, relayedTransaction.hash);
}
if (tx.gasLimit == null) {
tx.gasLimit = this.estimateGas(tx).catch((error) => {
return logger.throwError(
'cannot estimate gas; transaction may fail or may require manual gas limit',
logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT,
{
error: error,
tx: tx,
},
);
});
// Adapted from ethers-io/ethers.js/packages/abstract-signer/src.ts/index.ts
// Defender relay does not require all fields to be populated
async populateTransaction(transaction) {
const tx = await (0, properties_1.resolveProperties)(this.checkTransaction(transaction));
if (tx.to != null) {
tx.to = Promise.resolve(tx.to).then((to) => this.resolveName(to));
}
if (tx.gasLimit == null) {
tx.gasLimit = this.estimateGas(tx).catch((error) => {
return logger.throwError('cannot estimate gas; transaction may fail or may require manual gas limit', logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, {
error: error,
tx: tx,
});
});
}
if (!tx.speed && !tx.gasPrice && !tx.maxFeePerGas && !tx.maxPriorityFeePerGas) {
if (this.options.gasPrice) {
tx.gasPrice = this.options.gasPrice;
}
else if (this.options.maxFeePerGas && this.options.maxPriorityFeePerGas) {
tx.maxFeePerGas = this.options.maxFeePerGas;
tx.maxPriorityFeePerGas = this.options.maxPriorityFeePerGas;
}
else if (this.options.speed) {
tx.speed = this.options.speed;
}
}
if (!tx.validUntil && this.options.validForSeconds) {
tx.validUntil = new Date(Date.now() + this.options.validForSeconds * 1000);
}
return await (0, properties_1.resolveProperties)(tx);
}
if (!tx.speed && !tx.gasPrice && !tx.maxFeePerGas && !tx.maxPriorityFeePerGas) {
if (this.options.gasPrice) {
tx.gasPrice = this.options.gasPrice;
} else if (this.options.maxFeePerGas && this.options.maxPriorityFeePerGas) {
tx.maxFeePerGas = this.options.maxFeePerGas;
tx.maxPriorityFeePerGas = this.options.maxPriorityFeePerGas;
} else if (this.options.speed) {
tx.speed = this.options.speed;
}
// Adapted from ethers-io/ethers.js/packages/abstract-signer/src.ts/index.ts
// Defender relay accepts more transaction keys
checkTransaction(transaction) {
for (const key in transaction) {
if (allowedTransactionKeys.indexOf(key) === -1) {
logger.throwArgumentError('invalid transaction key: ' + key, 'transaction', transaction);
}
}
const tx = (0, properties_1.shallowCopy)(transaction);
tx.from = Promise.all([Promise.resolve(tx.from), this.getAddress()]).then((result) => {
if (!!result[0] && result[0].toLowerCase() !== result[1].toLowerCase()) {
logger.throwArgumentError('from address mismatch', 'transaction', transaction);
}
return result[1];
});
return tx;
}
if (!tx.validUntil && this.options.validForSeconds) {
tx.validUntil = new Date(Date.now() + this.options.validForSeconds * 1000);
/**
* Signs the typed data value with types data structure for domain using the EIP-712 specification.
* https://eips.ethereum.org/EIPS/eip-712
*
* @param domain EIP712Domain containing name, version, chainId, verifyingContract and salt. All optional
* @param types set of all types encompassed by struct
* @param value typed data to sign matching provided types
* @returns typed data signature
*/
async _signTypedData(domain, types, value) {
const domainSeparator = hash_1._TypedDataEncoder.hashDomain(domain);
const hashStructMessage = hash_1._TypedDataEncoder.from(types).hash(value);
const sig = await this.relayer.signTypedData({
domainSeparator: (0, bytes_1.hexlify)(domainSeparator),
hashStructMessage: (0, bytes_1.hexlify)(hashStructMessage),
});
return (0, bytes_1.joinSignature)(sig);
}
return await (0, properties_1.resolveProperties)(tx);
}
// Adapted from ethers-io/ethers.js/packages/abstract-signer/src.ts/index.ts
// Defender relay accepts more transaction keys
checkTransaction(transaction) {
for (const key in transaction) {
if (allowedTransactionKeys.indexOf(key) === -1) {
logger.throwArgumentError('invalid transaction key: ' + key, 'transaction', transaction);
}
}
const tx = (0, properties_1.shallowCopy)(transaction);
tx.from = Promise.all([Promise.resolve(tx.from), this.getAddress()]).then((result) => {
if (!!result[0] && result[0].toLowerCase() !== result[1].toLowerCase()) {
logger.throwArgumentError('from address mismatch', 'transaction', transaction);
}
return result[1];
});
return tx;
}
/**
* Signs the typed data value with types data structure for domain using the EIP-712 specification.
* https://eips.ethereum.org/EIPS/eip-712
*
* @param domain EIP712Domain containing name, version, chainId, verifyingContract and salt. All optional
* @param types set of all types encompassed by struct
* @param value typed data to sign matching provided types
* @returns typed data signature
*/
async _signTypedData(domain, types, value) {
const domainSeparator = hash_1._TypedDataEncoder.hashDomain(domain);
const hashStructMessage = hash_1._TypedDataEncoder.from(types).hash(value);
const sig = await this.relayer.signTypedData({
domainSeparator: (0, bytes_1.hexlify)(domainSeparator),
hashStructMessage: (0, bytes_1.hexlify)(hashStructMessage),
});
return (0, bytes_1.joinSignature)(sig);
}
}
exports.DefenderRelaySigner = DefenderRelaySigner;
export { RelayClient } from './api';
export * from './relayer';
export declare const VERSION: any;
//# sourceMappingURL=index.d.ts.map
//# sourceMappingURL=index.d.ts.map

@@ -1,39 +0,22 @@

'use strict';
var __createBinding =
(this && this.__createBinding) ||
(Object.create
? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
},
};
}
Object.defineProperty(o, k2, desc);
}
: function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar =
(this && this.__exportStar) ||
function (m, exports) {
for (var p in m)
if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, '__esModule', { value: true });
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = exports.RelayClient = void 0;
var api_1 = require('./api');
Object.defineProperty(exports, 'RelayClient', {
enumerable: true,
get: function () {
return api_1.RelayClient;
},
});
__exportStar(require('./relayer'), exports);
var api_1 = require("./api");
Object.defineProperty(exports, "RelayClient", { enumerable: true, get: function () { return api_1.RelayClient; } });
__exportStar(require("./relayer"), exports);
// eslint-disable-next-line @typescript-eslint/no-var-requires
exports.VERSION = require('../package.json').version;

@@ -10,208 +10,199 @@ /// <reference types="node" />

export interface SendBaseTransactionRequest {
to?: Address;
value?: BigUInt;
data?: Hex;
gasLimit: BigUInt;
validUntil?: string;
isPrivate?: boolean;
to?: Address;
value?: BigUInt;
data?: Hex;
gasLimit: BigUInt;
validUntil?: string;
isPrivate?: boolean;
}
export interface SendSpeedTransactionRequest extends SendBaseTransactionRequest {
speed: Speed;
speed: Speed;
}
export interface SendLegacyTransactionRequest extends SendBaseTransactionRequest {
gasPrice: BigUInt;
gasPrice: BigUInt;
}
export interface SendEIP1559TransactionRequest extends SendBaseTransactionRequest {
maxFeePerGas: BigUInt;
maxPriorityFeePerGas: BigUInt;
maxFeePerGas: BigUInt;
maxPriorityFeePerGas: BigUInt;
}
export type RelayerTransactionPayload =
| SendBaseTransactionRequest
| SendSpeedTransactionRequest
| SendLegacyTransactionRequest
| SendEIP1559TransactionRequest;
export type RelayerTransactionPayload = SendBaseTransactionRequest | SendSpeedTransactionRequest | SendLegacyTransactionRequest | SendEIP1559TransactionRequest;
export interface SignMessagePayload {
message: Hex;
message: Hex;
}
export interface SignTypedDataPayload {
domainSeparator: Hex;
hashStructMessage: Hex;
domainSeparator: Hex;
hashStructMessage: Hex;
}
export interface SignedMessagePayload {
sig: Hex;
r: Hex;
s: Hex;
v: number;
sig: Hex;
r: Hex;
s: Hex;
v: number;
}
export interface RelayerGetResponse {
relayerId: string;
name: string;
address: string;
network: Network;
paused: boolean;
createdAt: string;
pendingTxCost: string;
minBalance: BigUInt;
policies: UpdateRelayerPoliciesRequest;
stackResourceId?: string;
relayerId: string;
name: string;
address: string;
network: Network;
paused: boolean;
createdAt: string;
pendingTxCost: string;
minBalance: BigUInt;
policies: UpdateRelayerPoliciesRequest;
stackResourceId?: string;
}
export interface RelayerModel extends RelayerGetResponse {}
export interface RelayerModel extends RelayerGetResponse {
}
export interface RelayerListResponse {
items: RelayerGetResponse[];
txsQuotaUsage: number;
items: RelayerGetResponse[];
txsQuotaUsage: number;
}
export interface CreateRelayerRequest {
name: string;
useAddressFromRelayerId?: string;
network: Network;
minBalance: BigUInt;
policies?: UpdateRelayerPoliciesRequest;
stackResourceId?: string;
name: string;
useAddressFromRelayerId?: string;
network: Network;
minBalance: BigUInt;
policies?: UpdateRelayerPoliciesRequest;
stackResourceId?: string;
}
export interface UpdateRelayerPoliciesRequest {
gasPriceCap?: BigUInt;
whitelistReceivers?: Address[];
EIP1559Pricing?: boolean;
privateTransactions?: boolean;
gasPriceCap?: BigUInt;
whitelistReceivers?: Address[];
EIP1559Pricing?: boolean;
privateTransactions?: boolean;
}
export interface UpdateRelayerRequest {
name?: string;
policies?: UpdateRelayerPoliciesRequest;
minBalance?: BigUInt;
name?: string;
policies?: UpdateRelayerPoliciesRequest;
minBalance?: BigUInt;
}
export interface RelayerApiKey {
keyId: string;
relayerId: string;
secretKey?: string;
apiKey: string;
createdAt: string;
stackResourceId?: string;
keyId: string;
relayerId: string;
secretKey?: string;
apiKey: string;
createdAt: string;
stackResourceId?: string;
}
export interface DeleteRelayerApiKeyResponse {
message: string;
message: string;
}
interface RelayerTransactionBase {
transactionId: string;
hash: string;
to: Address;
from: Address;
value?: string;
data?: string;
speed?: Speed;
gasLimit: number;
nonce: number;
status: Status;
chainId: number;
validUntil: string;
createdAt: string;
sentAt?: string;
pricedAt?: string;
isPrivate?: boolean;
transactionId: string;
hash: string;
to: Address;
from: Address;
value?: string;
data?: string;
speed?: Speed;
gasLimit: number;
nonce: number;
status: Status;
chainId: number;
validUntil: string;
createdAt: string;
sentAt?: string;
pricedAt?: string;
isPrivate?: boolean;
}
interface RelayerLegacyTransaction extends RelayerTransactionBase {
gasPrice: number;
gasPrice: number;
}
interface RelayerEIP1559Transaction extends RelayerTransactionBase {
maxPriorityFeePerGas: number;
maxFeePerGas: number;
maxPriorityFeePerGas: number;
maxFeePerGas: number;
}
export type RelayerTransaction = RelayerLegacyTransaction | RelayerEIP1559Transaction;
export type PaginatedTransactionListResponse =
| RelayerTransaction[]
| {
items: RelayerTransaction[];
next?: string;
};
export type PaginatedTransactionListResponse = RelayerTransaction[] | {
items: RelayerTransaction[];
next?: string;
};
export type RelayerParams = ApiRelayerParams | AutotaskRelayerParams;
export type ApiRelayerParams = {
apiKey: string;
apiSecret: string;
httpsAgent?: https.Agent;
apiKey: string;
apiSecret: string;
httpsAgent?: https.Agent;
};
export type AutotaskRelayerParams = {
credentials: string;
relayerARN: string;
httpsAgent?: https.Agent;
credentials: string;
relayerARN: string;
httpsAgent?: https.Agent;
};
export type JsonRpcResponse = {
id: number | null;
jsonrpc: '2.0';
result: any;
error?: {
code: number;
message: string;
data?: string;
};
id: number | null;
jsonrpc: '2.0';
result: any;
error?: {
code: number;
message: string;
data?: string;
};
};
export type JsonRpcRequest = {
id: number;
jsonrpc: '2.0';
method: string;
params: string[];
id: number;
jsonrpc: '2.0';
method: string;
params: string[];
};
export declare function isLegacyTx<TransactionLikeType extends object>(
tx: TransactionLikeType,
): tx is TransactionLikeType & {
gasPrice: NonNullable<unknown>;
export declare function isLegacyTx<TransactionLikeType extends object>(tx: TransactionLikeType): tx is TransactionLikeType & {
gasPrice: NonNullable<unknown>;
};
export declare function isEIP1559Tx<TransactionLikeType extends object>(
tx: TransactionLikeType,
): tx is TransactionLikeType & {
maxPriorityFeePerGas: NonNullable<unknown>;
maxFeePerGas: NonNullable<unknown>;
export declare function isEIP1559Tx<TransactionLikeType extends object>(tx: TransactionLikeType): tx is TransactionLikeType & {
maxPriorityFeePerGas: NonNullable<unknown>;
maxFeePerGas: NonNullable<unknown>;
};
export type ListTransactionsRequest = {
status?: 'pending' | 'mined' | 'failed';
since?: Date;
limit?: number;
next?: string;
sort?: 'asc' | 'desc';
usePagination?: boolean;
status?: 'pending' | 'mined' | 'failed';
since?: Date;
limit?: number;
next?: string;
sort?: 'asc' | 'desc';
usePagination?: boolean;
};
export interface RelayerStatus {
relayerId: string;
name: string;
nonce: number;
address: string;
numberOfPendingTransactions: number;
paused: boolean;
pendingTxCost?: string;
txsQuotaUsage: number;
rpcQuotaUsage: number;
lastConfirmedTransaction?: {
hash: string;
status: string;
minedAt: string;
sentAt: string;
relayerId: string;
name: string;
nonce: number;
};
address: string;
numberOfPendingTransactions: number;
paused: boolean;
pendingTxCost?: string;
txsQuotaUsage: number;
rpcQuotaUsage: number;
lastConfirmedTransaction?: {
hash: string;
status: string;
minedAt: string;
sentAt: string;
nonce: number;
};
}
export interface IRelayer {
getRelayer(): Promise<RelayerGetResponse>;
getRelayerStatus(): Promise<RelayerStatus>;
sendTransaction(payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionById(id: string, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionByNonce(nonce: number, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
query(id: string): Promise<RelayerTransaction>;
list(criteria?: ListTransactionsRequest): Promise<RelayerTransaction[] | PaginatedTransactionListResponse>;
sign(payload: SignMessagePayload): Promise<SignedMessagePayload>;
signTypedData(payload: SignTypedDataPayload): Promise<SignedMessagePayload>;
call(method: string, params: string[]): Promise<JsonRpcResponse>;
getRelayer(): Promise<RelayerGetResponse>;
getRelayerStatus(): Promise<RelayerStatus>;
sendTransaction(payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionById(id: string, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionByNonce(nonce: number, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
query(id: string): Promise<RelayerTransaction>;
list(criteria?: ListTransactionsRequest): Promise<RelayerTransaction[] | PaginatedTransactionListResponse>;
sign(payload: SignMessagePayload): Promise<SignedMessagePayload>;
signTypedData(payload: SignTypedDataPayload): Promise<SignedMessagePayload>;
call(method: string, params: string[]): Promise<JsonRpcResponse>;
}
export declare function isRelayer(params: any): params is Relayer;
export declare class Relayer implements IRelayer {
private relayer;
constructor(credentials: RelayerParams);
getRelayer(): Promise<RelayerGetResponse>;
getRelayerStatus(): Promise<RelayerStatus>;
sign(payload: SignMessagePayload): Promise<SignedMessagePayload>;
signTypedData(payload: SignTypedDataPayload): Promise<SignedMessagePayload>;
sendTransaction(payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionById(id: string, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionByNonce(nonce: number, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
query(id: string): Promise<RelayerTransaction>;
list(criteria?: ListTransactionsRequest): Promise<RelayerTransaction[] | PaginatedTransactionListResponse>;
call(method: string, params: string[]): Promise<JsonRpcResponse>;
private relayer;
constructor(credentials: RelayerParams);
getRelayer(): Promise<RelayerGetResponse>;
getRelayerStatus(): Promise<RelayerStatus>;
sign(payload: SignMessagePayload): Promise<SignedMessagePayload>;
signTypedData(payload: SignTypedDataPayload): Promise<SignedMessagePayload>;
sendTransaction(payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionById(id: string, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
replaceTransactionByNonce(nonce: number, payload: RelayerTransactionPayload): Promise<RelayerTransaction>;
query(id: string): Promise<RelayerTransaction>;
list(criteria?: ListTransactionsRequest): Promise<RelayerTransaction[] | PaginatedTransactionListResponse>;
call(method: string, params: string[]): Promise<JsonRpcResponse>;
}
export {};
//# sourceMappingURL=relayer.d.ts.map
//# sourceMappingURL=relayer.d.ts.map

@@ -1,19 +0,19 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Relayer = exports.isRelayer = exports.isEIP1559Tx = exports.isLegacyTx = void 0;
const api_1 = require('./api');
const api_1 = require("./api");
function isAutotaskCredentials(credentials) {
const autotaskCredentials = credentials;
return !!autotaskCredentials.credentials;
const autotaskCredentials = credentials;
return !!autotaskCredentials.credentials;
}
function isApiCredentials(credentials) {
const apiCredentials = credentials;
return !!apiCredentials.apiKey && !!apiCredentials.apiSecret;
const apiCredentials = credentials;
return !!apiCredentials.apiKey && !!apiCredentials.apiSecret;
}
// If a tx-like object is representing a legacy transaction (type 0)
function isLegacyTx(tx) {
// Consider that an EIP1559 tx may have `gasPrice` after
// https://github.com/OpenZeppelin/defender/pull/2838
// that's why the !isEIP1559Tx check
return 'gasPrice' in tx && !isEIP1559Tx(tx);
// Consider that an EIP1559 tx may have `gasPrice` after
// https://github.com/OpenZeppelin/defender/pull/2838
// that's why the !isEIP1559Tx check
return 'gasPrice' in tx && !isEIP1559Tx(tx);
}

@@ -23,69 +23,70 @@ exports.isLegacyTx = isLegacyTx;

function isEIP1559Tx(tx) {
return 'maxPriorityFeePerGas' in tx && 'maxFeePerGas' in tx;
return 'maxPriorityFeePerGas' in tx && 'maxFeePerGas' in tx;
}
exports.isEIP1559Tx = isEIP1559Tx;
function validatePayload(payload) {
if (isEIP1559Tx(payload) && BigInt(payload.maxFeePerGas) < BigInt(payload.maxPriorityFeePerGas)) {
throw new Error('maxFeePerGas should be greater or equal to maxPriorityFeePerGas');
}
if (payload.validUntil && new Date(payload.validUntil).getTime() < new Date().getTime()) {
throw new Error('The validUntil time cannot be in the past');
}
if (!payload.to && !payload.data) {
throw new Error('Both txs `to` and `data` fields are missing. At least one of them has to be set.');
}
return payload;
if (isEIP1559Tx(payload) &&
BigInt(payload.maxFeePerGas) < BigInt(payload.maxPriorityFeePerGas)) {
throw new Error('maxFeePerGas should be greater or equal to maxPriorityFeePerGas');
}
if (payload.validUntil && new Date(payload.validUntil).getTime() < new Date().getTime()) {
throw new Error('The validUntil time cannot be in the past');
}
if (!payload.to && !payload.data) {
throw new Error('Both txs `to` and `data` fields are missing. At least one of them has to be set.');
}
return payload;
}
function isRelayer(params) {
return typeof params === 'object' && !!params.getRelayer;
return typeof params === 'object' && !!params.getRelayer;
}
exports.isRelayer = isRelayer;
class Relayer {
constructor(credentials) {
if (isAutotaskCredentials(credentials)) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { AutotaskRelayer } = require('./autotask');
this.relayer = new AutotaskRelayer(credentials);
} else if (isApiCredentials(credentials)) {
this.relayer = new api_1.ApiRelayer(credentials);
} else {
throw new Error(
`Missing credentials for creating a Relayer instance. If you are running this code in an Autotask, make sure you pass the "credentials" parameter from the handler to the Relayer constructor. If you are running this on your own process, then pass an object with the "apiKey" and "apiSecret" generated by the relayer.`,
);
constructor(credentials) {
if (isAutotaskCredentials(credentials)) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { AutotaskRelayer } = require('./autotask');
this.relayer = new AutotaskRelayer(credentials);
}
else if (isApiCredentials(credentials)) {
this.relayer = new api_1.ApiRelayer(credentials);
}
else {
throw new Error(`Missing credentials for creating a Relayer instance. If you are running this code in an Autotask, make sure you pass the "credentials" parameter from the handler to the Relayer constructor. If you are running this on your own process, then pass an object with the "apiKey" and "apiSecret" generated by the relayer.`);
}
}
}
getRelayer() {
return this.relayer.getRelayer();
}
getRelayerStatus() {
return this.relayer.getRelayerStatus();
}
sign(payload) {
return this.relayer.sign(payload);
}
signTypedData(payload) {
return this.relayer.signTypedData(payload);
}
sendTransaction(payload) {
validatePayload(payload);
return this.relayer.sendTransaction(payload);
}
replaceTransactionById(id, payload) {
validatePayload(payload);
return this.relayer.replaceTransactionById(id, payload);
}
replaceTransactionByNonce(nonce, payload) {
validatePayload(payload);
return this.relayer.replaceTransactionByNonce(nonce, payload);
}
query(id) {
return this.relayer.query(id);
}
list(criteria) {
return this.relayer.list(criteria);
}
call(method, params) {
return this.relayer.call(method, params);
}
getRelayer() {
return this.relayer.getRelayer();
}
getRelayerStatus() {
return this.relayer.getRelayerStatus();
}
sign(payload) {
return this.relayer.sign(payload);
}
signTypedData(payload) {
return this.relayer.signTypedData(payload);
}
sendTransaction(payload) {
validatePayload(payload);
return this.relayer.sendTransaction(payload);
}
replaceTransactionById(id, payload) {
validatePayload(payload);
return this.relayer.replaceTransactionById(id, payload);
}
replaceTransactionByNonce(nonce, payload) {
validatePayload(payload);
return this.relayer.replaceTransactionByNonce(nonce, payload);
}
query(id) {
return this.relayer.query(id);
}
list(criteria) {
return this.relayer.list(criteria);
}
call(method, params) {
return this.relayer.call(method, params);
}
}
exports.Relayer = Relayer;

@@ -6,4 +6,4 @@ import { RelayerParams } from '../relayer';

export declare class DefenderRelayProvider extends DefenderRelaySenderProvider {
constructor(relayerCredentials: RelayerParams, options: DefenderRelaySenderOptions);
constructor(relayerCredentials: RelayerParams, options: DefenderRelaySenderOptions);
}
//# sourceMappingURL=index.d.ts.map
//# sourceMappingURL=index.d.ts.map

@@ -1,25 +0,15 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefenderRelayProvider = exports.DefenderRelaySenderProvider = exports.DefenderRelayQueryProvider = void 0;
const relayer_1 = require('../relayer');
const query_1 = require('./query');
Object.defineProperty(exports, 'DefenderRelayQueryProvider', {
enumerable: true,
get: function () {
return query_1.DefenderRelayQueryProvider;
},
});
const sender_1 = require('./sender');
Object.defineProperty(exports, 'DefenderRelaySenderProvider', {
enumerable: true,
get: function () {
return sender_1.DefenderRelaySenderProvider;
},
});
const relayer_1 = require("../relayer");
const query_1 = require("./query");
Object.defineProperty(exports, "DefenderRelayQueryProvider", { enumerable: true, get: function () { return query_1.DefenderRelayQueryProvider; } });
const sender_1 = require("./sender");
Object.defineProperty(exports, "DefenderRelaySenderProvider", { enumerable: true, get: function () { return sender_1.DefenderRelaySenderProvider; } });
class DefenderRelayProvider extends sender_1.DefenderRelaySenderProvider {
constructor(relayerCredentials, options) {
const relayer = new relayer_1.Relayer(relayerCredentials);
super(new query_1.DefenderRelayQueryProvider(relayer), relayer, options);
}
constructor(relayerCredentials, options) {
const relayer = new relayer_1.Relayer(relayerCredentials);
super(new query_1.DefenderRelayQueryProvider(relayer), relayer, options);
}
}
exports.DefenderRelayProvider = DefenderRelayProvider;

@@ -5,9 +5,9 @@ import { JsonRpcPayload, JsonRpcResponse } from 'web3-core-helpers';

export declare class DefenderRelayQueryProvider {
protected relayer: Relayer;
protected id: number;
constructor(relayerCredentials: RelayerParams | Relayer);
sendAsync(payload: JsonRpcPayload, callback: Web3Callback): void;
send(payload: JsonRpcPayload, callback: Web3Callback): void;
protected relayer: Relayer;
protected id: number;
constructor(relayerCredentials: RelayerParams | Relayer);
sendAsync(payload: JsonRpcPayload, callback: Web3Callback): void;
send(payload: JsonRpcPayload, callback: Web3Callback): void;
}
export {};
//# sourceMappingURL=query.d.ts.map
//# sourceMappingURL=query.d.ts.map

@@ -1,28 +0,24 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefenderRelayQueryProvider = void 0;
const relayer_1 = require('../relayer');
const relayer_1 = require("../relayer");
class DefenderRelayQueryProvider {
constructor(relayerCredentials) {
this.id = 1;
this.relayer = (0, relayer_1.isRelayer)(relayerCredentials)
? relayerCredentials
: new relayer_1.Relayer(relayerCredentials);
}
sendAsync(payload, callback) {
return this.send(payload, callback);
}
send(payload, callback) {
const payloadId = typeof payload.id === 'string' ? parseInt(payload.id) : payload.id;
this.relayer
.call(payload.method, payload.params ?? [])
.then((response) =>
callback(null, {
...response,
id: payloadId ?? response.id ?? this.id++,
}),
)
.catch((err) => callback(err, undefined));
}
constructor(relayerCredentials) {
this.id = 1;
this.relayer = (0, relayer_1.isRelayer)(relayerCredentials) ? relayerCredentials : new relayer_1.Relayer(relayerCredentials);
}
sendAsync(payload, callback) {
return this.send(payload, callback);
}
send(payload, callback) {
const payloadId = typeof payload.id === 'string' ? parseInt(payload.id) : payload.id;
this.relayer
.call(payload.method, payload.params ?? [])
.then((response) => callback(null, {
...response,
id: payloadId ?? response.id ?? this.id++,
}))
.catch((err) => callback(err, undefined));
}
}
exports.DefenderRelayQueryProvider = DefenderRelayQueryProvider;

@@ -6,31 +6,27 @@ import { AbstractProvider } from 'web3-core';

export type DefenderRelaySenderOptions = Partial<{
gasPrice: BigUInt;
maxFeePerGas: BigUInt;
maxPriorityFeePerGas: BigUInt;
speed: Speed;
validForSeconds: number;
gasPrice: BigUInt;
maxFeePerGas: BigUInt;
maxPriorityFeePerGas: BigUInt;
speed: Speed;
validForSeconds: number;
}>;
export declare class DefenderRelaySenderProvider {
protected base: AbstractProvider;
protected options: DefenderRelaySenderOptions;
protected relayer: Relayer;
protected id: number;
protected txHashToId: Map<string, string>;
private address;
constructor(
base: AbstractProvider,
relayerCredentials: RelayerParams | Relayer,
options?: DefenderRelaySenderOptions,
);
get connected(): boolean | undefined;
getTransactionId(hash: string): string | undefined;
protected getAddress(): Promise<string>;
sendAsync(payload: JsonRpcPayload, callback: Web3Callback): void;
send(payload: JsonRpcPayload, callback: Web3Callback): void;
protected _getAccounts(params: any[]): Promise<string[]>;
protected _sendTransaction(params: any[]): Promise<string>;
protected _signMessage(params: any[]): Promise<string>;
protected _delegateToProvider(provider: any): void;
protected base: AbstractProvider;
protected options: DefenderRelaySenderOptions;
protected relayer: Relayer;
protected id: number;
protected txHashToId: Map<string, string>;
private address;
constructor(base: AbstractProvider, relayerCredentials: RelayerParams | Relayer, options?: DefenderRelaySenderOptions);
get connected(): boolean | undefined;
getTransactionId(hash: string): string | undefined;
protected getAddress(): Promise<string>;
sendAsync(payload: JsonRpcPayload, callback: Web3Callback): void;
send(payload: JsonRpcPayload, callback: Web3Callback): void;
protected _getAccounts(params: any[]): Promise<string[]>;
protected _sendTransaction(params: any[]): Promise<string>;
protected _signMessage(params: any[]): Promise<string>;
protected _delegateToProvider(provider: any): void;
}
export {};
//# sourceMappingURL=sender.d.ts.map
//# sourceMappingURL=sender.d.ts.map
{
"name": "@openzeppelin/defender-relay-client",
"version": "1.54.1",
"version": "1.54.2",
"description": "",

@@ -34,3 +34,3 @@ "main": "./lib/index.js",

"dependencies": {
"@openzeppelin/defender-base-client": "1.54.1",
"@openzeppelin/defender-base-client": "1.54.2",
"amazon-cognito-identity-js": "^6.0.1",

@@ -57,3 +57,3 @@ "axios": "^1.4.0",

},
"gitHead": "ff20768e5718ebff4bccc199508834bb7219f7c1"
"gitHead": "a4f42ccd3773997da730ed215a2600dc94aefd43"
}

@@ -45,3 +45,3 @@ # Defender Relay Client & Signer

name: 'MyNewRelayer',
network: 'goerli',
network: 'sepolia',
minBalance: BigInt(1e17).toString(),

@@ -48,0 +48,0 @@ policies: {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc