Skip to main content
Version: 0.2.x-amarok

NxtpSdkBase

Lightweight class to facilitate interaction with the Connext contract on configured chains.

Constructors

constructor

new NxtpSdkBase(config, logger, chainData)

Parameters

NameType
configObject
config.cartographerUrlundefined | string
config.chainsRecord<string, { gasStations?: string[] | undefined; confirmations?: number | undefined; chainId?: number | undefined; deployments?: { stableSwap?: string | undefined; connext: string; } | undefined; assets: { ...; }[]; providers: string[]; }>
config.environmentundefined | "staging" | "production"
config.logLevelundefined | "fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent"
config.maxSlippageundefined | number
config.networkundefined | "testnet" | "mainnet" | "local"
config.signerAddressundefined | string
loggerLogger
chainDataMap<string, ChainData>

Methods

approveIfNeeded

approveIfNeeded(domain, assetId, amount, infiniteApprove?): Promise<undefined | TransactionRequest>

Parameters

NameTypeDefault value
domainstringundefined
assetIdstringundefined
amountstringundefined
infiniteApprovebooleantrue

Returns

Promise<undefined | TransactionRequest>

bumpTransfer

bumpTransfer(params): Promise<TransactionRequest>

Parameters

NameType
paramsObject
params.domainstring
params.relayerFeestring
params.transferIdstring

Returns

Promise<TransactionRequest>

changeSignerAddress

changeSignerAddress(signerAddress): Promise<void>

Parameters

NameType
signerAddressstring

Returns

Promise<void>

estimateRelayerFee

estimateRelayerFee(params): Promise<BigNumber>

Parameters

NameType
paramsObject
params.callDataGasAmount?number
params.destinationDomainstring
params.destinationNativeToken?string
params.isHighPriority?boolean
params.originDomainstring
params.originNativeToken?string

Returns

Promise<BigNumber>

xcall

xcall(args): Promise<TransactionRequest>

Check, sanitize, and format the XCall and encode calldata. Returns an ethers TransactionRequest object, ready to be sent to an RPC provider.

Parameters

NameTypeDescription
argsOmit<{ amount: string ; asset: string ; callData: string ; delegate: string ; destination: string ; slippage: string ; to: string }, "delegate" | "callData"> & Partial<{ amount: string ; asset: string ; callData: string ; delegate: string ; destination: string ; slippage: string ; to: string }> & { origin: string ; relayerFee?: string }XCall arguments. Some fields in args.params are optional and have default values provided.

Returns

Promise<TransactionRequest>

providers.TransactionRequest object.

create

Static create(_config, _logger?, _chainData?): Promise<NxtpSdkBase>

Parameters

NameType
_configObject
_config.cartographerUrlundefined | string
_config.chainsRecord<string, { gasStations?: string[] | undefined; confirmations?: number | undefined; chainId?: number | undefined; deployments?: { stableSwap?: string | undefined; connext: string; } | undefined; assets: { ...; }[]; providers: string[]; }>
_config.environmentundefined | "staging" | "production"
_config.logLevelundefined | "fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent"
_config.maxSlippageundefined | number
_config.networkundefined | "testnet" | "mainnet" | "local"
_config.signerAddressundefined | string
_logger?Logger
_chainData?Map<string, ChainData>

Returns

Promise<NxtpSdkBase>