@holographxyz/cli
Version:
Holograph operator CLI
163 lines (162 loc) • 4.28 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeBridgeOutErc721Args = exports.decodeBridgeOutErc20Args = exports.decodeBridgeOut = exports.decodeBridgeInErc721Args = exports.decodeBridgeInErc20Args = exports.decodeBridgeIn = void 0;
const tslib_1 = require("tslib");
const web3_1 = tslib_1.__importDefault(require("web3"));
const web3 = new web3_1.default();
const decodeBridgeIn = function (input) {
const decoded = web3.eth.abi.decodeParameters([
{
internalType: 'uint32',
name: 'fromChain',
type: 'uint32',
},
{
internalType: 'bytes',
name: 'payload',
type: 'bytes',
},
], input);
return {
fromChain: decoded.fromChain,
payload: decoded.fromChain,
};
};
exports.decodeBridgeIn = decodeBridgeIn;
const decodeBridgeInErc20Args = function (input) {
const decoded = web3.eth.abi.decodeParameters([
{
internalType: 'address',
name: 'from',
type: 'address',
},
{
internalType: 'address',
name: 'to',
type: 'address',
},
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
{
internalType: 'bytes',
name: 'data',
type: 'bytes',
},
], input);
return {
from: decoded.from,
to: decoded.to,
amount: decoded.amount,
data: decoded.data,
};
};
exports.decodeBridgeInErc20Args = decodeBridgeInErc20Args;
const decodeBridgeInErc721Args = function (input) {
const decoded = web3.eth.abi.decodeParameters([
{
internalType: 'address',
name: 'from',
type: 'address',
},
{
internalType: 'address',
name: 'to',
type: 'address',
},
{
internalType: 'uint256',
name: 'tokenId',
type: 'uint256',
},
{
internalType: 'bytes',
name: 'data',
type: 'bytes',
},
], input);
return {
from: decoded.from,
to: decoded.to,
tokenId: decoded.tokenId,
data: decoded.data,
};
};
exports.decodeBridgeInErc721Args = decodeBridgeInErc721Args;
const decodeBridgeOut = function (input) {
const decoded = web3.eth.abi.decodeParameters([
{
internalType: 'uint32',
name: 'toChain',
type: 'uint32',
},
{
internalType: 'address',
name: 'sender',
type: 'address',
},
{
internalType: 'bytes',
name: 'payload',
type: 'bytes',
},
], input);
return {
toChain: decoded.toChain,
sender: decoded.sender,
payload: decoded.payload,
};
};
exports.decodeBridgeOut = decodeBridgeOut;
const decodeBridgeOutErc20Args = function (input) {
const decoded = web3.eth.abi.decodeParameters([
{
internalType: 'address',
name: 'from',
type: 'address',
},
{
internalType: 'address',
name: 'to',
type: 'address',
},
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
], input);
return {
from: decoded.from,
to: decoded.to,
amount: decoded.amount,
};
};
exports.decodeBridgeOutErc20Args = decodeBridgeOutErc20Args;
const decodeBridgeOutErc721Args = function (input) {
const decoded = web3.eth.abi.decodeParameters([
{
internalType: 'address',
name: 'from',
type: 'address',
},
{
internalType: 'address',
name: 'to',
type: 'address',
},
{
internalType: 'uint256',
name: 'tokenId',
type: 'uint256',
},
], input);
return {
from: decoded.from,
to: decoded.to,
tokenId: decoded.tokenId,
};
};
exports.decodeBridgeOutErc721Args = decodeBridgeOutErc721Args;