🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@hyperionxyz/bridge

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyperionxyz/bridge - npm Package Compare versions

Comparing version
0.0.3
to
0.0.4
+1
-1
dist/index.cjs

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

"use strict";var b=Object.defineProperty;var g=(a,e,t)=>e in a?b(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var p=(a,e,t)=>g(a,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("bignumber.js"),f=require("aptos-tool"),r=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"uint32",name:"dstEid",type:"uint32"},{internalType:"bytes32",name:"to",type:"bytes32"},{internalType:"uint256",name:"amountLD",type:"uint256"},{internalType:"uint256",name:"minAmountLD",type:"uint256"},{internalType:"bytes",name:"extraOptions",type:"bytes"},{internalType:"bytes",name:"composeMsg",type:"bytes"},{internalType:"bytes",name:"oftCmd",type:"bytes"}],internalType:"struct SendParam",name:"_sendParam",type:"tuple"},{internalType:"bool",name:"_payInLzToken",type:"bool"}],name:"quoteSend",outputs:[{components:[{internalType:"uint256",name:"nativeFee",type:"uint256"},{internalType:"uint256",name:"lzTokenFee",type:"uint256"}],internalType:"struct MessagingFee",name:"msgFee",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"uint32",name:"dstEid",type:"uint32"},{internalType:"bytes32",name:"to",type:"bytes32"},{internalType:"uint256",name:"amountLD",type:"uint256"},{internalType:"uint256",name:"minAmountLD",type:"uint256"},{internalType:"bytes",name:"extraOptions",type:"bytes"},{internalType:"bytes",name:"composeMsg",type:"bytes"},{internalType:"bytes",name:"oftCmd",type:"bytes"}],internalType:"struct SendParam",name:"_sendParam",type:"tuple"},{components:[{internalType:"uint256",name:"nativeFee",type:"uint256"},{internalType:"uint256",name:"lzTokenFee",type:"uint256"}],internalType:"struct MessagingFee",name:"_fee",type:"tuple"},{internalType:"address",name:"_refundAddress",type:"address"}],name:"send",outputs:[{components:[{internalType:"bytes32",name:"guid",type:"bytes32"},{internalType:"uint64",name:"nonce",type:"uint64"},{components:[{internalType:"uint256",name:"nativeFee",type:"uint256"},{internalType:"uint256",name:"lzTokenFee",type:"uint256"}],internalType:"struct MessagingFee",name:"fee",type:"tuple"}],internalType:"struct MessagingReceipt",name:"msgReceipt",type:"tuple"},{components:[{internalType:"uint256",name:"amountSentLD",type:"uint256"},{internalType:"uint256",name:"amountReceivedLD",type:"uint256"}],internalType:"struct OFTReceipt",name:"oftReceipt",type:"tuple"}],stateMutability:"payable",type:"function"}],m=[{name:"Hyperion",symbol:"RION",chain:{aptos:{address:"0x435ad41e7b383cef98899c4e5a22c8dc88ab67b22f95e5663d6c6649298c3a9d",oftContractAddress:"0xa5730bea43e0ab75fd2c2f56b542dd06fbe7d3f80bea1ecaebfa121b06de2c4d",logo:"https://assets.hyperion.xyz/aptos-token/main/logos/RION.svg",decimals:6},bsc:{address:"0xc0c240c870606a5cb3150795e2d0dfff9f1f7456",decimals:18}}}],u=30102,c=30108,d=56;function A(a){return Array.from(Buffer.from(a.replace("0x","").padStart(64,"0"),"hex"))}function y(a,e){return f.Token.amountInUnit(a,e).toString()}function B(a){return new T(a).multipliedBy(.99).dp(0).toString()}class h{constructor(){p(this,"tokens",m)}addToken(e){this.tokens.push(e)}validateBridgeArgs(e){const{token:t,amount:i}=e,n=[];if(t.chain.bsc.address||n.push("BSC address is not set"),t.chain.aptos.address||n.push("Aptos address is not set"),t.chain.aptos.oftContractAddress||n.push("Aptos OFT contract address is not set"),e.sender||n.push("Sender address is not set"),e.recipient||n.push("Recipient address is not set"),i<=0&&n.push("Amount must be greater than 0"),n.length>0)throw new Error(n.join(", "))}prepareBridgeData(e,t){const{recipient:i,amount:n,token:s}=e;let o;return t==="aptos-to-bsc"?o=y(n,s.chain.aptos.decimals):o=y(n,s.chain.bsc.decimals),Object.assign({bridgeAmount:o,slippageAmount:B(o)},t==="aptos-to-bsc"?{bscRecipientBytes:A(i)}:{aptosRecipient:i})}createQuoteSendPayloadFromAptosToBSC(e){this.validateBridgeArgs(e);const{token:t,sender:i}=e,{bscRecipientBytes:n,bridgeAmount:s,slippageAmount:o}=this.prepareBridgeData(e,"aptos-to-bsc");return{function:`${t.chain.aptos.oftContractAddress}::oft::quote_send`,typeArguments:[],functionArguments:[i,u,n,s,o,"","","",!1]}}createBridgePayloadFromAptosToBSC(e,t){this.validateBridgeArgs(e);const{token:i}=e,{bscRecipientBytes:n,bridgeAmount:s,slippageAmount:o}=this.prepareBridgeData(e,"aptos-to-bsc");return{function:`${i.chain.aptos.oftContractAddress}::oft::send_withdraw`,typeArguments:[],functionArguments:[u,n,s,o,"","","",t[0],0]}}createQuoteSendPayloadFromBSCToAptos(e){this.validateBridgeArgs(e);const{token:t,recipient:i}=e,{bridgeAmount:n,slippageAmount:s}=this.prepareBridgeData(e,"bsc-to-aptos");return{address:t.chain.bsc.address,abi:r,args:[[c,i,n,s,"","",""],!1],functionName:"quoteSend",chainId:d}}createBridgePayloadFromBSCToAptos(e,t){this.validateBridgeArgs(e);const{token:i,recipient:n,sender:s}=e,{bridgeAmount:o,slippageAmount:l}=this.prepareBridgeData(e,"bsc-to-aptos");return{address:i.chain.bsc.address,abi:r,functionName:"send",args:[[c,n,BigInt(o),BigInt(l),"","",""],[BigInt(t.nativeFee),BigInt(t.lzTokenFee)],s],chainId:d,value:BigInt(t.nativeFee)}}}exports.HyperionBridge=h;exports.TOKENS=m;
"use strict";var g=Object.defineProperty;var T=(a,e,t)=>e in a?g(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var r=(a,e,t)=>T(a,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("bignumber.js"),f=require("aptos-tool"),u=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"uint32",name:"dstEid",type:"uint32"},{internalType:"bytes32",name:"to",type:"bytes32"},{internalType:"uint256",name:"amountLD",type:"uint256"},{internalType:"uint256",name:"minAmountLD",type:"uint256"},{internalType:"bytes",name:"extraOptions",type:"bytes"},{internalType:"bytes",name:"composeMsg",type:"bytes"},{internalType:"bytes",name:"oftCmd",type:"bytes"}],internalType:"struct SendParam",name:"_sendParam",type:"tuple"},{internalType:"bool",name:"_payInLzToken",type:"bool"}],name:"quoteSend",outputs:[{components:[{internalType:"uint256",name:"nativeFee",type:"uint256"},{internalType:"uint256",name:"lzTokenFee",type:"uint256"}],internalType:"struct MessagingFee",name:"msgFee",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"uint32",name:"dstEid",type:"uint32"},{internalType:"bytes32",name:"to",type:"bytes32"},{internalType:"uint256",name:"amountLD",type:"uint256"},{internalType:"uint256",name:"minAmountLD",type:"uint256"},{internalType:"bytes",name:"extraOptions",type:"bytes"},{internalType:"bytes",name:"composeMsg",type:"bytes"},{internalType:"bytes",name:"oftCmd",type:"bytes"}],internalType:"struct SendParam",name:"_sendParam",type:"tuple"},{components:[{internalType:"uint256",name:"nativeFee",type:"uint256"},{internalType:"uint256",name:"lzTokenFee",type:"uint256"}],internalType:"struct MessagingFee",name:"_fee",type:"tuple"},{internalType:"address",name:"_refundAddress",type:"address"}],name:"send",outputs:[{components:[{internalType:"bytes32",name:"guid",type:"bytes32"},{internalType:"uint64",name:"nonce",type:"uint64"},{components:[{internalType:"uint256",name:"nativeFee",type:"uint256"},{internalType:"uint256",name:"lzTokenFee",type:"uint256"}],internalType:"struct MessagingFee",name:"fee",type:"tuple"}],internalType:"struct MessagingReceipt",name:"msgReceipt",type:"tuple"},{components:[{internalType:"uint256",name:"amountSentLD",type:"uint256"},{internalType:"uint256",name:"amountReceivedLD",type:"uint256"}],internalType:"struct OFTReceipt",name:"oftReceipt",type:"tuple"}],stateMutability:"payable",type:"function"}],l=[{name:"Hyperion",symbol:"RION",chain:{aptos:{address:"0x435ad41e7b383cef98899c4e5a22c8dc88ab67b22f95e5663d6c6649298c3a9d",oftContractAddress:"0xa5730bea43e0ab75fd2c2f56b542dd06fbe7d3f80bea1ecaebfa121b06de2c4d",logo:"https://assets.hyperion.xyz/aptos-token/main/logos/RION.svg",decimals:6},bsc:{address:"0xc0c240c870606a5cb3150795e2d0dfff9f1f7456",decimals:18}}}],c=30102,d=30108,y=56;p.config({EXPONENTIAL_AT:1e9});function A(a){return Array.from(Buffer.from(a.replace("0x","").padStart(64,"0"),"hex"))}function m(a,e){return f.Token.amountInUnit(a,e).toString()}function B(a){return new p(a).multipliedBy(.99).dp(0).toString()}p.config({EXPONENTIAL_AT:1e9});class h{constructor(){r(this,"tokens",l)}addToken(e){this.tokens.push(e)}validateBridgeArgs(e){const{token:t,amount:i}=e,n=[];if(t.chain.bsc.address||n.push("BSC address is not set"),t.chain.aptos.address||n.push("Aptos address is not set"),t.chain.aptos.oftContractAddress||n.push("Aptos OFT contract address is not set"),e.sender||n.push("Sender address is not set"),e.recipient||n.push("Recipient address is not set"),p(i).lte(0)&&n.push("Amount must be greater than 0"),n.length>0)throw new Error(n.join(", "))}prepareBridgeData(e,t){const{recipient:i,amount:n,token:s}=e;let o;return t==="aptos-to-bsc"?o=m(n,s.chain.aptos.decimals):o=m(n,s.chain.bsc.decimals),Object.assign({bridgeAmount:o,slippageAmount:B(o)},t==="aptos-to-bsc"?{bscRecipientBytes:A(i)}:{aptosRecipient:i})}createQuoteSendPayloadFromAptosToBSC(e){this.validateBridgeArgs(e);const{token:t,sender:i}=e,{bscRecipientBytes:n,bridgeAmount:s,slippageAmount:o}=this.prepareBridgeData(e,"aptos-to-bsc");return{function:`${t.chain.aptos.oftContractAddress}::oft::quote_send`,typeArguments:[],functionArguments:[i,c,n,s,o,"","","",!1]}}createBridgePayloadFromAptosToBSC(e,t){this.validateBridgeArgs(e);const{token:i}=e,{bscRecipientBytes:n,bridgeAmount:s,slippageAmount:o}=this.prepareBridgeData(e,"aptos-to-bsc");return{function:`${i.chain.aptos.oftContractAddress}::oft::send_withdraw`,typeArguments:[],functionArguments:[c,n,s,o,"","","",t[0],0]}}createQuoteSendPayloadFromBSCToAptos(e){this.validateBridgeArgs(e);const{token:t,recipient:i}=e,{bridgeAmount:n,slippageAmount:s}=this.prepareBridgeData(e,"bsc-to-aptos");return{address:t.chain.bsc.address,abi:u,args:[[d,i,n,s,"","",""],!1],functionName:"quoteSend",chainId:y}}createBridgePayloadFromBSCToAptos(e,t){this.validateBridgeArgs(e);const{token:i,recipient:n,sender:s}=e,{bridgeAmount:o,slippageAmount:b}=this.prepareBridgeData(e,"bsc-to-aptos");return{address:i.chain.bsc.address,abi:u,functionName:"send",args:[[d,n,BigInt(o),BigInt(b),"","",""],[BigInt(t.nativeFee),BigInt(t.lzTokenFee)],s],chainId:y,value:BigInt(t.nativeFee)}}}exports.HyperionBridge=h;exports.TOKENS=l;

@@ -1,7 +0,7 @@

var l = Object.defineProperty;
var b = (a, e, t) => e in a ? l(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
var o = (a, e, t) => b(a, typeof e != "symbol" ? e + "" : e, t);
import f from "bignumber.js";
var b = Object.defineProperty;
var f = (a, e, t) => e in a ? b(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
var r = (a, e, t) => f(a, typeof e != "symbol" ? e + "" : e, t);
import p from "bignumber.js";
import { Token as g } from "aptos-tool";
const r = [
const c = [
// decimals

@@ -148,3 +148,4 @@ {

}
], u = 30102, c = 30108, d = 56;
], u = 30102, d = 30108, y = 56;
p.config({ EXPONENTIAL_AT: 1e9 });
function A(a) {

@@ -155,11 +156,12 @@ return Array.from(

}
function y(a, e) {
function m(a, e) {
return g.amountInUnit(a, e).toString();
}
function h(a) {
return new f(a).multipliedBy(0.99).dp(0).toString();
return new p(a).multipliedBy(0.99).dp(0).toString();
}
class k {
p.config({ EXPONENTIAL_AT: 1e9 });
class I {
constructor() {
o(this, "tokens", T);
r(this, "tokens", T);
}

@@ -175,11 +177,11 @@ /**

const { token: t, amount: i } = e, n = [];
if (t.chain.bsc.address || n.push("BSC address is not set"), t.chain.aptos.address || n.push("Aptos address is not set"), t.chain.aptos.oftContractAddress || n.push("Aptos OFT contract address is not set"), e.sender || n.push("Sender address is not set"), e.recipient || n.push("Recipient address is not set"), i <= 0 && n.push("Amount must be greater than 0"), n.length > 0) throw new Error(n.join(", "));
if (t.chain.bsc.address || n.push("BSC address is not set"), t.chain.aptos.address || n.push("Aptos address is not set"), t.chain.aptos.oftContractAddress || n.push("Aptos OFT contract address is not set"), e.sender || n.push("Sender address is not set"), e.recipient || n.push("Recipient address is not set"), p(i).lte(0) && n.push("Amount must be greater than 0"), n.length > 0) throw new Error(n.join(", "));
}
prepareBridgeData(e, t) {
const { recipient: i, amount: n, token: s } = e;
let p;
return t === "aptos-to-bsc" ? p = y(n, s.chain.aptos.decimals) : p = y(n, s.chain.bsc.decimals), Object.assign(
let o;
return t === "aptos-to-bsc" ? o = m(n, s.chain.aptos.decimals) : o = m(n, s.chain.bsc.decimals), Object.assign(
{
bridgeAmount: p,
slippageAmount: h(p)
bridgeAmount: o,
slippageAmount: h(o)
},

@@ -216,3 +218,3 @@ t === "aptos-to-bsc" ? {

this.validateBridgeArgs(e);
const { token: t, sender: i } = e, { bscRecipientBytes: n, bridgeAmount: s, slippageAmount: p } = this.prepareBridgeData(e, "aptos-to-bsc");
const { token: t, sender: i } = e, { bscRecipientBytes: n, bridgeAmount: s, slippageAmount: o } = this.prepareBridgeData(e, "aptos-to-bsc");
return {

@@ -228,3 +230,3 @@ function: `${t.chain.aptos.oftContractAddress}::oft::quote_send`,

// bridge amount,
p,
o,
"",

@@ -273,3 +275,3 @@ "",

this.validateBridgeArgs(e);
const { token: i } = e, { bscRecipientBytes: n, bridgeAmount: s, slippageAmount: p } = this.prepareBridgeData(e, "aptos-to-bsc");
const { token: i } = e, { bscRecipientBytes: n, bridgeAmount: s, slippageAmount: o } = this.prepareBridgeData(e, "aptos-to-bsc");
return {

@@ -282,3 +284,3 @@ function: `${i.chain.aptos.oftContractAddress}::oft::send_withdraw`,

s,
p,
o,
// min amount

@@ -323,9 +325,9 @@ "",

address: t.chain.bsc.address,
abi: r,
abi: c,
args: [
[c, i, n, s, "", "", ""],
[d, i, n, s, "", "", ""],
!1
],
functionName: "quoteSend",
chainId: d
chainId: y
};

@@ -358,3 +360,3 @@ }

this.validateBridgeArgs(e);
const { token: i, recipient: n, sender: s } = e, { bridgeAmount: p, slippageAmount: m } = this.prepareBridgeData(
const { token: i, recipient: n, sender: s } = e, { bridgeAmount: o, slippageAmount: l } = this.prepareBridgeData(
e,

@@ -365,10 +367,10 @@ "bsc-to-aptos"

address: i.chain.bsc.address,
abi: r,
abi: c,
functionName: "send",
args: [
[
c,
d,
n,
BigInt(p),
BigInt(m),
BigInt(o),
BigInt(l),
"",

@@ -381,3 +383,3 @@ "",

],
chainId: d,
chainId: y,
value: BigInt(t.nativeFee)

@@ -388,4 +390,4 @@ };

export {
k as HyperionBridge,
I as HyperionBridge,
T as TOKENS
};

@@ -5,3 +5,3 @@ import { InputGenerateTransactionPayloadData, InputViewFunctionData } from '@aptos-labs/ts-sdk';

token: BridgeToken;
amount: number;
amount: number | string;
sender: string;

@@ -8,0 +8,0 @@ recipient: string;

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

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mCAAmC,EACnC,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAO5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAQF,qBAAa,cAAc;IACzB,MAAM,EAAE,WAAW,EAAE,CAAU;IAE/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW;IAI3B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,iBAAiB;IA4BzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,oCAAoC,CAClC,IAAI,EAAE,UAAU,GACf,qBAAqB;IAwBxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,iCAAiC,CAC/B,IAAI,EAAE,UAAU,EAChB,WAAW,EAAE,GAAG,EAAE,GACjB,mCAAmC;IA0BtC;;;;;;;;;;;;;;;;OAgBG;IAEH,oCAAoC,CAAC,IAAI,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqBrD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,iCAAiC,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BrE"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mCAAmC,EACnC,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAQF,qBAAa,cAAc;IACzB,MAAM,EAAE,WAAW,EAAE,CAAU;IAE/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW;IAI3B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,iBAAiB;IA4BzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,oCAAoC,CAClC,IAAI,EAAE,UAAU,GACf,qBAAqB;IAwBxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,iCAAiC,CAC/B,IAAI,EAAE,UAAU,EAChB,WAAW,EAAE,GAAG,EAAE,GACjB,mCAAmC;IA0BtC;;;;;;;;;;;;;;;;OAgBG;IAEH,oCAAoC,CAAC,IAAI,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqBrD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,iCAAiC,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BrE"}
export declare function encodeBscRecipient(recipient: string): number[];
export declare function calculateBridgeAmount(amount: number, decimals: number): string;
export declare function calculateBridgeAmount(amount: number | string, decimals: number): string;
export declare function calculateSlippage(amount: string): string;
//# sourceMappingURL=index.d.ts.map

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

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAI9D;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAIA,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAI9D;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD"}
{
"name": "@hyperionxyz/bridge",
"version": "0.0.3",
"version": "0.0.4",
"description": "",

@@ -32,3 +32,3 @@ "type": "module",

"dependencies": {
"aptos-tool": "^0.0.8",
"aptos-tool": "^0.0.11",
"bignumber.js": "^9.1.2",

@@ -35,0 +35,0 @@ "buffer": "^6.0.3"

@@ -11,2 +11,4 @@ import { APTOS_EID, BSC_ABI, BSC_CHAIN_ID, BSC_EID, TOKENS } from "./config";

} from "./utils";
import BigNumber from "bignumber.js";
BigNumber.config({ EXPONENTIAL_AT: 1e9 });

@@ -18,3 +20,3 @@ export { TOKENS } from "./config";

token: BridgeToken;
amount: number;
amount: number | string;
sender: string;

@@ -51,3 +53,3 @@ recipient: string;

if (!args.recipient) errors.push("Recipient address is not set");
if (amount <= 0) errors.push("Amount must be greater than 0");
if (BigNumber(amount).lte(0)) errors.push("Amount must be greater than 0");

@@ -54,0 +56,0 @@ if (errors.length > 0) throw new Error(errors.join(", "));

import BigNumber from "bignumber.js";
import { Token } from "aptos-tool";
BigNumber.config({ EXPONENTIAL_AT: 1e9 });

@@ -11,3 +12,3 @@ export function encodeBscRecipient(recipient: string): number[] {

export function calculateBridgeAmount(
amount: number,
amount: number | string,
decimals: number

@@ -14,0 +15,0 @@ ): string {