diff --git a/.eslintrc.json b/.eslintrc.json
index 70a34c24b..0cec7246b 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -24,10 +24,7 @@
{ "allowWholeFile": true }
],
"eslint-comments/no-unused-disable": "error",
- "import/order": [
- "error",
- { "alphabetize": { "order": "asc" } }
- ],
+ "import/order": ["error", { "alphabetize": { "order": "asc" } }],
"sort-imports": [
"error",
{ "ignoreDeclarationSort": true, "ignoreCase": true }
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 000000000..1bec86e53
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,45 @@
+# .github/workflows/publish.yml
+name: Generate a build and push to another branch
+
+on:
+ push:
+ branches:
+ - "*"
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ name: Build and Push
+ steps:
+ - name: git-checkout
+ uses: actions/checkout@v2
+
+ - name: setup node.js
+ uses: actions/setup-node@v2.4.0
+ with:
+ node-version: 16.x
+ # cache: yarn
+ # cache-dependency-path: yarn.lock
+
+ - name: dep
+ run: yarn
+
+ - name: build
+ run: yarn build
+
+ - name: Generate Docs
+ run: npx typedoc --out docs src/index.ts
+
+ - name: prepare package
+ run: mkdir out && mv package.json out && mv dist out && mv README.md out && mv LICENSE out && mv docs out
+
+ - name: Prepare Production Release
+ uses: s0/git-publish-subdir-action@develop
+ if: ${{ github.ref == 'refs/heads/production' }}
+ env:
+ REPO: self
+ BRANCH: bleeding-edge
+ FOLDER: out
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ MESSAGE: "Build: ({sha}) {msg}"
diff --git a/.gitignore b/.gitignore
index 6d104f94e..ad6445214 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,8 +2,12 @@
build
node_modules
test
+dist
src/**.js
coverage
*.log
tsconfig.tsbuildinfo
-dist/docs
+src/test.ts
+.env*
+test*
+*.DS_Store
diff --git a/.husky/pre-commit b/.husky/pre-commit
new file mode 100755
index 000000000..0da96d6ba
--- /dev/null
+++ b/.husky/pre-commit
@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+npx pretty-quick --staged
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000000000..25fa6215f
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "typescript.tsdk": "node_modules/typescript/lib"
+}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000000000..7abdc74c8
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) 2021 XP.network
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
index e69de29bb..a6468b367 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,667 @@
+
+
+# XP Network JS API
+
+
+
+### Work In Progress / Alpha Stage Library
+
+
+Bridging steps:
+
+
+- [x] [1. Installing the library](#1-install-the-libraries-required-for-the-project)
+- [x] [2. Importing the dependencies](#2-import-the-dependencies)
+- [x] [3. Getting the signer objects](#3-get-the-signer-objects)
+ - [x] [3.1 Backend unsafe signer](#31-example-of-getting-the-signer-object-for-manual-testing-in-the-be)
+ - [x] [3.2 EVM compatible browser extension signer](#32-example-of-getting-the-signer-object-in-the-fe-for-web3)
+ - [x] [3.3 Elrond signer](#33-example-of-getting-the-signer-object-in-the-fe-for-metaversx)
+ - [x] [3.4 Tron signer](#34-example-of-getting-the-signer-object-in-the-fe-for-tron)
+ - [x] [3.5 Algorand signer](#35-example-of-getting-the-signer-object-in-the-fe-for-algorand)
+ - [x] [3.6 Tezos signer](#36-example-of-getting-the-signer-object-in-the-fe-for-tezos)
+ - [x] [3.7 Secret signer](#37-example-of-secret-network)
+ - [x] [3.8 TON signer](#38-example-signer-object-for-ton)
+- [x] [4. Getting the Chain's inner objects](#4-getting-the-inner-objects-from-this-factory-to-be-used-for-transferring-minting-estimation-of-gas-fees)
+- [x] [5. Listing NFTs](#51-listing-nfts-owned-by-the-sender)
+ - [x] [Example of a native NFT object](#52-example-of-console-logged-native-bsc-nft-object)
+ - [x] [Example of a wrapped NFT object](#53-example-of-the-console-logged-wrapped-nft-from-bsc-on-velas)
+- [x] [6. Approving](#6-approve-accessing-your-nft-by-the-bridge-smart-contract)
+- [x] [7. Transferring NFTs between chains](#7-transferring-an-nft)
+- [x] [Minting NFTs](#minting-nfts-on-evm-chains-metaversx--tron)(optional)
+- [x] [Estimating the TX fee on the target chain](#estimating-the-transaction-fee-on-the-target-chain) (optional)
+- [ ] ... and much more to come
+
+
+
+## To list and transfer NFTs, follow the steps below:
+
+
+
+
+Make sure [nodejs](https://nodejs.org/en/download/) is installed on your machine.
+
+
+### 1. Install the libraries required for the project:
+
+
+
+```bash
+yarn add xp.network
+```
+
+OR
+
+```bash
+npm i --save xp.network
+```
+
+To import the latest version of `xp.network` library:
+
+```bash
+yarn add "git+https://github.com/xp-network/xpjs#bleeding-edge"
+```
+
+
+
+### 2. Import the dependencies
+
+```javascript
+import {
+ ChainFactoryConfigs,
+ ChainFactory,
+ Chain,
+ AppConfigs,
+ ChainParams,
+} from "xp.network";
+import { config } from 'dotenv';
+config();
+
+(async () => {
+ // Instantiate the chain factory for the
+ // Connecting to the mainnnets of all the blockchains:
+ const mainnetConfig = await ChainFactoryConfigs.MainNet();
+ const mainnetFactory: ChainFactory = ChainFactory(
+ AppConfigs.MainNet(),
+ mainnetConfig
+ );
+
+ // Connecting to the testnets of all the blockchains:
+ const testnetConfig = await ChainFactoryConfigs.TestNet();
+ const testnetFactory: ChainFactory = ChainFactory(
+ AppConfigs.TestNet(),
+ testnetConfig
+ );
+
+ // Switching between the mainnets & the testnets:
+ const factory: ChainFactory = mainnetFactory; // or = testnetConfig;
+ const CONFIG: Partial = mainnetConfig; // or = testnetConfig;
+})();
+```
+
+
+
+## 3. Get the signer objects
+
+### 3.1 Example of getting the signer object (for manual EVM testing in the BE)
+
+Avoid using 3.1 setup in production. Use it for initial or backend testing only.
+
+
+Add your private key to the environment:
+
+```bash
+touch .env
+echo "SK=" >> .env
+```
+
+```javascript
+// EVM chains compatible wallet:
+import { Wallet } from "ethers";
+import { config } from 'dotenv';
+config();
+// EVM signer for testing in the BE
+const signer = new Wallet(
+ process.env.SK!,
+ // Replace 'polygonParams'
+ // with the relevant parameter
+ // from the table below
+ CONFIG.polygonParams?.provider
+ );
+```
+
+
+
+| Chain | Parameters | Chain Nonce |
+| :-----------: | :-------------: | :---------: |
+| Elrond | metaversxParams | 2 |
+| BSC | bscParams | 4 |
+| Ethereum | ropstenParams | 5 |
+| Avalanche | avalancheParams | 6 |
+| Polygon | polygonParams | 7 |
+| Fantom | fantomParams | 8 |
+| Tron | tronParams | 9 |
+| Harmony | harmonyParams | 12 |
+| xDai | xDaiParams | 14 |
+| Algorand | algorandParams | 15 |
+| Fuse | fuseParams | 16 |
+| Tezos | tezosParams | 18 |
+| Velas | velasParams | 19 |
+| Aurora | auroraParams | 21 |
+| Godwoken | godwokenParams | 22 |
+| Gatechain | gatechainParams | 23 |
+| VeChain | vechainParams | 25 |
+| Solana | solanaParams | 26 |
+| TON | tonParams | 27 |
+| DFinity | dfinityParams | 28 |
+| Hedera | hederaParams | 29 |
+| Skale | skaleParams | 30 |
+| NEAR | nearParams | 31 |
+| Moonbeam | moonbeamParams | 32 |
+| Abeychain | abeychainParams | 33 |
+| Aptos | aptosParams | 34 |
+| Caduceus | caduceusParams | 35 |
+| OKC | okcParams | 36 |
+| Arbitrum Nova | arbitrumParams | 37 |
+| Bitgert | bitgertParams | 38 |
+
+
+
+### 3.2 Example of getting the signer object (in the FE for web3):
+
+```typescript
+// EVM chains compatible signer:
+import ethers from "ethers";
+const signer = new ethers.providers.Web3Provider(window.ethereum).getSigner();
+```
+
+
+
+### 3.3 Example of getting the signer object (in the FE for Elrond):
+
+```typescript
+// ELROND provider (injected from the browser extension):
+import { ExtensionProvider } from "@metaversxnetwork/erdjs/out";
+const metaversxSigner = ExtensionProvider.getInstance();
+
+// Elrond signer from a PEM key stored in the .env file
+import { UserSigner } from "@metaversxnetwork/erdjs/out";
+const metaversxSigner = UserSigner.fromPem(process.env.ELROND_PEM!);
+```
+
+
+
+### 3.4 Example of getting the signer object (in the FE for Tron):
+
+```typescript
+// Address is fetched from tronweb
+(async () => {
+ const addresses = await window.tronLink.tronWeb.request({
+ method: "tron_requestAccounts",
+ });
+ const tronSigner = addresses[0];
+})();
+```
+
+### 3.5 Example of getting the signer object (in the FE for Algorand):
+
+```typescript
+import { typedAlgoSigner } from "xp.network/dist/helpers/algorand";
+// Use the typedAlgoSigner function to get access to the Algorand signer
+const algorandSigner = typedAlgoSigner();
+```
+
+### 3.6 Example of getting the signer object (in the FE for Tezos):
+
+```typescript
+import { TempleWallet } from "@temple-wallet/dapp";
+(async () => {
+ try {
+ const available = await TempleWallet.isAvailable();
+ if (!available) {
+ throw new Error("Temple Wallet is not installed");
+ }
+ const tezosSigner = new TempleWallet("bridge.xp.network");
+ } catch (error) {
+ console.error("Error:", error);
+ }
+})();
+```
+
+### 3.7 Example of Secret Network
+
+```typescript
+import { SecretNetworkClient, Wallet } from "secretjs";
+import { SecretNftInfo } from "xp.network/dist/helpers/secret";
+
+const wallet = new Wallet(process.env.mnemonic!);
+
+// Testnet example
+const client = await SecretNetworkClient.create({
+ chainId: "pulsar-2",
+ grpcWebUrl: TestNetRpcUri.SECRET,
+ wallet: wallet,
+ walletAddress: wallet.address,
+});
+```
+
+### 3.8 Example signer object for TON
+
+```ts
+import { config } from "dotenv";
+config();
+import {
+ AppConfigs,
+ Chain,
+ ChainFactory,
+ ChainFactoryConfigs,
+} from "xp.network";
+
+import { mnemonicToKeyPair } from "tonweb-mnemonic";
+
+(async () => {
+ const factory = ChainFactory(
+ AppConfigs.TestNet(),
+ await ChainFactoryConfigs.TestNet()
+ );
+
+ const ton = await factory.inner(Chain.TON);
+
+ const tonSigner = ton.tonKpWrapper(
+ // where TON_MNEMONIC="space separated mnemonic phrase ..."
+ await mnemonicToKeyPair(process.env.TON_MNEMONIC!.split())
+ );
+})();
+```
+
+
+
+For the ways of connecting the wallets in the FE check-out our [bridge repository](https://github.com/xp-network/bridge-interface/blob/components-reorder/src/components/ConnectWallet.jsx)
+
+
+
+### 4. Getting the inner objects from this factory to be used for transferring, minting, and estimation of gas fees.
+
+```javascript
+(async () => {
+ // EVM compatible chains:
+ // Inner Object ====================================== Chain Nonce
+ const bsc = await factory.inner(Chain.BSC); // 4
+ const ethereum = await factory.inner(Chain.ETHEREUM); // 5
+ const avax = await factory.inner(Chain.AVALANCHE); // 6
+ const polygon = await factory.inner(Chain.POLYGON); // 7
+ const fantom = await factory.inner(Chain.FANTOM); // 8
+ const harmony = await factory.inner(Chain.HARMONY); // 12
+ const gnosis = await factory.inner(Chain.XDAI); // 14
+ const fuse = await factory.inner(Chain.FUSE); // 16
+ const velas = await factory.inner(Chain.VELAS); // 19
+ const aurora = await factory.inner(Chain.AURORA); // 21
+ const godwoken = await factory.inner(Chain.GODWOKEN); // 22
+ const gatechain = await factory.inner(Chain.GATECHAIN); // 23
+ const vechain = await factory.inner(Chain.VECHAIN); // 25
+ const hedera = await factory.inner(Chain.HEDERA); // 29
+ const skale = await factory.inner(Chain.SKALE); // 30
+ const moonbeam = await factory.inner(Chain.MOONBEAM); // 32
+ const abeychain = await factory.inner(Chain.ABEYCHAIN); // 33
+ const causeus = await factory.inner(Chain.CADUCEUS); //35
+ const okc = await factory.inner(Chain.OKC); //36
+ const arbitrum = await factory.inner(Chain.ARBITRUM); //37
+ const bitgert = await factory.inner(Chain.BITGERT); //38
+
+ // Non-EVM chains:
+ // Inner Object ====================================== Chain Nonce
+ const metaversx = await factory.inner(Chain.ELROND); // 2
+ const tron = await factory.inner(Chain.TRON); // 9
+ const algorand = await factory.inner(Chain.ALGORAND); // 15
+ const tezos = await factory.inner(Chain.TEZOS); // 18
+ const secret = await factory.inner(Chain.SECRET); // 24
+ const solana = await factory.inner(Chain.SOLANA); // 26
+ const ton = await factory.inner(Chain.TON); // 27
+ const dfinity = await factory.inner(Chain.DFINITY); // 28
+ const near = await factory.inner(Chain.NEAR); // 31
+ const aptos = await factory.inner(Chain.APTOS); //34
+})();
+```
+
+
+
+### 5.1 Listing NFTs Owned by the sender.
+
+This operation does not depend on a wallet since reading operations are free and, therefore, do not require signing.
+
+
+```javascript
+(async () => {
+ // EVM:
+ const web3Nfts = await factory.nftList(
+ harmony, // The chain of interest
+ "0x...." // The public key of the NFT owner in a web3 chain
+ );
+
+ // Elrond:
+ const metaversxNfts = await factory.nftList(
+ metaversx, // The chain of interest
+ "erd1...." // The public key of the NFT owner in Elrond
+ );
+
+ // Tron:
+ const tronNfts = await factory.nftList(
+ tron, // The chain of interest
+ "TJuG..." // The public key of the NFT owner in Tron
+ );
+
+ // Algorand:
+ const algoNfts = factory.nftList(
+ algorand, // Algorand chain internal object
+ "PUPTH..." // The public key of the NFT owner in Algorand
+ );
+
+ // Tezos:
+ const tezosNfts = await factory.nftList(
+ tezos, // Tezos chain internal object
+ "EQB..." // The public key of the NFT owner in Tezos
+ );
+
+ // Secret:
+ const secretNfts = await factory.nftList(
+ secret, // Secret chain internal object
+ "secret1..." // The public key of the NFT owner in Secret
+ );
+
+ // TON:
+ const tonNfts = await factory.nftList(
+ ton, // TON chain internal object
+ "tz1..." // The public key of the NFT owner in TON
+ );
+})();
+```
+
+```javascript
+// Choosing an NFT to transfer:
+const web3ChosenOne = web3Nfts[0];
+const metaversxChosenOne = metaversxNfts[0];
+const tronChosenOne = tronNfts[0];
+const algoChosenOne = algoNfts[0];
+const tezosChosenOne = tezosNfts[0];
+const secretChosenOne = secretNfts[0];
+const tonChosenOne = tonNfts[0];
+
+// Checking the selected NFT object
+console.log("EVM Selected NFT: ", web3ChosenOne);
+console.log("Elrond Selected NFT: ", metaversxChosenOne);
+console.log("Tron Selected NFT: ", tronChosenOne);
+console.log("Algorand Selected NFT: ", algoChosenOne);
+console.log("Tezos Selected NFT: ", tezosChosenOne);
+console.log("Secret Selected NFT: ", secretChosenOne);
+console.log("Ton Selected NFT: ", tonChosenOne);
+```
+
+### 5.2 Example of console logged native BSC NFT object:
+
+```json
+{
+ "uri": "https://api.alturanft.com/meta/chain-caders/",
+ "native": {
+ "chainId": "4", // ChainId (4 = BSC)
+ "tokenId": "2639", // ID in the NFT smart contract
+ "contract": "0x387d38eEaaa7F1235c00aE6ee9b1462c026007f4",
+ "owner": "0x6449b68cc5675f6011e8DB681B142773A3157cb9",
+ "uri": "https://api.alturanft.com/meta/chain-caders/",
+ "symbol": null,
+ "name": "ChainCaders", // Collection Name
+ "contractType": "ERC1155"
+ },
+ "collectionIdent": "0x387d38eeaaa7f1235c00ae6ee9b1462c026007f4"
+}
+```
+
+### 5.3 Example of the console logged wrapped NFT
+
+```json
+{
+ "uri": "https://nft.xp.network/w/30576349324667796398547334318",
+ "native": {
+ "chainId": "4", // Original chainId
+ "tokenId": "30576349324667796398547334318", // Wrapped ID
+ "contract": "0x8Ae5Fa4DDb131695CDe906BE03b33ebb277DF9A4", // Original Owner
+ "owner": "0x6449b68cc5675f6011e8DB681B142773A3157cb9",
+ "uri": "https://nft.xp.network/w/30576349324667796398547334318", // Original URI
+ "symbol": "vr3DNFTs", // Custom collection name
+ "name": "Virtual Reality 3D NFTs", // Custom collection name
+ "contractType": "ERC721"
+ },
+ "collectionIdent": "0x8ae5fa4ddb131695cde906be03b33ebb277df9a4"
+}
+```
+
+
+
+### 6. Approve accessing your NFT by the bridge smart contract
+
+```javascript
+(async () => {
+ // EVM example
+ const isApprovedEVM = await harmony.approveForMinter(web3ChosenOne, signer);
+ console.log("Is Approved in an EVM:", isApprovedEVM);
+
+ // Elrond example
+ const isApprovedElrond = await metaversx.approveForMinter(
+ metaversxChosenOne,
+ metaversxSigner
+ );
+ console.log("Is Approved in Elrond:", isApprovedElrond);
+
+ // Tron example
+ const isApprovedTron = await metaversx.approveForMinter(
+ tronChosenOne,
+ tronSigner
+ );
+ console.log("Is Approved in Tron:", isApprovedTron);
+
+ // Algorand example
+ const isApprovedAlgorand = await algorand.approveForMinter(
+ algoChosenOne,
+ algorandSigner
+ );
+ console.log("Is Approved in Algorand:", isApprovedAlgorand);
+
+ // Tezos example
+ const isApprovedTezos = await algorand.approveForMinter(
+ tezosChosenOne,
+ tezosSigner
+ );
+ console.log("Is Approved in Tezos:", isApprovedTezos);
+
+ // Secret example
+ const secretApprove = await scrt.preTransfer(
+ client,
+ chosenOne,
+ new BigNumber(0)
+ );
+ console.log("Approved for Secret:", secretApprove);
+
+ // TON
+ // Approval is not required in TON...
+})();
+```
+
+
+
+### 7. Transferring an NFT
+
+```javascript
+(async () => {
+ // EVM compatible chains example:
+ const web3Result = await factory.transferNft(
+ harmony, // The Source Chain.
+ bsc, // The Destination Chain.
+ theChosenOne, // The NFT object you have chosen from the list.
+ signer, // The web3 signer object (see p. 3.2 above).
+ "ADDRESS OF THE RECEIVER" // The address whom you are transferring the NFT to.
+ );
+ console.log(web3Result);
+
+ // Elrond example:
+ const metaversxResult = await factory.transferNft(
+ metaversx, // The Source Chain.
+ tron, // The Destination Chain.
+ metaversxChosenOne, // The NFT object you have chosen from the list.
+ metaversxSigner, // The Elrond signer object (see p. 3.3 above).
+ "ADDRESS OF THE RECEIVER" // The address whom you are transferring the NFT to.
+ );
+ console.log(metaversxResult);
+
+ // Tron example:
+ const tronResult = await factory.transferNft(
+ tron, // The Source Chain.
+ metaversx, // The Destination Chain.
+ tronChosenOne, // The NFT object you have chosen from the list.
+ tronSigner, // The Tron signer object (see p. 3.4 above).
+ "ADDRESS OF THE RECEIVER" // The address whom you are transferring the NFT to.
+ );
+ console.log(tronResult);
+
+ // Algorand example:
+ const algorandResult = await factory.transferNft(
+ algorand, // The Source Chain.
+ metaversx, // The Destination Chain.
+ algoChosenOne, // The NFT object you have chosen from the list.
+ algorandSigner, // The Tron signer object (see p. 3.5 above).
+ "ADDRESS OF THE RECEIVER" // The address whom you are transferring the NFT to.
+ );
+ console.log(algorandResult);
+
+ // Tezos example:
+ const tezosResult = await factory.transferNft(
+ tezos, // The Source Chain.
+ velas, // The Destination Chain.
+ tezosChosenOne, // Or the NFT object you have chosen from the list.
+ tezosrandSigner, // The Tron signer object (see p. 3.5 above).
+ "ADDRESS OF THE RECEIVER" // The address whom you are transferring the NFT to.
+ );
+ console.log(tezosResult);
+
+ // TON example:
+ const tonResult = await factory.transferNft(
+ ton, // The Source Chain.
+ abeychain, // The Destination Chain.
+ tonChosenOne, // Or the NFT object you have chosen from the list.
+ tonSigner, // The Tron signer object (see p. 3.5 above).
+ "ADDRESS OF THE RECEIVER" // The address whom you are transferring the NFT to.
+ );
+ console.log(tonResult);
+})();
+```
+
+
+
+## Minting NFTs on EVM chains, Elrond & Tron
+
+
+
+
+- Just call the mint function on the factory with suitable arguments.
+
+
+
+1. For Web3 Chains:
+
+```javascript
+(async () => {
+ // Web3Provider generally refers to a walletProvider like Metamask.
+ const receipt = await factory.mint(
+ avax, // The chain where to mint
+ signer, // The browser injected signer
+ {
+ // Could be an IPFS URL or Any URL that points to a Metadata
+ uris: [metadata.url],
+ // Description of your NFT. Can be an object.
+ attrs: description,
+ // A name that defines your NFT.
+ name: name,
+ // The contract with which you want to mint the NFT.
+ contract: "Can be fetched from the mainnetConfig or testnetConfig",
+ }
+ );
+})();
+```
+
+
+
+2. For Elrond:
+
+```javascript
+(async () => {
+ // Deploying ESDTs:
+ const response = await metaversx.issueESDTNft(
+ metaversxSigner,
+ "Target",
+ "TGT",
+ true, // canFreeze
+ true, // canWipe
+ true // canTransferNftCreateRole
+ );
+
+ // Checking whether ESDTs exist for this account
+ const esdts = await metaversx.mintableEsdts(
+ metaversxSigner.getAddress())
+ .catch((e) => {
+ console.log("Failed to get Mintable ESDTs", e)
+ return undefined
+ })
+
+ const identifier = esdts ? esdts[0]: undefined;
+
+ if (!identifier) {
+ throw new Error("No ESDT found for this address");
+ }
+
+ // Minting an NFT to an ESDT
+ const response = await metaversx.mintNft(
+ metaversxSigner,
+ {
+ identifier, // Your ESDT token
+ quantity: 1, // How many tokens you want to mint > 0
+ name: "Your token name goes here",
+ uris: ["replace with your link(s)"],
+ } as any);
+
+ console.log(response)
+})();
+```
+
+
+
+3. For Tron:
+
+```javascript
+const receipt = await factory.mint(avax, tronSigner, {
+ // Could be an IPFS URL or Any URL that points to a Metadata
+ uris: [metadata.url],
+ // Description of your NFT. Can be an object.
+ attrs: description,
+ // A name that defines your NFT.
+ name: name,
+ // The contract with which you want to mint the NFT.
+ contract: "Can be fetched from the mainnetConfig or testnetConfig",
+});
+```
+
+
+
+P.S. The library is a work in progress. More features will be added soon.
+
+
+
+## Estimating the transaction fee on the target chain
+
+```typescript
+(async () => {
+ const feeEstimation = await factory.estimateFees(
+ algorand, // The Source Chain.
+ tezos, // The Destination Chain.
+ algoChosenOne, // The NFT object you have chosen from the list.
+ "tz1..." // The public key of the NFT owner in Tezos
+ );
+ console.log(`The estimated fee on Tezos is: ${feeEstimation} Algos`);
+})();
+```
diff --git a/dist/XPNet.json b/dist/XPNet.json
deleted file mode 100644
index b6648ba2d..000000000
--- a/dist/XPNet.json
+++ /dev/null
@@ -1,444 +0,0 @@
-{
- "_format": "hh-sol-artifact-1",
- "contractName": "XPNet",
- "sourceName": "contracts/XPNet.sol",
- "abi": [
- {
- "inputs": [],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "bool",
- "name": "approved",
- "type": "bool"
- }
- ],
- "name": "ApprovalForAll",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "previousOwner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "OwnershipTransferred",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- },
- {
- "indexed": false,
- "internalType": "uint256[]",
- "name": "values",
- "type": "uint256[]"
- }
- ],
- "name": "TransferBatch",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "TransferSingle",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": false,
- "internalType": "string",
- "name": "value",
- "type": "string"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "URI",
- "type": "event"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "balanceOf",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address[]",
- "name": "accounts",
- "type": "address[]"
- },
- {
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- }
- ],
- "name": "balanceOfBatch",
- "outputs": [
- {
- "internalType": "uint256[]",
- "name": "",
- "type": "uint256[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "burn",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "operator",
- "type": "address"
- }
- ],
- "name": "isApprovedForAll",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "mint",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "renounceOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- },
- {
- "internalType": "uint256[]",
- "name": "amounts",
- "type": "uint256[]"
- },
- {
- "internalType": "bytes",
- "name": "data",
- "type": "bytes"
- }
- ],
- "name": "safeBatchTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- },
- {
- "internalType": "bytes",
- "name": "data",
- "type": "bytes"
- }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "internalType": "bool",
- "name": "approved",
- "type": "bool"
- }
- ],
- "name": "setApprovalForAll",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "string",
- "name": "uri_",
- "type": "string"
- }
- ],
- "name": "setURI",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes4",
- "name": "interfaceId",
- "type": "bytes4"
- }
- ],
- "name": "supportsInterface",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "transferOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "uri",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }
- ],
- "bytecode": "0x60806040523480156200001157600080fd5b506040518060200160405280600081525062000033816200005a60201b60201c565b5062000054620000486200007660201b60201c565b6200007e60201b60201c565b62000259565b80600290805190602001906200007292919062000144565b5050565b600033905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8280546200015290620001f4565b90600052602060002090601f016020900481019282620001765760008555620001c2565b82601f106200019157805160ff1916838001178555620001c2565b82800160010185558215620001c2579182015b82811115620001c1578251825591602001919060010190620001a4565b5b509050620001d19190620001d5565b5090565b5b80821115620001f0576000816000905550600101620001d6565b5090565b600060028204905060018216806200020d57607f821691505b602082108114156200022457620002236200022a565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6133c680620002696000396000f3fe608060405234801561001057600080fd5b50600436106100e95760003560e01c8063862440e21161008c578063e985e9c511610066578063e985e9c514610246578063f242432a14610276578063f2fde38b14610292578063f5298aca146102ae576100e9565b8063862440e2146101f05780638da5cb5b1461020c578063a22cb4651461022a576100e9565b8063156e29f6116100c8578063156e29f61461017e5780632eb2c2d61461019a5780634e1273f4146101b6578063715018a6146101e6576100e9565b8062fdd58e146100ee57806301ffc9a71461011e5780630e89341c1461014e575b600080fd5b610108600480360381019061010391906121ed565b6102ca565b6040516101159190612a3b565b60405180910390f35b610138600480360381019061013391906122e4565b610393565b604051610145919061281e565b60405180910390f35b61016860048036038101906101639190612336565b610475565b6040516101759190612839565b60405180910390f35b61019860048036038101906101939190612229565b61051a565b005b6101b460048036038101906101af9190612063565b6105b6565b005b6101d060048036038101906101cb9190612278565b610657565b6040516101dd91906127c5565b60405180910390f35b6101ee610808565b005b61020a6004803603810190610205919061235f565b610890565b005b610214610934565b60405161022191906126e8565b60405180910390f35b610244600480360381019061023f91906121b1565b61095e565b005b610260600480360381019061025b9190612027565b610adf565b60405161026d919061281e565b60405180910390f35b610290600480360381019061028b9190612122565b610b73565b005b6102ac60048036038101906102a79190611ffe565b610c14565b005b6102c860048036038101906102c39190612229565b610d0c565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561033b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103329061289b565b60405180910390fd5b60008083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061045e57507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061046e575061046d82610d98565b5b9050919050565b606060046000838152602001908152602001600020805461049590612caa565b80601f01602080910402602001604051908101604052809291908181526020018280546104c190612caa565b801561050e5780601f106104e35761010080835404028352916020019161050e565b820191906000526020600020905b8154815290600101906020018083116104f157829003601f168201915b50505050509050919050565b610522610e02565b73ffffffffffffffffffffffffffffffffffffffff16610540610934565b73ffffffffffffffffffffffffffffffffffffffff1614610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d9061299b565b60405180910390fd5b6105b183838360405180602001604052806000815250610e0a565b505050565b6105be610e02565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614806106045750610603856105fe610e02565b610adf565b5b610643576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063a9061293b565b60405180910390fd5b6106508585858585610fa0565b5050505050565b6060815183511461069d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610694906129db565b60405180910390fd5b6000835167ffffffffffffffff8111156106e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561070e5781602001602082028036833780820191505090505b50905060005b84518110156107fd576107a7858281518110610759577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015185838151811061079a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516102ca565b8282815181106107e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018181525050806107f690612d0d565b9050610714565b508091505092915050565b610810610e02565b73ffffffffffffffffffffffffffffffffffffffff1661082e610934565b73ffffffffffffffffffffffffffffffffffffffff1614610884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087b9061299b565b60405180910390fd5b61088e6000611300565b565b610898610e02565b73ffffffffffffffffffffffffffffffffffffffff166108b6610934565b73ffffffffffffffffffffffffffffffffffffffff161461090c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109039061299b565b60405180910390fd5b818160046000868152602001908152602001600020919061092e929190611d14565b50505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b8173ffffffffffffffffffffffffffffffffffffffff1661097d610e02565b73ffffffffffffffffffffffffffffffffffffffff1614156109d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109cb906129bb565b60405180910390fd5b80600160006109e1610e02565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16610a8e610e02565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610ad3919061281e565b60405180910390a35050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610b7b610e02565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610bc15750610bc085610bbb610e02565b610adf565b5b610c00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf7906128fb565b60405180910390fd5b610c0d85858585856113c6565b5050505050565b610c1c610e02565b73ffffffffffffffffffffffffffffffffffffffff16610c3a610934565b73ffffffffffffffffffffffffffffffffffffffff1614610c90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c879061299b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610d00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf7906128bb565b60405180910390fd5b610d0981611300565b50565b610d14610e02565b73ffffffffffffffffffffffffffffffffffffffff16610d32610934565b73ffffffffffffffffffffffffffffffffffffffff1614610d88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7f9061299b565b60405180910390fd5b610d93838383611648565b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610e7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7190612a1b565b60405180910390fd5b6000610e84610e02565b9050610ea581600087610e9688611865565b610e9f88611865565b8761192b565b8260008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f049190612b9e565b925050819055508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051610f82929190612a56565b60405180910390a4610f9981600087878787611933565b5050505050565b8151835114610fe4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fdb906129fb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611054576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104b9061291b565b60405180910390fd5b600061105e610e02565b905061106e81878787878761192b565b60005b845181101561126b5760008582815181106110b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060008583815181106110fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600080600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561119b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111929061297b565b60405180910390fd5b81810360008085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112509190612b9e565b925050819055505050508061126490612d0d565b9050611071565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516112e29291906127e7565b60405180910390a46112f8818787878787611b1a565b505050505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611436576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142d9061291b565b60405180910390fd5b6000611440610e02565b905061146081878761145188611865565b61145a88611865565b8761192b565b600080600086815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156114f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ee9061297b565b60405180910390fd5b83810360008087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508360008087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546115ac9190612b9e565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628888604051611629929190612a56565b60405180910390a461163f828888888888611933565b50505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116af9061295b565b60405180910390fd5b60006116c2610e02565b90506116f2818560006116d487611865565b6116dd87611865565b6040518060200160405280600081525061192b565b600080600085815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015611789576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611780906128db565b60405180910390fd5b82810360008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051611856929190612a56565b60405180910390a45050505050565b60606000600167ffffffffffffffff8111156118aa577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156118d85781602001602082028036833780820191505090505b5090508281600081518110611916577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101818152505080915050919050565b505050505050565b6119528473ffffffffffffffffffffffffffffffffffffffff16611d01565b15611b12578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b815260040161199895949392919061276b565b602060405180830381600087803b1580156119b257600080fd5b505af19250505080156119e357506040513d601f19601f820116820180604052508101906119e0919061230d565b60015b611a89576119ef612de3565b806308c379a01415611a4c5750611a0461329e565b80611a0f5750611a4e565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a439190612839565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a809061285b565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611b10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b079061287b565b60405180910390fd5b505b505050505050565b611b398473ffffffffffffffffffffffffffffffffffffffff16611d01565b15611cf9578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b8152600401611b7f959493929190612703565b602060405180830381600087803b158015611b9957600080fd5b505af1925050508015611bca57506040513d601f19601f82011682018060405250810190611bc7919061230d565b60015b611c7057611bd6612de3565b806308c379a01415611c335750611beb61329e565b80611bf65750611c35565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2a9190612839565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c679061285b565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611cf7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cee9061287b565b60405180910390fd5b505b505050505050565b600080823b905060008111915050919050565b828054611d2090612caa565b90600052602060002090601f016020900481019282611d425760008555611d89565b82601f10611d5b57803560ff1916838001178555611d89565b82800160010185558215611d89579182015b82811115611d88578235825591602001919060010190611d6d565b5b509050611d969190611d9a565b5090565b5b80821115611db3576000816000905550600101611d9b565b5090565b6000611dca611dc584612aa4565b612a7f565b90508083825260208201905082856020860282011115611de957600080fd5b60005b85811015611e195781611dff8882611ecd565b845260208401935060208301925050600181019050611dec565b5050509392505050565b6000611e36611e3184612ad0565b612a7f565b90508083825260208201905082856020860282011115611e5557600080fd5b60005b85811015611e855781611e6b8882611fe9565b845260208401935060208301925050600181019050611e58565b5050509392505050565b6000611ea2611e9d84612afc565b612a7f565b905082815260208101848484011115611eba57600080fd5b611ec5848285612c68565b509392505050565b600081359050611edc81613334565b92915050565b600082601f830112611ef357600080fd5b8135611f03848260208601611db7565b91505092915050565b600082601f830112611f1d57600080fd5b8135611f2d848260208601611e23565b91505092915050565b600081359050611f458161334b565b92915050565b600081359050611f5a81613362565b92915050565b600081519050611f6f81613362565b92915050565b600082601f830112611f8657600080fd5b8135611f96848260208601611e8f565b91505092915050565b60008083601f840112611fb157600080fd5b8235905067ffffffffffffffff811115611fca57600080fd5b602083019150836001820283011115611fe257600080fd5b9250929050565b600081359050611ff881613379565b92915050565b60006020828403121561201057600080fd5b600061201e84828501611ecd565b91505092915050565b6000806040838503121561203a57600080fd5b600061204885828601611ecd565b925050602061205985828601611ecd565b9150509250929050565b600080600080600060a0868803121561207b57600080fd5b600061208988828901611ecd565b955050602061209a88828901611ecd565b945050604086013567ffffffffffffffff8111156120b757600080fd5b6120c388828901611f0c565b935050606086013567ffffffffffffffff8111156120e057600080fd5b6120ec88828901611f0c565b925050608086013567ffffffffffffffff81111561210957600080fd5b61211588828901611f75565b9150509295509295909350565b600080600080600060a0868803121561213a57600080fd5b600061214888828901611ecd565b955050602061215988828901611ecd565b945050604061216a88828901611fe9565b935050606061217b88828901611fe9565b925050608086013567ffffffffffffffff81111561219857600080fd5b6121a488828901611f75565b9150509295509295909350565b600080604083850312156121c457600080fd5b60006121d285828601611ecd565b92505060206121e385828601611f36565b9150509250929050565b6000806040838503121561220057600080fd5b600061220e85828601611ecd565b925050602061221f85828601611fe9565b9150509250929050565b60008060006060848603121561223e57600080fd5b600061224c86828701611ecd565b935050602061225d86828701611fe9565b925050604061226e86828701611fe9565b9150509250925092565b6000806040838503121561228b57600080fd5b600083013567ffffffffffffffff8111156122a557600080fd5b6122b185828601611ee2565b925050602083013567ffffffffffffffff8111156122ce57600080fd5b6122da85828601611f0c565b9150509250929050565b6000602082840312156122f657600080fd5b600061230484828501611f4b565b91505092915050565b60006020828403121561231f57600080fd5b600061232d84828501611f60565b91505092915050565b60006020828403121561234857600080fd5b600061235684828501611fe9565b91505092915050565b60008060006040848603121561237457600080fd5b600061238286828701611fe9565b935050602084013567ffffffffffffffff81111561239f57600080fd5b6123ab86828701611f9f565b92509250509250925092565b60006123c383836126ca565b60208301905092915050565b6123d881612bf4565b82525050565b60006123e982612b3d565b6123f38185612b6b565b93506123fe83612b2d565b8060005b8381101561242f57815161241688826123b7565b975061242183612b5e565b925050600181019050612402565b5085935050505092915050565b61244581612c06565b82525050565b600061245682612b48565b6124608185612b7c565b9350612470818560208601612c77565b61247981612e05565b840191505092915050565b600061248f82612b53565b6124998185612b8d565b93506124a9818560208601612c77565b6124b281612e05565b840191505092915050565b60006124ca603483612b8d565b91506124d582612e23565b604082019050919050565b60006124ed602883612b8d565b91506124f882612e72565b604082019050919050565b6000612510602b83612b8d565b915061251b82612ec1565b604082019050919050565b6000612533602683612b8d565b915061253e82612f10565b604082019050919050565b6000612556602483612b8d565b915061256182612f5f565b604082019050919050565b6000612579602983612b8d565b915061258482612fae565b604082019050919050565b600061259c602583612b8d565b91506125a782612ffd565b604082019050919050565b60006125bf603283612b8d565b91506125ca8261304c565b604082019050919050565b60006125e2602383612b8d565b91506125ed8261309b565b604082019050919050565b6000612605602a83612b8d565b9150612610826130ea565b604082019050919050565b6000612628602083612b8d565b915061263382613139565b602082019050919050565b600061264b602983612b8d565b915061265682613162565b604082019050919050565b600061266e602983612b8d565b9150612679826131b1565b604082019050919050565b6000612691602883612b8d565b915061269c82613200565b604082019050919050565b60006126b4602183612b8d565b91506126bf8261324f565b604082019050919050565b6126d381612c5e565b82525050565b6126e281612c5e565b82525050565b60006020820190506126fd60008301846123cf565b92915050565b600060a08201905061271860008301886123cf565b61272560208301876123cf565b818103604083015261273781866123de565b9050818103606083015261274b81856123de565b9050818103608083015261275f818461244b565b90509695505050505050565b600060a08201905061278060008301886123cf565b61278d60208301876123cf565b61279a60408301866126d9565b6127a760608301856126d9565b81810360808301526127b9818461244b565b90509695505050505050565b600060208201905081810360008301526127df81846123de565b905092915050565b6000604082019050818103600083015261280181856123de565b9050818103602083015261281581846123de565b90509392505050565b6000602082019050612833600083018461243c565b92915050565b600060208201905081810360008301526128538184612484565b905092915050565b60006020820190508181036000830152612874816124bd565b9050919050565b60006020820190508181036000830152612894816124e0565b9050919050565b600060208201905081810360008301526128b481612503565b9050919050565b600060208201905081810360008301526128d481612526565b9050919050565b600060208201905081810360008301526128f481612549565b9050919050565b600060208201905081810360008301526129148161256c565b9050919050565b600060208201905081810360008301526129348161258f565b9050919050565b60006020820190508181036000830152612954816125b2565b9050919050565b60006020820190508181036000830152612974816125d5565b9050919050565b60006020820190508181036000830152612994816125f8565b9050919050565b600060208201905081810360008301526129b48161261b565b9050919050565b600060208201905081810360008301526129d48161263e565b9050919050565b600060208201905081810360008301526129f481612661565b9050919050565b60006020820190508181036000830152612a1481612684565b9050919050565b60006020820190508181036000830152612a34816126a7565b9050919050565b6000602082019050612a5060008301846126d9565b92915050565b6000604082019050612a6b60008301856126d9565b612a7860208301846126d9565b9392505050565b6000612a89612a9a565b9050612a958282612cdc565b919050565b6000604051905090565b600067ffffffffffffffff821115612abf57612abe612db4565b5b602082029050602081019050919050565b600067ffffffffffffffff821115612aeb57612aea612db4565b5b602082029050602081019050919050565b600067ffffffffffffffff821115612b1757612b16612db4565b5b612b2082612e05565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ba982612c5e565b9150612bb483612c5e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612be957612be8612d56565b5b828201905092915050565b6000612bff82612c3e565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015612c95578082015181840152602081019050612c7a565b83811115612ca4576000848401525b50505050565b60006002820490506001821680612cc257607f821691505b60208210811415612cd657612cd5612d85565b5b50919050565b612ce582612e05565b810181811067ffffffffffffffff82111715612d0457612d03612db4565b5b80604052505050565b6000612d1882612c5e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d4b57612d4a612d56565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060033d1115612e025760046000803e612dff600051612e16565b90505b90565b6000601f19601f8301169050919050565b60008160e01c9050919050565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206275726e20616d6f756e7420657863656564732062616c60008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b7f455243313135353a206275726e2066726f6d20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b600060443d10156132ae57613331565b6132b6612a9a565b60043d036004823e80513d602482011167ffffffffffffffff821117156132de575050613331565b808201805167ffffffffffffffff8111156132fc5750505050613331565b80602083010160043d038501811115613319575050505050613331565b61332882602001850186612cdc565b82955050505050505b90565b61333d81612bf4565b811461334857600080fd5b50565b61335481612c06565b811461335f57600080fd5b50565b61336b81612c12565b811461337657600080fd5b50565b61338281612c5e565b811461338d57600080fd5b5056fea26469706673582212207c954b474ba2938a61031705a0987bcb898a0dffe9cb3f5a8744e3e16585386e64736f6c63430008040033",
- "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100e95760003560e01c8063862440e21161008c578063e985e9c511610066578063e985e9c514610246578063f242432a14610276578063f2fde38b14610292578063f5298aca146102ae576100e9565b8063862440e2146101f05780638da5cb5b1461020c578063a22cb4651461022a576100e9565b8063156e29f6116100c8578063156e29f61461017e5780632eb2c2d61461019a5780634e1273f4146101b6578063715018a6146101e6576100e9565b8062fdd58e146100ee57806301ffc9a71461011e5780630e89341c1461014e575b600080fd5b610108600480360381019061010391906121ed565b6102ca565b6040516101159190612a3b565b60405180910390f35b610138600480360381019061013391906122e4565b610393565b604051610145919061281e565b60405180910390f35b61016860048036038101906101639190612336565b610475565b6040516101759190612839565b60405180910390f35b61019860048036038101906101939190612229565b61051a565b005b6101b460048036038101906101af9190612063565b6105b6565b005b6101d060048036038101906101cb9190612278565b610657565b6040516101dd91906127c5565b60405180910390f35b6101ee610808565b005b61020a6004803603810190610205919061235f565b610890565b005b610214610934565b60405161022191906126e8565b60405180910390f35b610244600480360381019061023f91906121b1565b61095e565b005b610260600480360381019061025b9190612027565b610adf565b60405161026d919061281e565b60405180910390f35b610290600480360381019061028b9190612122565b610b73565b005b6102ac60048036038101906102a79190611ffe565b610c14565b005b6102c860048036038101906102c39190612229565b610d0c565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561033b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103329061289b565b60405180910390fd5b60008083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061045e57507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061046e575061046d82610d98565b5b9050919050565b606060046000838152602001908152602001600020805461049590612caa565b80601f01602080910402602001604051908101604052809291908181526020018280546104c190612caa565b801561050e5780601f106104e35761010080835404028352916020019161050e565b820191906000526020600020905b8154815290600101906020018083116104f157829003601f168201915b50505050509050919050565b610522610e02565b73ffffffffffffffffffffffffffffffffffffffff16610540610934565b73ffffffffffffffffffffffffffffffffffffffff1614610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d9061299b565b60405180910390fd5b6105b183838360405180602001604052806000815250610e0a565b505050565b6105be610e02565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614806106045750610603856105fe610e02565b610adf565b5b610643576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063a9061293b565b60405180910390fd5b6106508585858585610fa0565b5050505050565b6060815183511461069d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610694906129db565b60405180910390fd5b6000835167ffffffffffffffff8111156106e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561070e5781602001602082028036833780820191505090505b50905060005b84518110156107fd576107a7858281518110610759577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015185838151811061079a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516102ca565b8282815181106107e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018181525050806107f690612d0d565b9050610714565b508091505092915050565b610810610e02565b73ffffffffffffffffffffffffffffffffffffffff1661082e610934565b73ffffffffffffffffffffffffffffffffffffffff1614610884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087b9061299b565b60405180910390fd5b61088e6000611300565b565b610898610e02565b73ffffffffffffffffffffffffffffffffffffffff166108b6610934565b73ffffffffffffffffffffffffffffffffffffffff161461090c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109039061299b565b60405180910390fd5b818160046000868152602001908152602001600020919061092e929190611d14565b50505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b8173ffffffffffffffffffffffffffffffffffffffff1661097d610e02565b73ffffffffffffffffffffffffffffffffffffffff1614156109d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109cb906129bb565b60405180910390fd5b80600160006109e1610e02565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16610a8e610e02565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610ad3919061281e565b60405180910390a35050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610b7b610e02565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610bc15750610bc085610bbb610e02565b610adf565b5b610c00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf7906128fb565b60405180910390fd5b610c0d85858585856113c6565b5050505050565b610c1c610e02565b73ffffffffffffffffffffffffffffffffffffffff16610c3a610934565b73ffffffffffffffffffffffffffffffffffffffff1614610c90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c879061299b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610d00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf7906128bb565b60405180910390fd5b610d0981611300565b50565b610d14610e02565b73ffffffffffffffffffffffffffffffffffffffff16610d32610934565b73ffffffffffffffffffffffffffffffffffffffff1614610d88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7f9061299b565b60405180910390fd5b610d93838383611648565b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610e7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7190612a1b565b60405180910390fd5b6000610e84610e02565b9050610ea581600087610e9688611865565b610e9f88611865565b8761192b565b8260008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f049190612b9e565b925050819055508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051610f82929190612a56565b60405180910390a4610f9981600087878787611933565b5050505050565b8151835114610fe4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fdb906129fb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611054576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104b9061291b565b60405180910390fd5b600061105e610e02565b905061106e81878787878761192b565b60005b845181101561126b5760008582815181106110b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060008583815181106110fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600080600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561119b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111929061297b565b60405180910390fd5b81810360008085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112509190612b9e565b925050819055505050508061126490612d0d565b9050611071565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516112e29291906127e7565b60405180910390a46112f8818787878787611b1a565b505050505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611436576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142d9061291b565b60405180910390fd5b6000611440610e02565b905061146081878761145188611865565b61145a88611865565b8761192b565b600080600086815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156114f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ee9061297b565b60405180910390fd5b83810360008087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508360008087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546115ac9190612b9e565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628888604051611629929190612a56565b60405180910390a461163f828888888888611933565b50505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116af9061295b565b60405180910390fd5b60006116c2610e02565b90506116f2818560006116d487611865565b6116dd87611865565b6040518060200160405280600081525061192b565b600080600085815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015611789576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611780906128db565b60405180910390fd5b82810360008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051611856929190612a56565b60405180910390a45050505050565b60606000600167ffffffffffffffff8111156118aa577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156118d85781602001602082028036833780820191505090505b5090508281600081518110611916577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101818152505080915050919050565b505050505050565b6119528473ffffffffffffffffffffffffffffffffffffffff16611d01565b15611b12578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b815260040161199895949392919061276b565b602060405180830381600087803b1580156119b257600080fd5b505af19250505080156119e357506040513d601f19601f820116820180604052508101906119e0919061230d565b60015b611a89576119ef612de3565b806308c379a01415611a4c5750611a0461329e565b80611a0f5750611a4e565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a439190612839565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a809061285b565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611b10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b079061287b565b60405180910390fd5b505b505050505050565b611b398473ffffffffffffffffffffffffffffffffffffffff16611d01565b15611cf9578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b8152600401611b7f959493929190612703565b602060405180830381600087803b158015611b9957600080fd5b505af1925050508015611bca57506040513d601f19601f82011682018060405250810190611bc7919061230d565b60015b611c7057611bd6612de3565b806308c379a01415611c335750611beb61329e565b80611bf65750611c35565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2a9190612839565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c679061285b565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611cf7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cee9061287b565b60405180910390fd5b505b505050505050565b600080823b905060008111915050919050565b828054611d2090612caa565b90600052602060002090601f016020900481019282611d425760008555611d89565b82601f10611d5b57803560ff1916838001178555611d89565b82800160010185558215611d89579182015b82811115611d88578235825591602001919060010190611d6d565b5b509050611d969190611d9a565b5090565b5b80821115611db3576000816000905550600101611d9b565b5090565b6000611dca611dc584612aa4565b612a7f565b90508083825260208201905082856020860282011115611de957600080fd5b60005b85811015611e195781611dff8882611ecd565b845260208401935060208301925050600181019050611dec565b5050509392505050565b6000611e36611e3184612ad0565b612a7f565b90508083825260208201905082856020860282011115611e5557600080fd5b60005b85811015611e855781611e6b8882611fe9565b845260208401935060208301925050600181019050611e58565b5050509392505050565b6000611ea2611e9d84612afc565b612a7f565b905082815260208101848484011115611eba57600080fd5b611ec5848285612c68565b509392505050565b600081359050611edc81613334565b92915050565b600082601f830112611ef357600080fd5b8135611f03848260208601611db7565b91505092915050565b600082601f830112611f1d57600080fd5b8135611f2d848260208601611e23565b91505092915050565b600081359050611f458161334b565b92915050565b600081359050611f5a81613362565b92915050565b600081519050611f6f81613362565b92915050565b600082601f830112611f8657600080fd5b8135611f96848260208601611e8f565b91505092915050565b60008083601f840112611fb157600080fd5b8235905067ffffffffffffffff811115611fca57600080fd5b602083019150836001820283011115611fe257600080fd5b9250929050565b600081359050611ff881613379565b92915050565b60006020828403121561201057600080fd5b600061201e84828501611ecd565b91505092915050565b6000806040838503121561203a57600080fd5b600061204885828601611ecd565b925050602061205985828601611ecd565b9150509250929050565b600080600080600060a0868803121561207b57600080fd5b600061208988828901611ecd565b955050602061209a88828901611ecd565b945050604086013567ffffffffffffffff8111156120b757600080fd5b6120c388828901611f0c565b935050606086013567ffffffffffffffff8111156120e057600080fd5b6120ec88828901611f0c565b925050608086013567ffffffffffffffff81111561210957600080fd5b61211588828901611f75565b9150509295509295909350565b600080600080600060a0868803121561213a57600080fd5b600061214888828901611ecd565b955050602061215988828901611ecd565b945050604061216a88828901611fe9565b935050606061217b88828901611fe9565b925050608086013567ffffffffffffffff81111561219857600080fd5b6121a488828901611f75565b9150509295509295909350565b600080604083850312156121c457600080fd5b60006121d285828601611ecd565b92505060206121e385828601611f36565b9150509250929050565b6000806040838503121561220057600080fd5b600061220e85828601611ecd565b925050602061221f85828601611fe9565b9150509250929050565b60008060006060848603121561223e57600080fd5b600061224c86828701611ecd565b935050602061225d86828701611fe9565b925050604061226e86828701611fe9565b9150509250925092565b6000806040838503121561228b57600080fd5b600083013567ffffffffffffffff8111156122a557600080fd5b6122b185828601611ee2565b925050602083013567ffffffffffffffff8111156122ce57600080fd5b6122da85828601611f0c565b9150509250929050565b6000602082840312156122f657600080fd5b600061230484828501611f4b565b91505092915050565b60006020828403121561231f57600080fd5b600061232d84828501611f60565b91505092915050565b60006020828403121561234857600080fd5b600061235684828501611fe9565b91505092915050565b60008060006040848603121561237457600080fd5b600061238286828701611fe9565b935050602084013567ffffffffffffffff81111561239f57600080fd5b6123ab86828701611f9f565b92509250509250925092565b60006123c383836126ca565b60208301905092915050565b6123d881612bf4565b82525050565b60006123e982612b3d565b6123f38185612b6b565b93506123fe83612b2d565b8060005b8381101561242f57815161241688826123b7565b975061242183612b5e565b925050600181019050612402565b5085935050505092915050565b61244581612c06565b82525050565b600061245682612b48565b6124608185612b7c565b9350612470818560208601612c77565b61247981612e05565b840191505092915050565b600061248f82612b53565b6124998185612b8d565b93506124a9818560208601612c77565b6124b281612e05565b840191505092915050565b60006124ca603483612b8d565b91506124d582612e23565b604082019050919050565b60006124ed602883612b8d565b91506124f882612e72565b604082019050919050565b6000612510602b83612b8d565b915061251b82612ec1565b604082019050919050565b6000612533602683612b8d565b915061253e82612f10565b604082019050919050565b6000612556602483612b8d565b915061256182612f5f565b604082019050919050565b6000612579602983612b8d565b915061258482612fae565b604082019050919050565b600061259c602583612b8d565b91506125a782612ffd565b604082019050919050565b60006125bf603283612b8d565b91506125ca8261304c565b604082019050919050565b60006125e2602383612b8d565b91506125ed8261309b565b604082019050919050565b6000612605602a83612b8d565b9150612610826130ea565b604082019050919050565b6000612628602083612b8d565b915061263382613139565b602082019050919050565b600061264b602983612b8d565b915061265682613162565b604082019050919050565b600061266e602983612b8d565b9150612679826131b1565b604082019050919050565b6000612691602883612b8d565b915061269c82613200565b604082019050919050565b60006126b4602183612b8d565b91506126bf8261324f565b604082019050919050565b6126d381612c5e565b82525050565b6126e281612c5e565b82525050565b60006020820190506126fd60008301846123cf565b92915050565b600060a08201905061271860008301886123cf565b61272560208301876123cf565b818103604083015261273781866123de565b9050818103606083015261274b81856123de565b9050818103608083015261275f818461244b565b90509695505050505050565b600060a08201905061278060008301886123cf565b61278d60208301876123cf565b61279a60408301866126d9565b6127a760608301856126d9565b81810360808301526127b9818461244b565b90509695505050505050565b600060208201905081810360008301526127df81846123de565b905092915050565b6000604082019050818103600083015261280181856123de565b9050818103602083015261281581846123de565b90509392505050565b6000602082019050612833600083018461243c565b92915050565b600060208201905081810360008301526128538184612484565b905092915050565b60006020820190508181036000830152612874816124bd565b9050919050565b60006020820190508181036000830152612894816124e0565b9050919050565b600060208201905081810360008301526128b481612503565b9050919050565b600060208201905081810360008301526128d481612526565b9050919050565b600060208201905081810360008301526128f481612549565b9050919050565b600060208201905081810360008301526129148161256c565b9050919050565b600060208201905081810360008301526129348161258f565b9050919050565b60006020820190508181036000830152612954816125b2565b9050919050565b60006020820190508181036000830152612974816125d5565b9050919050565b60006020820190508181036000830152612994816125f8565b9050919050565b600060208201905081810360008301526129b48161261b565b9050919050565b600060208201905081810360008301526129d48161263e565b9050919050565b600060208201905081810360008301526129f481612661565b9050919050565b60006020820190508181036000830152612a1481612684565b9050919050565b60006020820190508181036000830152612a34816126a7565b9050919050565b6000602082019050612a5060008301846126d9565b92915050565b6000604082019050612a6b60008301856126d9565b612a7860208301846126d9565b9392505050565b6000612a89612a9a565b9050612a958282612cdc565b919050565b6000604051905090565b600067ffffffffffffffff821115612abf57612abe612db4565b5b602082029050602081019050919050565b600067ffffffffffffffff821115612aeb57612aea612db4565b5b602082029050602081019050919050565b600067ffffffffffffffff821115612b1757612b16612db4565b5b612b2082612e05565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ba982612c5e565b9150612bb483612c5e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612be957612be8612d56565b5b828201905092915050565b6000612bff82612c3e565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015612c95578082015181840152602081019050612c7a565b83811115612ca4576000848401525b50505050565b60006002820490506001821680612cc257607f821691505b60208210811415612cd657612cd5612d85565b5b50919050565b612ce582612e05565b810181811067ffffffffffffffff82111715612d0457612d03612db4565b5b80604052505050565b6000612d1882612c5e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d4b57612d4a612d56565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060033d1115612e025760046000803e612dff600051612e16565b90505b90565b6000601f19601f8301169050919050565b60008160e01c9050919050565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206275726e20616d6f756e7420657863656564732062616c60008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b7f455243313135353a206275726e2066726f6d20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b600060443d10156132ae57613331565b6132b6612a9a565b60043d036004823e80513d602482011167ffffffffffffffff821117156132de575050613331565b808201805167ffffffffffffffff8111156132fc5750505050613331565b80602083010160043d038501811115613319575050505050613331565b61332882602001850186612cdc565b82955050505050505b90565b61333d81612bf4565b811461334857600080fd5b50565b61335481612c06565b811461335f57600080fd5b50565b61336b81612c12565b811461337657600080fd5b50565b61338281612c5e565b811461338d57600080fd5b5056fea26469706673582212207c954b474ba2938a61031705a0987bcb898a0dffe9cb3f5a8744e3e16585386e64736f6c63430008040033",
- "linkReferences": {},
- "deployedLinkReferences": {}
-}
diff --git a/dist/fakeERC1155.json b/dist/fakeERC1155.json
deleted file mode 100644
index c0f474782..000000000
--- a/dist/fakeERC1155.json
+++ /dev/null
@@ -1,437 +0,0 @@
-{
- "abi": [
- {
- "inputs": [],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "bool",
- "name": "approved",
- "type": "bool"
- }
- ],
- "name": "ApprovalForAll",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "previousOwner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "OwnershipTransferred",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- },
- {
- "indexed": false,
- "internalType": "uint256[]",
- "name": "values",
- "type": "uint256[]"
- }
- ],
- "name": "TransferBatch",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "TransferSingle",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": false,
- "internalType": "string",
- "name": "value",
- "type": "string"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "URI",
- "type": "event"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "balanceOf",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address[]",
- "name": "accounts",
- "type": "address[]"
- },
- {
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- }
- ],
- "name": "balanceOfBatch",
- "outputs": [
- {
- "internalType": "uint256[]",
- "name": "",
- "type": "uint256[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "burn",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "operator",
- "type": "address"
- }
- ],
- "name": "isApprovedForAll",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "mint",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "renounceOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- },
- {
- "internalType": "uint256[]",
- "name": "amounts",
- "type": "uint256[]"
- },
- {
- "internalType": "bytes",
- "name": "data",
- "type": "bytes"
- }
- ],
- "name": "safeBatchTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- },
- {
- "internalType": "bytes",
- "name": "data",
- "type": "bytes"
- }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "internalType": "bool",
- "name": "approved",
- "type": "bool"
- }
- ],
- "name": "setApprovalForAll",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "string",
- "name": "uri_",
- "type": "string"
- }
- ],
- "name": "setURI",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes4",
- "name": "interfaceId",
- "type": "bytes4"
- }
- ],
- "name": "supportsInterface",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "transferOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "uri",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }
- ]
-}
diff --git a/dist/fakeERC721.json b/dist/fakeERC721.json
deleted file mode 100644
index ed5bec8d5..000000000
--- a/dist/fakeERC721.json
+++ /dev/null
@@ -1,365 +0,0 @@
-{
- "abi": [
- {
- "inputs": [],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "_owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "_approved",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "Approval",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "_owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "_operator",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "bool",
- "name": "_approved",
- "type": "bool"
- }
- ],
- "name": "ApprovalForAll",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "previousOwner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "OwnershipTransferred",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "_from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "_to",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "Transfer",
- "type": "event"
- },
- {
- "inputs": [],
- "name": "CANNOT_TRANSFER_TO_ZERO_ADDRESS",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "NOT_CURRENT_OWNER",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_approved",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "approve",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_owner",
- "type": "address"
- }
- ],
- "name": "balanceOf",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "getApproved",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_owner",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "_operator",
- "type": "address"
- }
- ],
- "name": "isApprovedForAll",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "ownerOf",
- "outputs": [
- {
- "internalType": "address",
- "name": "_owner",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "_to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "_to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- },
- {
- "internalType": "bytes",
- "name": "_data",
- "type": "bytes"
- }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_operator",
- "type": "address"
- },
- {
- "internalType": "bool",
- "name": "_approved",
- "type": "bool"
- }
- ],
- "name": "setApprovalForAll",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes4",
- "name": "_interfaceID",
- "type": "bytes4"
- }
- ],
- "name": "supportsInterface",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "_to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "transferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_newOwner",
- "type": "address"
- }
- ],
- "name": "transferOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- }
- ]
-}
diff --git a/dist/helpers/chain.d.ts b/dist/helpers/chain.d.ts
deleted file mode 100644
index cd5c88d9f..000000000
--- a/dist/helpers/chain.d.ts
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * Transfer Liquidity to a foregin chain, freezing the original liquidity
- *
- * @param sender Account which owns the liquidity on the native chain, able to sign transactions
- * @param chain_nonce Nonce of the target chain
- * @param to Address of the receiver on the foreign chain
- * @param value Amount of liquidity to send
- *
- * @returns Transaction and the Identifier of this action to track the status
- */
-export interface TransferForeign {
- transferNativeToForeign(sender: Signer, chain_nonce: number, to: ForeignAddr, value: Balance): Promise<[Tx, EventIdent]>;
-}
-/**
- * Unfreeze native liquidity existing on a foreign chain(Send back Liquidity)
- *
- * @param sender Account which owns the wrapped liquidity on this chain, able to sign transactions
- * @param chain_nonce Nonce of the original chain
- * @param to Address of the receiver on the original chain
- * @param value Amount of liquidity to unfreeze
- *
- * @returns Transaction and the Identifier of this action to track the status
- */
-export interface UnfreezeForeign {
- unfreezeWrapped(sender: Signer, chain_nonce: number, to: ForeignAddr, value: Balance): Promise<[Tx, EventIdent]>;
-}
-/**
- * Transfer NFT to a foreign chain, freezing the original one
- *
- * @param sender Account which owns the NFT on the native chain, able to sign transactions
- * @param chain_nonce Nonce of the target chain
- * @param to Address of the receiver on the foreign chain
- * @param id Information required to freeze this nft
- *
- * @returns Transaction and the Identifier of this action to track the status
- */
-export interface TransferNftForeign {
- transferNftToForeign(sender: Signer, chain_nonce: number, to: ForeignAddr, id: NftIdent): Promise<[Tx, EventIdent]>;
-}
-/**
- * Unfreeze native NFT existing on a foreign chain(Send back NFT)
- * chain_nonce is automatically derived
- *
- * @param sender Account which owns the wrapped NFT on this chain, able to sign transactions
- * @param to Address of the receiver on the original chain
- * @param id Information required to unfreeze this nft
- *
- * @returns Transaction and the Identifier of this action to track the status
- */
-export interface UnfreezeForeignNft {
- unfreezeWrappedNft(sender: Signer, to: ForeignAddr, id: NftIdent): Promise<[Tx, EventIdent]>;
-}
-/**
- * Get the balance of an address on the chain
- */
-export interface BalanceCheck {
- balance(address: Addr): Promise;
-}
-/**
- * Get the balance of a foreign token for an account in this chain
- *
- * @param address Address of the user
- * @param chain_nonce nonce of the foreign chain
- */
-export interface WrappedBalanceCheck {
- balanceWrapped(address: Addr, chain_nonce: number): Promise;
-}
-/**
- * Get the balance of multiple foreign tokens for an account in this chain
- *
- * @param chain_nonces list of foreign tokens to fetch
- * @returns Mapping of chain_nonce to balance
- */
-export interface BatchWrappedBalanceCheck {
- balanceWrappedBatch(address: Addr, chain_nonces: number[]): Promise>;
-}
-/**
- * Create a new NFT on this chain
- *
- * @param options Arguments required to mint the nft
- */
-export interface MintNft {
- mintNft(owner: Signer, options: Args): Promise;
-}
-/**
- * Get the list of NFTs for a given account
- */
-export interface ListNft {
- listNft(owner: Addr): Promise>;
-}
-/**
- * Get the original data of a locked NFT (uri, name, etc)
- */
-export interface GetLockedNft {
- getLockedNft(ident: Ident): Promise;
-}
-export declare type WrappedNft = {
- chain_nonce: number;
- data: Uint8Array;
-};
-export interface DecodeWrappedNft {
- decodeWrappedNft(raw_data: Data): WrappedNft;
-}
-export interface DecodeRawNft {
- decodeUrlFromRaw(data: Uint8Array): Promise;
-}
-export declare function ConcurrentSendError(): Error;
diff --git a/dist/helpers/chain.js b/dist/helpers/chain.js
deleted file mode 100644
index 9dbe66eed..000000000
--- a/dist/helpers/chain.js
+++ /dev/null
@@ -1,8 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.ConcurrentSendError = void 0;
-function ConcurrentSendError() {
- return new Error("concurrent_send");
-}
-exports.ConcurrentSendError = ConcurrentSendError;
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaGVscGVycy9jaGFpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFtSkEsU0FBZ0IsbUJBQW1CO0lBQ2xDLE9BQU8sSUFBSSxLQUFLLENBQUMsaUJBQWlCLENBQUMsQ0FBQTtBQUNwQyxDQUFDO0FBRkQsa0RBRUMifQ==
\ No newline at end of file
diff --git a/dist/helpers/elrond.d.ts b/dist/helpers/elrond.d.ts
deleted file mode 100644
index a6e394b7e..000000000
--- a/dist/helpers/elrond.d.ts
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- * Elrond Implementation for cross chain traits
- * Unsigned Transaction methods should be used for usage with @elrondnetwork/dapp
- * Note that Unsigned Transactions need to be manually handled after they have been added to the block
- * @module
- */
-import { Address, ISigner, Transaction, TransactionHash } from "@elrondnetwork/erdjs";
-import BigNumber from "bignumber.js";
-import { BalanceCheck, BatchWrappedBalanceCheck, DecodeRawNft, DecodeWrappedNft, GetLockedNft, ListNft, MintNft, TransferForeign, TransferNftForeign, UnfreezeForeign, UnfreezeForeignNft } from "./chain";
-declare type EasyBalance = string | number | BigNumber;
-/**
- * Information required to perform NFT transfers in this chain
- */
-export declare type NftInfo = {
- token: string;
- nonce: EasyBalance;
-};
-/**
- * Information associated with an ESDT Token
- */
-export declare type EsdtTokenInfo = {
- readonly balance: string;
- readonly tokenIdentifier: string;
-};
-declare type BEsdtNftInfo = {
- readonly attributes?: string;
- readonly creator: string;
- readonly name: string;
- readonly nonce: number;
- readonly royalties: string;
- readonly uris: string[];
-};
-/**
- * Information associated with an ESDT NFT
- */
-export declare type EsdtNftInfo = EsdtTokenInfo & BEsdtNftInfo;
-/**
- * arguments required to issue an NFT
- */
-export declare type NftIssueArgs = {
- readonly identifier: string;
- readonly quantity: number | undefined;
- readonly name: string;
- readonly royalties: number | undefined;
- readonly hash: string | undefined;
- readonly attrs: string | undefined;
- readonly uris: Array;
-};
-/**
- * Utility for issuing ESDT which supports NFT minting
- */
-export interface IssueESDTNFT {
- /**
- * Unsigned Transaction for [[issueESDTNft]]
- */
- unsignedIssueESDTNft(name: string, ticker: string, canFreeze: boolean | undefined, canWipe: boolean | undefined, canTransferNFTCreateRole: boolean | undefined): Transaction;
- /**
- * Issue a new ESDT supporting NFTs
- *
- * @param sender Owner of this ESDT
- * @param name Name of the ESDT
- * @param ticker Ticker of the ESDT
- * @param canFreeze Wheteher this ESDT can be frozen
- * @param canWipe Whether this ESDT can be wiped
- * @param canTransferNFTCreateRole Whether the NFT Creation role can be transferred
- */
- issueESDTNft(sender: ISigner, name: string, ticker: string, canFreeze: boolean | undefined, canWipe: boolean | undefined, canTransferNFTCreateRole: boolean | undefined): Promise;
-}
-/**
- * Possible roles for an ESDT
- *
- * ESDTRoleNFTCreate: Allow creating NFTs
- * ESDTRoleNFTBurn: Allow burning NFTs
- * ESDTRoleNFTAddQuanitity: Allowing minting >1 NFTs (SFT)
- */
-export declare type ESDTRole = "ESDTRoleNFTCreate" | "ESDTRoleNFTBurn" | "ESDTRoleNFTAddQuantity";
-/**
- * Utility for setting ESDT roles
- */
-export interface SetESDTRoles {
- /**
- * Unsigned Transaction for [[setESDTRole]]
- */
- unsignedSetESDTRoles(token: string, target: Address, roles: [ESDTRole]): Transaction;
- /**
- *
- * Set the roles for a given account for an esdt
- *
- * @param sender Target account
- * @param token ESDT Identifier
- * @param roles Roles to set
- */
- setESDTRole(sender: ISigner, token: string, roles: [ESDTRole]): Promise;
-}
-/**
- * Identifier for tracking a given action
- */
-declare type EventIdent = number;
-/**
- * Traits implemented by this module
- */
-export declare type ElrondHelper = BalanceCheck & BatchWrappedBalanceCheck & TransferForeign & UnfreezeForeign & TransferNftForeign & UnfreezeForeignNft & IssueESDTNFT & MintNft & ListNft & GetLockedNft & DecodeWrappedNft & DecodeRawNft & {
- /**
- * Unsigned Transaction for [[TransferForeign]]
- */
- unsignedTransferTxn(chain_nonce: number, to: string, value: EasyBalance): Transaction;
- /**
- * Unsigned Transaction for [[UnfreezeForeign]]
- */
- unsignedUnfreezeTxn(chain_nonce: number, address: Address, to: string, value: EasyBalance): Transaction;
- /**
- * Unsigned Transaction for [[TransferNftForeign]]
- */
- unsignedTransferNftTxn(chain_nonce: number, address: Address, to: string, info: NftInfo): Transaction;
- /**
- * Unsigned Transaction for [[UnfreezeForeignNft]]
- */
- unsignedUnfreezeNftTxn(address: Address, to: string, id: number): Transaction;
- /**
- * Unsigned transaction for Minting an NFT
- */
- unsignedMintNftTxn(owner: Address, args: NftIssueArgs): Transaction;
- /**
- * Raw result of a transaction
- *
- * @param tx_hash Hash of the transaction
- */
- rawTxnResult(tx_hash: TransactionHash): Promise;
-};
-/**
- * Create an object implementing cross chain utilities for elrond
- *
- * @param node_uri URI of the elrond node
- * @param minter_address Address of the minter smart contract
- * @param middleware_uri REST API of elrond-event-middleware
- * @param esdt Identifier of the ESDT Wrapper
- * @param esdt_nft Identifier of the ESDT NFT Wrapper
- */
-export declare const elrondHelperFactory: (node_uri: string, minter_address: string, esdt: string, esdt_nft: string) => Promise;
-export {};
diff --git a/dist/helpers/elrond.js b/dist/helpers/elrond.js
deleted file mode 100644
index 6df45defa..000000000
--- a/dist/helpers/elrond.js
+++ /dev/null
@@ -1,351 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.elrondHelperFactory = void 0;
-/**
- * Elrond Implementation for cross chain traits
- * Unsigned Transaction methods should be used for usage with @elrondnetwork/dapp
- * Note that Unsigned Transactions need to be manually handled after they have been added to the block
- * @module
- */
-const erdjs_1 = require("@elrondnetwork/erdjs");
-const axios_1 = __importDefault(require("axios"));
-const bignumber_js_1 = __importDefault(require("bignumber.js"));
-const chain_1 = require("./chain");
-const js_base64_1 = require("js-base64");
-const ESDT_ISSUE_ADDR = new erdjs_1.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u");
-const ESDT_ISSUE_COST = "50000000000000000";
-function isEsdtNftInfo(maybe) {
- return maybe.creator != undefined && maybe.balance == "1";
-}
-;
-/**
- * Create an object implementing cross chain utilities for elrond
- *
- * @param node_uri URI of the elrond node
- * @param minter_address Address of the minter smart contract
- * @param middleware_uri REST API of elrond-event-middleware
- * @param esdt Identifier of the ESDT Wrapper
- * @param esdt_nft Identifier of the ESDT NFT Wrapper
- */
-const elrondHelperFactory = async (node_uri, minter_address, esdt, esdt_nft) => {
- const provider = new erdjs_1.ProxyProvider(node_uri);
- await erdjs_1.NetworkConfig.getDefault().sync(provider);
- const mintContract = new erdjs_1.Address(minter_address);
- const providerRest = axios_1.default.create({
- baseURL: node_uri
- });
- const esdtHex = Buffer.from(esdt, "utf-8");
- const esdtNftHex = Buffer.from(esdt_nft, "utf-8");
- const decoder = new TextDecoder();
- const syncAccount = async (signer) => {
- const account = new erdjs_1.Account(signer.getAddress());
- await account.sync(provider);
- return account;
- };
- const signAndSend = async (signer, tx) => {
- const acc = await syncAccount(signer);
- tx.setNonce(acc.nonce);
- await signer.sign(tx);
- try {
- await tx.send(provider);
- }
- catch (e) {
- if (e.message.includes("lowerNonceInTx")) {
- throw chain_1.ConcurrentSendError();
- }
- else {
- throw e;
- }
- }
- return tx;
- };
- const transactionResult = async (tx_hash) => {
- const uri = `/transaction/${tx_hash.toString()}?withResults=true`;
- let tries = 0;
- while (tries < 10) {
- tries += 1;
- let err;
- // TODO: type safety
- const res = await providerRest.get(uri).catch(e => err = e);
- if (err) {
- await new Promise(r => setTimeout(r, 3000));
- continue;
- }
- const data = res.data;
- if (data["code"] != "successful") {
- throw Error("failed to execute txn");
- }
- const tx_info = data["data"]["transaction"];
- if (tx_info["status"] == "pending") {
- await new Promise(r => setTimeout(r, 5000));
- continue;
- }
- if (tx_info["status"] != "success") {
- throw Error("failed to execute txn");
- }
- return tx_info;
- }
- throw Error(`failed to query transaction exceeded 10 retries ${tx_hash}`);
- };
- const unsignedTransferTxn = (chain_nonce, to, value) => {
- return new erdjs_1.Transaction({
- receiver: mintContract,
- gasLimit: new erdjs_1.GasLimit(50000000),
- value: new erdjs_1.Balance(value.toString()),
- data: erdjs_1.TransactionPayload.contractCall()
- .setFunction(new erdjs_1.ContractFunction("freezeSend"))
- .addArg(new erdjs_1.U64Value(new bignumber_js_1.default(chain_nonce)))
- .addArg(new erdjs_1.BytesValue(Buffer.from(to, "ascii")))
- .build(),
- });
- };
- const unsignedMintNftTxn = (owner, { identifier, quantity, name, royalties, hash, attrs, uris }) => {
- let baseArgs = erdjs_1.TransactionPayload.contractCall()
- .setFunction(new erdjs_1.ContractFunction("ESDTNFTCreate"))
- .addArg(new erdjs_1.TokenIdentifierValue(Buffer.from(identifier, 'utf-8')))
- .addArg(new erdjs_1.BigUIntValue(new bignumber_js_1.default(quantity !== null && quantity !== void 0 ? quantity : 1)))
- .addArg(new erdjs_1.BytesValue(Buffer.from(name, 'utf-8')))
- .addArg(new erdjs_1.U64Value(new bignumber_js_1.default(royalties !== null && royalties !== void 0 ? royalties : 0)))
- .addArg(new erdjs_1.BytesValue(hash ? Buffer.from(hash, 'utf-8') : Buffer.alloc(0)))
- .addArg(new erdjs_1.BytesValue(attrs ? Buffer.from(attrs, 'utf-8') : Buffer.alloc(0)));
- for (const uri of uris) {
- baseArgs = baseArgs.addArg(new erdjs_1.BytesValue(Buffer.from(uri, 'utf-8')));
- }
- return new erdjs_1.Transaction({
- receiver: owner,
- gasLimit: new erdjs_1.GasLimit(70000000),
- data: baseArgs.build()
- });
- };
- const unsignedTransferNftTxn = (chain_nonce, address, to, { token, nonce }) => {
- return new erdjs_1.Transaction({
- receiver: address,
- gasLimit: new erdjs_1.GasLimit(70000000),
- data: erdjs_1.TransactionPayload.contractCall()
- .setFunction(new erdjs_1.ContractFunction("ESDTNFTTransfer"))
- .addArg(new erdjs_1.TokenIdentifierValue(Buffer.from(token, "utf-8")))
- .addArg(new erdjs_1.U64Value(new bignumber_js_1.default(nonce)))
- .addArg(new erdjs_1.BigUIntValue(new bignumber_js_1.default(1)))
- .addArg(new erdjs_1.AddressValue(mintContract))
- .addArg(new erdjs_1.BytesValue(Buffer.from("freezeSendNft", "ascii")))
- .addArg(new erdjs_1.U64Value(new bignumber_js_1.default(chain_nonce)))
- .addArg(new erdjs_1.BytesValue(Buffer.from(to, "ascii")))
- .build(),
- });
- };
- const unsignedUnfreezeNftTxn = (address, to, id) => {
- return new erdjs_1.Transaction({
- receiver: address,
- gasLimit: new erdjs_1.GasLimit(70000000),
- data: erdjs_1.TransactionPayload.contractCall()
- .setFunction(new erdjs_1.ContractFunction("ESDTNFTTransfer"))
- .addArg(new erdjs_1.TokenIdentifierValue(esdtNftHex))
- .addArg(new erdjs_1.U64Value(new bignumber_js_1.default(id)))
- .addArg(new erdjs_1.BigUIntValue(new bignumber_js_1.default(1)))
- .addArg(new erdjs_1.AddressValue(mintContract))
- .addArg(new erdjs_1.BytesValue(Buffer.from("withdrawNft", "ascii")))
- .addArg(new erdjs_1.BytesValue(Buffer.from(to, "ascii")))
- .build(),
- });
- };
- const unsignedUnfreezeTxn = (chain_nonce, address, to, value) => {
- return new erdjs_1.Transaction({
- receiver: address,
- gasLimit: new erdjs_1.GasLimit(50000000),
- data: erdjs_1.TransactionPayload.contractCall()
- .setFunction(new erdjs_1.ContractFunction("ESDTNFTTransfer"))
- .addArg(new erdjs_1.TokenIdentifierValue(esdtHex))
- .addArg(new erdjs_1.U64Value(new bignumber_js_1.default(chain_nonce)))
- .addArg(new erdjs_1.BigUIntValue(new bignumber_js_1.default(value)))
- .addArg(new erdjs_1.AddressValue(mintContract))
- .addArg(new erdjs_1.BytesValue(Buffer.from("withdraw", "ascii")))
- .addArg(new erdjs_1.BytesValue(Buffer.from(to, "ascii")))
- .build(),
- });
- };
- const listEsdt = async (owner) => {
- const raw = await providerRest(`/address/${owner}/esdt`);
- const dat = raw.data.data.esdts;
- return dat;
- };
- async function listNft(owner) {
- const ents = Object.entries(await listEsdt(owner));
- const fmapCb = ([tok, info]) => {
- var _a;
- if (!isEsdtNftInfo(info)) {
- return [];
- }
- let sp = tok.split("-");
- let nonce = (_a = sp.pop()) !== null && _a !== void 0 ? _a : "";
- return [[`${sp.join("-")}-${parseInt(nonce, 16).toString()}`, info]];
- };
- return new Map(ents.flatMap(fmapCb));
- }
- const unsignedIssueESDTNft = (name, ticker, canFreeze, canWipe, canTransferNFTCreateRole) => {
- let baseArgs = erdjs_1.TransactionPayload.contractCall()
- .setFunction(new erdjs_1.ContractFunction("issueNonFungible"))
- .addArg(new erdjs_1.TokenIdentifierValue(Buffer.from(name, 'utf-8')))
- .addArg(new erdjs_1.TokenIdentifierValue(Buffer.from(ticker, 'utf-8')));
- if (canFreeze !== undefined) {
- baseArgs = baseArgs.addArg(new erdjs_1.BytesValue(Buffer.from("canFreeze", 'ascii')))
- .addArg(new erdjs_1.BytesValue(Buffer.from(canFreeze ? "true" : "false", 'ascii')));
- }
- if (canWipe !== undefined) {
- baseArgs = baseArgs.addArg(new erdjs_1.BytesValue(Buffer.from("canWipe", 'ascii')))
- .addArg(new erdjs_1.BytesValue(Buffer.from(canWipe ? "true" : "false", "ascii")));
- }
- if (canTransferNFTCreateRole !== undefined) {
- baseArgs = baseArgs.addArg(new erdjs_1.BytesValue(Buffer.from('canTransferNFTCreateRole', 'ascii')))
- .addArg(new erdjs_1.BytesValue(Buffer.from(canTransferNFTCreateRole ? "true" : "false", "ascii")));
- }
- return new erdjs_1.Transaction({
- receiver: ESDT_ISSUE_ADDR,
- value: new erdjs_1.Balance(ESDT_ISSUE_COST),
- gasLimit: new erdjs_1.GasLimit(60000000),
- data: baseArgs.build()
- });
- };
- const unsignedSetESDTRoles = (token, target, roles) => {
- let baseArgs = erdjs_1.TransactionPayload.contractCall()
- .setFunction(new erdjs_1.ContractFunction("setSpecialRole"))
- .addArg(new erdjs_1.TokenIdentifierValue(Buffer.from(token)))
- .addArg(new erdjs_1.AddressValue(target));
- for (const role of roles) {
- baseArgs = baseArgs.addArg(new erdjs_1.BytesValue(Buffer.from(role, 'utf-8')));
- }
- return new erdjs_1.Transaction({
- receiver: ESDT_ISSUE_ADDR,
- gasLimit: new erdjs_1.GasLimit(70000000),
- data: baseArgs.build()
- });
- };
- async function getLockedNft({ token, nonce }) {
- const nfts = await listNft(minter_address);
- return nfts.get(`${token}-${nonce.toString()}`);
- }
- const rawNftDecoder = (nftDat) => {
- /// TokenLen(4 by), TokenIdent(TokenLen by), Nonce(8 by)
- /// BinaryCodec is broken for browsers. Decode manually :|
- if (nftDat.length < 12) {
- throw Error("not a wrapped nft");
- }
- const tokenLen = (new Uint32Array(nftDat.slice(0, 4).reverse()))[0];
- if (nftDat.length !== 12 + tokenLen) {
- throw Error("not a wrapped nft");
- }
- const token = decoder.decode(nftDat.slice(4, 4 + tokenLen));
- // TODO: Consider LO
- // tfw js can't convert be bytes to u64
- const nonce = (new Uint32Array(nftDat.slice(4 + tokenLen, 12 + tokenLen).reverse()))[0];
- return { token, nonce };
- };
- async function extractId(tx) {
- let err;
- await tx.awaitExecuted(provider).catch(e => err = e);
- if (err) {
- await new Promise(r => setTimeout(r, 3000));
- return extractId(tx);
- }
- const txr = await transactionResult(tx.getHash());
- const id = filterEventId(txr["smartContractResults"]);
- return [tx, id];
- }
- return {
- rawTxnResult: transactionResult,
- unsignedTransferTxn,
- unsignedUnfreezeTxn,
- unsignedTransferNftTxn,
- unsignedUnfreezeNftTxn,
- unsignedMintNftTxn,
- unsignedSetESDTRoles,
- async balance(address) {
- const wallet = new erdjs_1.Account(new erdjs_1.Address(address));
- await wallet.sync(provider);
- return wallet.balance.valueOf();
- },
- async balanceWrappedBatch(address, chain_nonces) {
- const esdts = Object.values(await listEsdt(address.toString()));
- const res = new Map(chain_nonces.map(v => [v, new bignumber_js_1.default(0)]));
- for (const esdt of esdts) {
- esdt.nonce && esdt.tokenIdentifier.startsWith(esdt.tokenIdentifier) && res.set(esdt.nonce, new bignumber_js_1.default(esdt.balance));
- }
- return res;
- },
- async transferNativeToForeign(sender, chain_nonce, to, value) {
- const txu = unsignedTransferTxn(chain_nonce, to, value);
- const tx = await signAndSend(sender, txu);
- return await extractId(tx);
- },
- async unfreezeWrapped(sender, chain_nonce, to, value) {
- const txu = unsignedUnfreezeTxn(chain_nonce, sender.getAddress(), to, value);
- const tx = await signAndSend(sender, txu);
- return await extractId(tx);
- },
- async transferNftToForeign(sender, chain_nonce, to, info) {
- const txu = unsignedTransferNftTxn(chain_nonce, sender.getAddress(), to, info);
- const tx = await signAndSend(sender, txu);
- return await extractId(tx);
- },
- async unfreezeWrappedNft(sender, to, nonce) {
- const txu = unsignedUnfreezeNftTxn(sender.getAddress(), to, nonce);
- const tx = await signAndSend(sender, txu);
- return await extractId(tx);
- },
- unsignedIssueESDTNft,
- async issueESDTNft(sender, name, ticker, canFreeze = false, canWipe = false, canTransferNFTCreateRole = false) {
- const txu = unsignedIssueESDTNft(name, ticker, canFreeze, canWipe, canTransferNFTCreateRole);
- await signAndSend(sender, txu);
- },
- async mintNft(owner, args) {
- const txu = unsignedMintNftTxn(owner.getAddress(), args);
- await signAndSend(owner, txu);
- },
- listNft,
- getLockedNft,
- async setESDTRole(manager, token, target, roles) {
- const txu = unsignedSetESDTRoles(token, target, roles);
- await signAndSend(manager, txu);
- },
- decodeWrappedNft(raw_data) {
- if (!raw_data.attributes) {
- throw Error("can't decode chain nonce");
- }
- return {
- // TODO: CONSIDER ALL BE BYTES
- chain_nonce: js_base64_1.Base64.toUint8Array(raw_data.attributes)[0],
- data: js_base64_1.Base64.toUint8Array(raw_data.uris[0])
- };
- },
- async decodeUrlFromRaw(data) {
- const nft_info = rawNftDecoder(data);
- const locked = await getLockedNft(nft_info);
- if (locked === undefined) {
- throw Error("Not a wrapped nft");
- }
- return js_base64_1.Base64.atob(locked.uris[0]);
- }
- };
-};
-exports.elrondHelperFactory = elrondHelperFactory;
-function filterEventId(results) {
- for (const res of results) {
- if (res["nonce"] === 0) {
- continue;
- }
- const data = res.data.split("@");
- if (data[0] != "" || data[1] != "6f6b" || data.length != 3) {
- continue;
- }
- try {
- return parseInt(data[2], 16);
- }
- catch (NumberFormatException) {
- continue;
- }
- }
- throw Error(`invalid result: ${results.toString()}`);
-}
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWxyb25kLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2hlbHBlcnMvZWxyb25kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBOzs7OztHQUtHO0FBQ0gsZ0RBaUI4QjtBQUM5QixrREFBMEI7QUFDMUIsZ0VBQXFDO0FBQ3JDLG1DQWNpQjtBQUNqQix5Q0FBbUM7QUFJbkMsTUFBTSxlQUFlLEdBQUcsSUFBSSxlQUFPLENBQUMsZ0VBQWdFLENBQUMsQ0FBQztBQUN0RyxNQUFNLGVBQWUsR0FBRyxtQkFBbUIsQ0FBQztBQXNDNUMsU0FBUyxhQUFhLENBQUMsS0FBdUI7SUFDNUMsT0FBTyxLQUFLLENBQUMsT0FBTyxJQUFJLFNBQVMsSUFBSSxLQUFLLENBQUMsT0FBTyxJQUFJLEdBQUcsQ0FBQztBQUM1RCxDQUFDO0FBZ0RBLENBQUM7QUF1RkY7Ozs7Ozs7O0dBUUc7QUFDSSxNQUFNLG1CQUFtQixHQUtILEtBQUssRUFDaEMsUUFBZ0IsRUFDaEIsY0FBc0IsRUFDdEIsSUFBWSxFQUNaLFFBQWdCLEVBQ2hCLEVBQUU7SUFDRixNQUFNLFFBQVEsR0FBRyxJQUFJLHFCQUFhLENBQUMsUUFBUSxDQUFDLENBQUM7SUFDN0MsTUFBTSxxQkFBYSxDQUFDLFVBQVUsRUFBRSxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsQ0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JQUFJLElBQUksQ0FBQyxDQUFDLENBQUMsSUFBSSxFQUFFLElBQUksSUFBSSxDQUFDLENBQUMsQ0FBQyxJQUFJLE1BQU0sSUFBSSxJQUFJLENBQUMsTUFBTSxJQUFJLENBQUMsRUFBRTtZQUMxRCxTQUFTO1NBQ1Y7UUFFRCxJQUFJO1lBQ0YsT0FBTyxRQUFRLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1NBQzlCO1FBQUMsT0FBTyxxQkFBcUIsRUFBRTtZQUM5QixTQUFTO1NBQ1Y7S0FDRjtJQUVELE1BQU0sS0FBSyxDQUFDLG1CQUFtQixPQUFPLENBQUMsUUFBUSxFQUFFLEVBQUUsQ0FBQyxDQUFDO0FBQ3ZELENBQUMifQ==
\ No newline at end of file
diff --git a/dist/helpers/polkadot.d.ts b/dist/helpers/polkadot.d.ts
deleted file mode 100644
index 7790ab49e..000000000
--- a/dist/helpers/polkadot.d.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { Address, H256, Hash, LookupSource } from "@polkadot/types/interfaces";
-import BigNumber from "bignumber.js";
-import { TransferForeign, TransferNftForeign, UnfreezeForeign, UnfreezeForeignNft, BalanceCheck, MintNft, ListNft, GetLockedNft, WrappedBalanceCheck, BatchWrappedBalanceCheck, DecodeWrappedNft, DecodeRawNft } from "./chain";
-import { AddressOrPair } from "@polkadot/api/types";
-import { SignerOptions } from "@polkadot/api/submittable/types";
-/**
- * Type of sender expected by this module
- *
- * @param sender Address of the sender, or a Keypair
- * @param options Options for sigining this transaction. Mandatory if sender is an address
- */
-export declare type Signer = {
- sender: AddressOrPair;
- options?: Partial;
-};
-declare type EasyBalance = string | number | BigNumber;
-declare type EasyAddr = string | LookupSource | Address;
-declare type BasePolkadot = BalanceCheck;
-/**
- * identifier for tracking an action
- */
-declare type EventIdent = BigNumber;
-export declare type PolkadotHelper = BasePolkadot & TransferForeign & UnfreezeForeign;
-/**
- * Traits implemented by this module
- */
-export declare type PolkadotPalletHelper = PolkadotHelper & WrappedBalanceCheck & BatchWrappedBalanceCheck & TransferNftForeign & UnfreezeForeignNft & MintNft & ListNft & GetLockedNft & DecodeWrappedNft & DecodeRawNft;
-/**
- * @internal
- */
-export declare function toHex(buffer: Uint8Array): string;
-/**
- * Create an object implementing Cross Chain utilities for Polkadot
- *
- * @param node_uri URI of the polkadot node
- */
-export declare const polkadotPalletHelperFactory: (node_uri: string) => Promise;
-export {};
diff --git a/dist/helpers/polkadot.js b/dist/helpers/polkadot.js
deleted file mode 100644
index 7c4c1bcb9..000000000
--- a/dist/helpers/polkadot.js
+++ /dev/null
@@ -1,196 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.polkadotPalletHelperFactory = exports.toHex = void 0;
-/**
- * Polkadot Implementation for cross chain traits
- * @module
- */
-const api_1 = require("@polkadot/api");
-const bignumber_js_1 = __importDefault(require("bignumber.js"));
-const chain_1 = require("./chain");
-const types_1 = require("@polkadot/types");
-const encoding_1 = require("validator/dist/encoding");
-const LUT_HEX_4b = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];
-const LUT_HEX_8b = new Array(0x100);
-for (let n = 0; n < 0x100; n++) {
- LUT_HEX_8b[n] = `${LUT_HEX_4b[(n >>> 4) & 0xF]}${LUT_HEX_4b[n & 0xF]}`;
-}
-/**
- * @internal
- */
-// End Pre-Init
-function toHex(buffer) {
- let out = '';
- for (let idx = 0, edx = buffer.length; idx < edx; idx++) {
- out += LUT_HEX_8b[buffer[idx]];
- }
- return `0x${out}`;
-}
-exports.toHex = toHex;
-async function basePolkadotHelper(node_uri) {
- const provider = new api_1.WsProvider(node_uri);
- const api = await api_1.ApiPromise.create({ provider, types: runtimeTypes });
- const base = {
- async balance(address) {
- const res = await api.query.system.account(address);
- return new bignumber_js_1.default(res['data']['free'].toString());
- }
- };
- return [base, api];
-}
-function hasAddrField(ob) {
- return ob.hasOwnField('address') && typeof ob.address == "string";
-}
-async function resolve_event_id(ext, filter, signer, options) {
- let call;
- if (options) {
- options.nonce = -1;
- call = async (cb) => await ext.signAndSend(signer, options, cb);
- }
- else {
- call = async (cb) => await ext.signAndSend(signer, { nonce: -1 }, cb);
- }
- const evP = new Promise((res, rej) => {
- call(({ events, status }) => {
- if (!status.isInBlock) {
- return;
- }
- const ev = events.find(e => e.event.method == filter);
- if (ev === undefined) {
- rej();
- return;
- }
- const action_id = new bignumber_js_1.default(ev.event.data[0].toString());
- const hash = status.asInBlock;
- res([hash, action_id]);
- });
- });
- try {
- return await evP;
- }
- catch (e) {
- if (e.message.contains("Priority is too low")) {
- throw chain_1.ConcurrentSendError();
- }
- throw e;
- }
-}
-/**
- * Create an object implementing Cross Chain utilities for Polkadot
- *
- * @param node_uri URI of the polkadot node
- */
-const polkadotPalletHelperFactory = async (node_uri) => {
- const [base, api] = await basePolkadotHelper(node_uri);
- const keyring = new api_1.Keyring();
- const sudoSigner = keyring.createFromUri("//Alice", undefined, "sr25519");
- const decoder = new TextDecoder();
- function nftListMapper([nft_id, data]) {
- return [nft_id.toString(), data];
- }
- async function getLockedNft(hash) {
- const com = await api.query.nft.lockedCommodities(hash);
- if (com.isNone) {
- return undefined;
- }
- const [_owner, dat] = com.unwrap();
- return dat;
- }
- return Object.assign(Object.assign({}, base), { async balanceWrapped(address, chain_nonce) {
- const res = await api.query.erc1155.balances(address, chain_nonce);
- return new bignumber_js_1.default(res.toString());
- },
- async balanceWrappedBatch(address, chain_nonces) {
- // Multi query with address, chain_nonce
- const res = await api.query.erc1155.balances.multi(chain_nonces.map(c => [address, c]));
- // Convert list of balances to [chain_nonce, balance]
- return new Map(res.map((b, i) => [chain_nonces[i], b.isSome ? new bignumber_js_1.default(b.unwrap().toString()) : new bignumber_js_1.default(0)]));
- },
- async transferNativeToForeign(sender, chain_nonce, to, value) {
- return await resolve_event_id(api.tx.freezer.send(chain_nonce, to, value.toString()), "TransferFrozen", sender.sender, sender.options);
- },
- async unfreezeWrapped(sender, chain_nonce, to, value) {
- return await resolve_event_id(api.tx.freezer.withdrawWrapped(chain_nonce, to, value.toString()), "UnfreezeWrapped", sender.sender, sender.options);
- },
- async transferNftToForeign(sender, chain_nonce, to, nft_id) {
- return await resolve_event_id(api.tx.freezer.sendNft(chain_nonce, to, nft_id), "TransferUniqueFrozen", sender.sender, sender.options);
- },
- async unfreezeWrappedNft(sender, to, nft_id) {
- return await resolve_event_id(api.tx.freezer.withdrawWrappedNft(to, nft_id), "UnfreezeUniqueWrapped", sender.sender, sender.options);
- },
- async mintNft(owner, info) {
- let addr;
- // "static typing :|"
- if (typeof owner.sender == "string") {
- addr = owner.sender;
- }
- else if (hasAddrField(owner.sender)) {
- addr = owner.sender.address;
- }
- else {
- addr = owner.sender.toString();
- }
- await api.tx.sudo.sudo(api.tx.nft.mint(addr, toHex(info))).signAndSend(sudoSigner, { nonce: -1 });
- },
- async listNft(owner) {
- const com = await api.query.nft.commoditiesForAccount(owner.toString());
- if (com.isNone) {
- return new Map();
- }
- const c = Array.from(com.unwrap()).map(nftListMapper);
- return new Map(c);
- },
- getLockedNft,
- decodeWrappedNft(raw_data) {
- const packed = encoding_1.NftPacked.deserializeBinary(Uint8Array.from(raw_data));
- return {
- chain_nonce: packed.getChainNonce(),
- data: packed.getData_asU8()
- };
- },
- async decodeUrlFromRaw(data) {
- const locked = await getLockedNft(new types_1.U8aFixed(api.registry, data, 256));
- if (locked === undefined) {
- throw Error("not a locked nft");
- }
- return decoder.decode(locked.slice(-24));
- } });
-};
-exports.polkadotPalletHelperFactory = polkadotPalletHelperFactory;
-const runtimeTypes = {
- ActionId: "u128",
- TokenId: "u64",
- CommodityId: "H256",
- CommodityInfo: "Bytes",
- NftId: "H256",
- NftInfo: "Bytes",
- Erc1155Balance: "Balance",
- Commodity: "(H256, Bytes)",
- LocalAction: {
- _enum: {
- //@ts-expect-error enum struct
- Unfreeze: {
- to: "AccountId",
- value: "Balance",
- },
- //@ts-expect-error enum struct
- RpcCall: {
- contract: "AccountId",
- call_data: "Bytes",
- },
- //@ts-expect-error enum struct
- TransferWrapped: {
- to: "AccountId",
- value: "Balance",
- },
- },
- },
- ActionInfo: {
- action: "LocalAction",
- validators: "BTreeSet",
- },
-};
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9sa2Fkb3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaGVscGVycy9wb2xrYWRvdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTs7O0dBR0c7QUFDSCx1Q0FBZ0U7QUFHaEUsZ0VBQXFDO0FBQ3JDLG1DQWVpQjtBQUdqQiwyQ0FBeUU7QUFDekUsc0RBQW1EO0FBMENuRCxNQUFNLFVBQVUsR0FBRyxDQUFDLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsQ0FBQyxDQUFDO0FBQ3BHLE1BQU0sVUFBVSxHQUFHLElBQUksS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDO0FBQ3BDLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxLQUFLLEVBQUUsQ0FBQyxFQUFFLEVBQUU7SUFDOUIsVUFBVSxDQUFDLENBQUMsQ0FBQyxHQUFHLEdBQUcsVUFBVSxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxHQUFHLEdBQUcsQ0FBQyxHQUFHLFVBQVUsQ0FBQ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3JCLFNBQVMsRUFBRSxPQUFPO2FBQ25CO1lBQ0QsOEJBQThCO1lBQzlCLGVBQWUsRUFBRTtnQkFDZixFQUFFLEVBQUUsV0FBVztnQkFDZixLQUFLLEVBQUUsU0FBUzthQUNqQjtTQUNGO0tBQ0Y7SUFDRCxVQUFVLEVBQUU7UUFDVixNQUFNLEVBQUUsYUFBYTtRQUNyQixVQUFVLEVBQUUscUJBQXFCO0tBQ2xDO0NBQ0YsQ0FBQyJ9
\ No newline at end of file
diff --git a/dist/helpers/web3.d.ts b/dist/helpers/web3.d.ts
deleted file mode 100644
index 672ec4ea1..000000000
--- a/dist/helpers/web3.d.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Web3 Implementation for cross chain traits
- * @module
- */
-import BigNumber from "bignumber.js";
-import { TransferForeign, UnfreezeForeign, UnfreezeForeignNft, BalanceCheck, TransferNftForeign, WrappedBalanceCheck, BatchWrappedBalanceCheck, DecodeWrappedNft, DecodeRawNft, MintNft } from "./chain";
-import { Signer, BigNumber as EthBN } from 'ethers';
-import { TransactionReceipt, Provider } from "@ethersproject/providers";
-import { Interface } from "ethers/lib/utils";
-declare type EasyBalance = string | number | EthBN;
-/**
- * Information required to perform NFT transfers in this chain
- */
-export declare type EthNftInfo = {
- contract_type: "ERC721" | "ERC1155";
- contract: string;
- token: EthBN;
-};
-/**
- * Arguments required for minting a new nft
- *
- * contract: address of the sc
- * token: token ID of the newly minted nft
- * owner: Owner of the newly minted nft
- * uri: uri of the nft
- */
-export declare type MintArgs = {
- contract: string;
- token: EasyBalance;
- owner: string;
- uri: string;
-};
-/**
- * Base util traits
- */
-export declare type BaseWeb3Helper = BalanceCheck &
-/**
- * Mint an nft in the given ERC1155 smart contract
- *
- * @argument signer owner of the smart contract
- * @argument args See [[MintArgs]]
- */
-MintNft & {
- /**
- *
- * Deploy an ERC1155 smart contract
- *
- * @argument owner Owner of this smart contract
- * @returns Address of the deployed smart contract
- */
- deployErc1155(owner: Signer): Promise;
-};
-/**
- * Traits implemented by this module
- */
-export declare type Web3Helper = BaseWeb3Helper & WrappedBalanceCheck & BatchWrappedBalanceCheck & TransferForeign & TransferNftForeign & UnfreezeForeign & UnfreezeForeignNft & DecodeWrappedNft & DecodeRawNft & {
- /**
- * Get the uri of an nft given nft info
- */
- nftUri(info: EthNftInfo): Promise;
-};
-/**
- * Create an object implementing minimal utilities for a web3 chain
- *
- * @param provider An ethers.js provider object
- */
-export declare function baseWeb3HelperFactory(provider: Provider): Promise;
-/**
- * Create an object implementing cross chain utilities for a web3 chain
- *
- * @param provider An ethers.js provider object
- * @param minter_addr Address of the minter smart contract
- * @param minter_abi ABI of the minter smart contract
- */
-export declare function web3HelperFactory(provider: Provider, minter_addr: string, minter_abi: Interface, erc1155_addr: string): Promise;
-export {};
diff --git a/dist/helpers/web3.js b/dist/helpers/web3.js
deleted file mode 100644
index 6b9ac8d34..000000000
--- a/dist/helpers/web3.js
+++ /dev/null
@@ -1,167 +0,0 @@
-"use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
-};
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.web3HelperFactory = exports.baseWeb3HelperFactory = void 0;
-/**
- * Web3 Implementation for cross chain traits
- * @module
- */
-const bignumber_js_1 = __importDefault(require("bignumber.js"));
-const ethers_1 = require("ethers");
-const utils_1 = require("ethers/lib/utils");
-const fakeERC721_json_1 = require("../fakeERC721.json");
-const fakeERC1155_json_1 = require("../fakeERC1155.json");
-const ERC1155_contract = __importStar(require("../XPNet.json"));
-const encoding_1 = require("validator/dist/encoding");
-const js_base64_1 = require("js-base64");
-function contractTypeFromNftKind(kind) {
- return kind === encoding_1.NftEthNative.NftKind.ERC721 ? "ERC721" : "ERC1155";
-}
-/**
- * Create an object implementing minimal utilities for a web3 chain
- *
- * @param provider An ethers.js provider object
- */
-async function baseWeb3HelperFactory(provider) {
- const w3 = provider;
- const erc1155_abi = new utils_1.Interface(fakeERC1155_json_1.abi);
- return {
- async balance(address) {
- const bal = await w3.getBalance(address);
- // ethers BigNumber is not compatible with our bignumber
- return new bignumber_js_1.default(bal.toString());
- },
- async deployErc1155(owner) {
- const factory = ethers_1.ContractFactory.fromSolidity(ERC1155_contract, owner);
- const contract = await factory.deploy();
- return contract.address;
- },
- async mintNft(contract_owner, { contract, token, owner, uri }) {
- const erc1155 = new ethers_1.Contract(contract, erc1155_abi, contract_owner);
- await erc1155.mint(owner, ethers_1.BigNumber.from(token.toString()), 1);
- await erc1155.setURI(token, uri);
- }
- };
-}
-exports.baseWeb3HelperFactory = baseWeb3HelperFactory;
-/**
- * Create an object implementing cross chain utilities for a web3 chain
- *
- * @param provider An ethers.js provider object
- * @param minter_addr Address of the minter smart contract
- * @param minter_abi ABI of the minter smart contract
- */
-async function web3HelperFactory(provider, minter_addr, minter_abi, erc1155_addr) {
- const w3 = provider;
- const minter = new ethers_1.Contract(minter_addr, minter_abi, w3);
- const erc1155_abi = new utils_1.Interface(fakeERC1155_json_1.abi);
- const erc1155 = new ethers_1.Contract(erc1155_addr, erc1155_abi, w3);
- function signedMinter(signer) {
- return minter.connect(signer);
- }
- async function extractTxn(txr, _evName) {
- const receipt = await txr.wait();
- const log = receipt.logs.find((log) => log.address === minter.address);
- if (log === undefined) {
- throw Error("Couldn't extract action_id");
- }
- const evdat = minter_abi.parseLog(log);
- const action_id = evdat.args[0].toString();
- return [receipt, action_id];
- }
- async function nftUri(info) {
- if (info.contract_type == "ERC721") {
- const erc = new ethers_1.Contract(info.contract, fakeERC721_json_1.abi, w3);
- return await erc.tokenURI(info.token);
- }
- else {
- const erc = new ethers_1.Contract(info.contract, erc1155_abi, w3);
- return await erc.uri(info.token);
- }
- }
- const base = await baseWeb3HelperFactory(provider);
- return Object.assign(Object.assign({}, base), { async balanceWrapped(address, chain_nonce) {
- const bal = await erc1155.balanceOf(address, chain_nonce);
- return new bignumber_js_1.default(bal.toString());
- },
- async balanceWrappedBatch(address, chain_nonces) {
- const bals = await erc1155.balanceOfBatch(Array(chain_nonces.length).fill(address), chain_nonces);
- return new Map(bals.map((v, i) => [chain_nonces[i], new bignumber_js_1.default(v.toString())]));
- },
- async transferNativeToForeign(sender, chain_nonce, to, value) {
- const res = await signedMinter(sender)
- .freeze(chain_nonce, to, { value });
- return await extractTxn(res, 'Transfer');
- },
- async transferNftToForeign(sender, chain_nonce, to, id) {
- let txr;
- let ev;
- const calldata = Buffer.concat([
- Buffer.from((new Int32Array([0])).buffer),
- Buffer.from((new Int32Array([chain_nonce])).buffer).reverse(),
- Buffer.from(to, "utf-8")
- ]);
- if (id.contract_type == "ERC721") {
- ev = "TransferErc721";
- const erc = new ethers_1.Contract(id.contract, fakeERC721_json_1.abi, w3);
- txr = await erc.connect(sender)['safeTransferFrom(address,address,uint256,bytes)'](await sender.getAddress(), minter_addr, id.token, calldata);
- }
- else {
- ev = "TransferErc1155";
- const erc = new ethers_1.Contract(id.contract, erc1155_abi, w3);
- txr = await erc.connect(sender).safeTransferFrom(await sender.getAddress(), minter_addr, id.token, ethers_1.BigNumber.from(1), calldata);
- }
- return await extractTxn(txr, ev);
- },
- async unfreezeWrapped(sender, chain_nonce, to, value) {
- const res = await signedMinter(sender)
- .withdraw(chain_nonce, to, value);
- return await extractTxn(res, 'Unfreeze');
- },
- async unfreezeWrappedNft(sender, to, id) {
- const res = await signedMinter(sender)
- .withdraw_nft(to, id);
- return await extractTxn(res, 'UnfreezeNft');
- },
- nftUri,
- decodeWrappedNft(raw_data) {
- const u8D = js_base64_1.Base64.toUint8Array(raw_data);
- const packed = encoding_1.NftPacked.deserializeBinary(u8D);
- return {
- chain_nonce: packed.getChainNonce(),
- data: packed.getData_asU8()
- };
- },
- async decodeUrlFromRaw(data) {
- const packed = encoding_1.NftEthNative.deserializeBinary(data);
- const nft_info = {
- contract_type: contractTypeFromNftKind(packed.getNftKind()),
- contract: packed.getContractAddr(),
- token: ethers_1.BigNumber.from(packed.getId())
- };
- return await nftUri(nft_info);
- } });
-}
-exports.web3HelperFactory = web3HelperFactory;
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2ViMy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9oZWxwZXJzL3dlYjMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBOzs7R0FHRztBQUNILGdFQUFxQztBQUVyQyxtQ0FBK0U7QUFFL0UsNENBQTZDO0FBQzdDLHdEQUF1RDtBQUN2RCwwREFBeUQ7QUFDekQsZ0VBQWtEO0FBQ2xELHNEQUFnRTtBQUNoRSx5Q0FBbUM7QUFpRW5DLFNBQVMsdUJBQXVCLENBQUMsSUFBVztJQUMzQyxPQUFPLElBQUksS0FBSyx1QkFBWSxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsU0FBUyxDQUFBO0FBQ25FLENBQUM7QUFFRDs7OztHQUlHO0FBQ0ksS0FBSyxVQUFVLHFCQUFxQixDQUMxQyxRQUFrQjtJQUVsQixNQUFNLEVBQUUsR0FBRyxRQUFRLENBQUM7S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FBTSxHQUFHLHVCQUFZLENBQUMsaUJBQWlCLENBQUMsSUFBSSxDQUFDLENBQUM7WUFDcEQsTUFBTSxRQUFRLEdBQUc7Z0JBQ2hCLGFBQWEsRUFBRSx1QkFBdUIsQ0FBQyxNQUFNLENBQUMsVUFBVSxFQUFFLENBQUM7Z0JBQzNELFFBQVEsRUFBRSxNQUFNLENBQUMsZUFBZSxFQUFFO2dCQUNsQyxLQUFLLEVBQUUsa0JBQUssQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxDQUFDO2FBQ2pDLENBQUE7WUFHRCxPQUFPLE1BQU0sTUFBTSxDQUFDLFFBQVEsQ0FBQyxDQUFDO1FBQy9CLENBQUMsSUFDRTtBQUNMLENBQUM7QUF4SEQsOENBd0hDIn0=
\ No newline at end of file
diff --git a/dist/index.d.ts b/dist/index.d.ts
deleted file mode 100644
index ff67f35ee..000000000
--- a/dist/index.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export * from "./helpers/chain";
-export * from "./helpers/polkadot";
-export * from "./helpers/elrond";
-export * from "./helpers/web3";
-export * from "./socket";
diff --git a/dist/index.js b/dist/index.js
deleted file mode 100644
index db333d15b..000000000
--- a/dist/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-"use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
-}) : (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("./helpers/chain"), exports);
-__exportStar(require("./helpers/polkadot"), exports);
-__exportStar(require("./helpers/elrond"), exports);
-__exportStar(require("./helpers/web3"), exports);
-__exportStar(require("./socket"), exports);
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsa0RBQWdDO0FBQ2hDLHFEQUFtQztBQUNuQyxtREFBaUM7QUFDakMsaURBQStCO0FBQy9CLDJDQUF5QiJ9
\ No newline at end of file
diff --git a/dist/socket.d.ts b/dist/socket.d.ts
deleted file mode 100644
index 04ce4c8c6..000000000
--- a/dist/socket.d.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { ManagerOptions, SocketOptions } from "socket.io-client";
-/**
- * Tracker for cross chain transaction
- */
-export declare type TxnSocketHelper = {
- /**
- *
- * @param chain Nonce of the target chain
- * @param action_id Identifier for tracking a cross chain transaction
- * @returns transaction hash on the foreign chain
- */
- waitTxHash(chain: number, action_id: string): Promise;
-};
-/**
- * Create a [[TxnSocketHelper]]
- *
- * @param uri URI of the Migration-Validator socket api
- * @param options socket.io options
- */
-export declare function txnSocketHelper(uri: string, options?: Partial): TxnSocketHelper;
diff --git a/dist/socket.js b/dist/socket.js
deleted file mode 100644
index adf6bde55..000000000
--- a/dist/socket.js
+++ /dev/null
@@ -1,72 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.txnSocketHelper = void 0;
-const socket_io_client_1 = require("socket.io-client");
-function txResBuf() {
- const inner = {};
- const requireChain = (chain_id) => {
- if (inner[chain_id] === undefined) {
- inner[chain_id] = {};
- }
- };
- return {
- getResolver(chain_id, action_id) {
- var _a;
- requireChain(chain_id);
- return (_a = inner[chain_id][action_id]) === null || _a === void 0 ? void 0 : _a.resolve;
- },
- setResolver(chain_id, action_id, resolver) {
- requireChain(chain_id);
- inner[chain_id][action_id] = { resolve: resolver };
- },
- getEventRes(chain_id, action_id) {
- var _a;
- requireChain(chain_id);
- return (_a = inner[chain_id][action_id]) === null || _a === void 0 ? void 0 : _a.event_res;
- },
- setEventRes(chain_id, action_id, res) {
- requireChain(chain_id);
- inner[chain_id][action_id] = { event_res: res };
- },
- unsetAction(chain_id, action_id) {
- requireChain(chain_id);
- inner[chain_id][action_id] = undefined;
- }
- };
-}
-/**
- * Create a [[TxnSocketHelper]]
- *
- * @param uri URI of the Migration-Validator socket api
- * @param options socket.io options
- */
-function txnSocketHelper(uri, options) {
- const socket = socket_io_client_1.io(uri, options);
- const buf = txResBuf();
- function add_event(chain, id, hash) {
- const resolve = buf.getResolver(chain, id);
- if (resolve === undefined) {
- buf.setEventRes(chain, id, hash);
- return;
- }
- resolve(hash);
- }
- socket.on("tx_executed_event", (chain, action_id, hash) => {
- add_event(chain, action_id, hash);
- });
- return {
- async waitTxHash(chain, action_id) {
- const hash = buf.getEventRes(chain, action_id);
- if (hash !== undefined) {
- buf.unsetAction(chain, action_id);
- return hash;
- }
- const hashP = new Promise(r => {
- buf.setResolver(chain, action_id, r);
- });
- return await hashP;
- }
- };
-}
-exports.txnSocketHelper = txnSocketHelper;
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic29ja2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3NvY2tldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSx1REFBcUU7QUFrQ3JFLFNBQVMsUUFBUTtJQUNoQixNQUFNLEtBQUssR0FBa0IsRUFBRSxDQUFDO0lBRWhDLE1BQU0sWUFBWSxHQUFHLENBQUMsUUFBZ0IsRUFBRSxFQUFFO1FBQ3pDLElBQUksS0FBSyxDQUFDLFFBQVEsQ0FBQyxLQUFLLFNBQVMsRUFBRTtZQUNsQyxLQUFLLENBQUMsUUFBUSxDQUFDLEdBQUcsRUFBRSxDQUFDO1NBQ3JCO0lBQ0YsQ0FBQyxDQUFBO0lBRUQsT0FBT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SxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUU7Z0JBQzlDLEdBQUcsQ0FBQyxXQUFXLENBQUMsS0FBSyxFQUFFLFNBQVMsRUFBRSxDQUFDLENBQUMsQ0FBQztZQUN0QyxDQUFDLENBQUMsQ0FBQztZQUVILE9BQU8sTUFBTSxLQUFLLENBQUM7UUFDcEIsQ0FBQztLQUNHLENBQUE7QUFDTixDQUFDO0FBcENELDBDQW9DQyJ9
\ No newline at end of file
diff --git a/package.json b/package.json
index bc28c6d0e..8ce7d6707 100644
--- a/package.json
+++ b/package.json
@@ -1,35 +1,83 @@
{
- "name": "testsuite-ts",
- "version": "1.0.0",
- "author": "rupansh ",
+ "name": "xp.network",
+ "version": "4.1.0",
+ "author": "xp-network ",
+ "description": "XP.Network Multi-Chain NFT Bridge JavaScript API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
+ "type": "commonjs",
"license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/XP-NETWORK/xpjs"
+ },
"scripts": {
- "build": "tsc -p tsconfig.json"
+ "build": "tsc -p tsconfig.json",
+ "format": "prettier . --write",
+ "prepare": "husky install"
},
"devDependencies": {
+ "@types/bn.js": "^5.1.0",
+ "@types/node": "^18.7.13",
+ "@typescript-eslint/eslint-plugin": "^4.31.0",
"@typescript-eslint/parser": "^4.28.3",
+ "dotenv": "^16.0.0",
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0",
+ "eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^3.2.1",
+ "husky": "^8.0.0",
"prettier": "^2.3.2",
- "typedoc": "^0.21.0",
- "typescript": "^4.3.5"
+ "pretty-quick": "^3.1.3",
+ "typedoc": "^0.22.6",
+ "typescript": "^4.9.3",
+ "yarn-audit-fix": "^9.3.7"
},
"dependencies": {
- "@elrondnetwork/erdjs": "^6.2.0",
- "@polkadot/api": "^5.2.1",
- "@polkadot/api-contract": "^5.2.1",
- "@polkadot/keyring": "^7.0.3",
- "@polkadot/types": "^5.2.1",
- "@polkadot/util": "^7.1.1",
- "@polkadot/util-crypto": "^7.1.1",
+ "@dfinity/agent": "^0.11.3",
+ "@dfinity/candid": "^0.11.3",
+ "@dfinity/identity": "^0.12.2",
+ "@dfinity/nns": "^0.5.0",
+ "@dfinity/principal": "^0.11.3",
+ "@elrondnetwork/erdjs": "9.0.3",
+ "@ethersproject/providers": "^5.7.0",
+ "@hashgraph/hethers": "1.1.2",
+ "@hashgraph/sdk": "^2.23.0",
+ "@json-rpc-tools/utils": "^1.7.6",
+ "@metaplex-foundation/js": "0.17.6",
+ "@multiversx/sdk-core": "^11.4.1",
+ "@project-serum/anchor": "^0.25.0-beta.1",
+ "@randlabs/myalgo-connect": "^1.1.1",
+ "@solana/spl-token": "^0.2.0",
+ "@solana/web3.js": "^1.44.2",
+ "@taquito/signer": "^13.0.0",
+ "@taquito/taquito": "^13.0.0",
+ "@taquito/tzip12": "^13.0.0",
+ "@taquito/utils": "^13.0.1",
+ "@vechain/connex-driver": "^2.0.8",
+ "@vechain/connex-framework": "^2.0.8",
+ "@vechain/ethers": "^4.0.27-5",
+ "@walletconnect/client": "^1.7.0",
+ "algosdk": "^1.15.0-beta.1",
+ "aptos": "^1.6.0",
"axios": "^0.21.1",
- "bignumber.js": "^9.0.1",
- "ethers": "^5.4.1",
+ "base64url": "^3.0.1",
+ "bignumber.js": "=9.0.1",
+ "bn.js": "^5.2.1",
+ "buffer": "^6.0.3",
+ "crypto-exchange-rate": "git+https://github.com/xp-network/exchange-rate#a2915673342ee33aedd1cb4a12b304c36f55fa15",
+ "ethers": "^5.5.4",
+ "google-protobuf": "^3.20.1",
"js-base64": "^3.6.1",
+ "near-api-js": "1.0.0",
+ "secretjs": "=1.4.7",
"socket.io-client": "^4.1.3",
- "validator": "git+https://github.com/xp-network/migration-validator#master"
+ "ton-x": "^2.0.0",
+ "tonweb": "^0.0.57",
+ "tonweb-mnemonic": "^1.0.1",
+ "tronstation": "^1.0.1",
+ "tronweb": "^4.1.0",
+ "web3-providers-connex": "^0.3.1",
+ "xpnet-web3-contracts": "git+https://github.com/xp-network/XP.network-HECO-Migration#aa9473ea3b0f748bba54f5755abcfd17e3548237"
}
}
diff --git a/src/XPNet.json b/src/XPNet.json
deleted file mode 100644
index c280aaff5..000000000
--- a/src/XPNet.json
+++ /dev/null
@@ -1,444 +0,0 @@
-{
- "_format": "hh-sol-artifact-1",
- "contractName": "XPNet",
- "sourceName": "contracts/XPNet.sol",
- "abi": [
- {
- "inputs": [],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "bool",
- "name": "approved",
- "type": "bool"
- }
- ],
- "name": "ApprovalForAll",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "previousOwner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "OwnershipTransferred",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- },
- {
- "indexed": false,
- "internalType": "uint256[]",
- "name": "values",
- "type": "uint256[]"
- }
- ],
- "name": "TransferBatch",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "TransferSingle",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": false,
- "internalType": "string",
- "name": "value",
- "type": "string"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "URI",
- "type": "event"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "balanceOf",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address[]",
- "name": "accounts",
- "type": "address[]"
- },
- {
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- }
- ],
- "name": "balanceOfBatch",
- "outputs": [
- {
- "internalType": "uint256[]",
- "name": "",
- "type": "uint256[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "burn",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "operator",
- "type": "address"
- }
- ],
- "name": "isApprovedForAll",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "mint",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "renounceOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- },
- {
- "internalType": "uint256[]",
- "name": "amounts",
- "type": "uint256[]"
- },
- {
- "internalType": "bytes",
- "name": "data",
- "type": "bytes"
- }
- ],
- "name": "safeBatchTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- },
- {
- "internalType": "bytes",
- "name": "data",
- "type": "bytes"
- }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "internalType": "bool",
- "name": "approved",
- "type": "bool"
- }
- ],
- "name": "setApprovalForAll",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "string",
- "name": "uri_",
- "type": "string"
- }
- ],
- "name": "setURI",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes4",
- "name": "interfaceId",
- "type": "bytes4"
- }
- ],
- "name": "supportsInterface",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "transferOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "uri",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }
- ],
- "bytecode": "0x60806040523480156200001157600080fd5b506040518060200160405280600081525062000033816200005a60201b60201c565b5062000054620000486200007660201b60201c565b6200007e60201b60201c565b62000259565b80600290805190602001906200007292919062000144565b5050565b600033905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8280546200015290620001f4565b90600052602060002090601f016020900481019282620001765760008555620001c2565b82601f106200019157805160ff1916838001178555620001c2565b82800160010185558215620001c2579182015b82811115620001c1578251825591602001919060010190620001a4565b5b509050620001d19190620001d5565b5090565b5b80821115620001f0576000816000905550600101620001d6565b5090565b600060028204905060018216806200020d57607f821691505b602082108114156200022457620002236200022a565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6133c680620002696000396000f3fe608060405234801561001057600080fd5b50600436106100e95760003560e01c8063862440e21161008c578063e985e9c511610066578063e985e9c514610246578063f242432a14610276578063f2fde38b14610292578063f5298aca146102ae576100e9565b8063862440e2146101f05780638da5cb5b1461020c578063a22cb4651461022a576100e9565b8063156e29f6116100c8578063156e29f61461017e5780632eb2c2d61461019a5780634e1273f4146101b6578063715018a6146101e6576100e9565b8062fdd58e146100ee57806301ffc9a71461011e5780630e89341c1461014e575b600080fd5b610108600480360381019061010391906121ed565b6102ca565b6040516101159190612a3b565b60405180910390f35b610138600480360381019061013391906122e4565b610393565b604051610145919061281e565b60405180910390f35b61016860048036038101906101639190612336565b610475565b6040516101759190612839565b60405180910390f35b61019860048036038101906101939190612229565b61051a565b005b6101b460048036038101906101af9190612063565b6105b6565b005b6101d060048036038101906101cb9190612278565b610657565b6040516101dd91906127c5565b60405180910390f35b6101ee610808565b005b61020a6004803603810190610205919061235f565b610890565b005b610214610934565b60405161022191906126e8565b60405180910390f35b610244600480360381019061023f91906121b1565b61095e565b005b610260600480360381019061025b9190612027565b610adf565b60405161026d919061281e565b60405180910390f35b610290600480360381019061028b9190612122565b610b73565b005b6102ac60048036038101906102a79190611ffe565b610c14565b005b6102c860048036038101906102c39190612229565b610d0c565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561033b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103329061289b565b60405180910390fd5b60008083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061045e57507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061046e575061046d82610d98565b5b9050919050565b606060046000838152602001908152602001600020805461049590612caa565b80601f01602080910402602001604051908101604052809291908181526020018280546104c190612caa565b801561050e5780601f106104e35761010080835404028352916020019161050e565b820191906000526020600020905b8154815290600101906020018083116104f157829003601f168201915b50505050509050919050565b610522610e02565b73ffffffffffffffffffffffffffffffffffffffff16610540610934565b73ffffffffffffffffffffffffffffffffffffffff1614610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d9061299b565b60405180910390fd5b6105b183838360405180602001604052806000815250610e0a565b505050565b6105be610e02565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614806106045750610603856105fe610e02565b610adf565b5b610643576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063a9061293b565b60405180910390fd5b6106508585858585610fa0565b5050505050565b6060815183511461069d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610694906129db565b60405180910390fd5b6000835167ffffffffffffffff8111156106e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561070e5781602001602082028036833780820191505090505b50905060005b84518110156107fd576107a7858281518110610759577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015185838151811061079a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516102ca565b8282815181106107e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018181525050806107f690612d0d565b9050610714565b508091505092915050565b610810610e02565b73ffffffffffffffffffffffffffffffffffffffff1661082e610934565b73ffffffffffffffffffffffffffffffffffffffff1614610884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087b9061299b565b60405180910390fd5b61088e6000611300565b565b610898610e02565b73ffffffffffffffffffffffffffffffffffffffff166108b6610934565b73ffffffffffffffffffffffffffffffffffffffff161461090c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109039061299b565b60405180910390fd5b818160046000868152602001908152602001600020919061092e929190611d14565b50505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b8173ffffffffffffffffffffffffffffffffffffffff1661097d610e02565b73ffffffffffffffffffffffffffffffffffffffff1614156109d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109cb906129bb565b60405180910390fd5b80600160006109e1610e02565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16610a8e610e02565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610ad3919061281e565b60405180910390a35050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610b7b610e02565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610bc15750610bc085610bbb610e02565b610adf565b5b610c00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf7906128fb565b60405180910390fd5b610c0d85858585856113c6565b5050505050565b610c1c610e02565b73ffffffffffffffffffffffffffffffffffffffff16610c3a610934565b73ffffffffffffffffffffffffffffffffffffffff1614610c90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c879061299b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610d00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf7906128bb565b60405180910390fd5b610d0981611300565b50565b610d14610e02565b73ffffffffffffffffffffffffffffffffffffffff16610d32610934565b73ffffffffffffffffffffffffffffffffffffffff1614610d88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7f9061299b565b60405180910390fd5b610d93838383611648565b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610e7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7190612a1b565b60405180910390fd5b6000610e84610e02565b9050610ea581600087610e9688611865565b610e9f88611865565b8761192b565b8260008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f049190612b9e565b925050819055508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051610f82929190612a56565b60405180910390a4610f9981600087878787611933565b5050505050565b8151835114610fe4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fdb906129fb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611054576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104b9061291b565b60405180910390fd5b600061105e610e02565b905061106e81878787878761192b565b60005b845181101561126b5760008582815181106110b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060008583815181106110fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600080600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561119b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111929061297b565b60405180910390fd5b81810360008085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112509190612b9e565b925050819055505050508061126490612d0d565b9050611071565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516112e29291906127e7565b60405180910390a46112f8818787878787611b1a565b505050505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611436576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142d9061291b565b60405180910390fd5b6000611440610e02565b905061146081878761145188611865565b61145a88611865565b8761192b565b600080600086815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156114f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ee9061297b565b60405180910390fd5b83810360008087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508360008087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546115ac9190612b9e565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628888604051611629929190612a56565b60405180910390a461163f828888888888611933565b50505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116af9061295b565b60405180910390fd5b60006116c2610e02565b90506116f2818560006116d487611865565b6116dd87611865565b6040518060200160405280600081525061192b565b600080600085815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015611789576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611780906128db565b60405180910390fd5b82810360008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051611856929190612a56565b60405180910390a45050505050565b60606000600167ffffffffffffffff8111156118aa577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156118d85781602001602082028036833780820191505090505b5090508281600081518110611916577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101818152505080915050919050565b505050505050565b6119528473ffffffffffffffffffffffffffffffffffffffff16611d01565b15611b12578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b815260040161199895949392919061276b565b602060405180830381600087803b1580156119b257600080fd5b505af19250505080156119e357506040513d601f19601f820116820180604052508101906119e0919061230d565b60015b611a89576119ef612de3565b806308c379a01415611a4c5750611a0461329e565b80611a0f5750611a4e565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a439190612839565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a809061285b565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611b10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b079061287b565b60405180910390fd5b505b505050505050565b611b398473ffffffffffffffffffffffffffffffffffffffff16611d01565b15611cf9578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b8152600401611b7f959493929190612703565b602060405180830381600087803b158015611b9957600080fd5b505af1925050508015611bca57506040513d601f19601f82011682018060405250810190611bc7919061230d565b60015b611c7057611bd6612de3565b806308c379a01415611c335750611beb61329e565b80611bf65750611c35565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2a9190612839565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c679061285b565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611cf7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cee9061287b565b60405180910390fd5b505b505050505050565b600080823b905060008111915050919050565b828054611d2090612caa565b90600052602060002090601f016020900481019282611d425760008555611d89565b82601f10611d5b57803560ff1916838001178555611d89565b82800160010185558215611d89579182015b82811115611d88578235825591602001919060010190611d6d565b5b509050611d969190611d9a565b5090565b5b80821115611db3576000816000905550600101611d9b565b5090565b6000611dca611dc584612aa4565b612a7f565b90508083825260208201905082856020860282011115611de957600080fd5b60005b85811015611e195781611dff8882611ecd565b845260208401935060208301925050600181019050611dec565b5050509392505050565b6000611e36611e3184612ad0565b612a7f565b90508083825260208201905082856020860282011115611e5557600080fd5b60005b85811015611e855781611e6b8882611fe9565b845260208401935060208301925050600181019050611e58565b5050509392505050565b6000611ea2611e9d84612afc565b612a7f565b905082815260208101848484011115611eba57600080fd5b611ec5848285612c68565b509392505050565b600081359050611edc81613334565b92915050565b600082601f830112611ef357600080fd5b8135611f03848260208601611db7565b91505092915050565b600082601f830112611f1d57600080fd5b8135611f2d848260208601611e23565b91505092915050565b600081359050611f458161334b565b92915050565b600081359050611f5a81613362565b92915050565b600081519050611f6f81613362565b92915050565b600082601f830112611f8657600080fd5b8135611f96848260208601611e8f565b91505092915050565b60008083601f840112611fb157600080fd5b8235905067ffffffffffffffff811115611fca57600080fd5b602083019150836001820283011115611fe257600080fd5b9250929050565b600081359050611ff881613379565b92915050565b60006020828403121561201057600080fd5b600061201e84828501611ecd565b91505092915050565b6000806040838503121561203a57600080fd5b600061204885828601611ecd565b925050602061205985828601611ecd565b9150509250929050565b600080600080600060a0868803121561207b57600080fd5b600061208988828901611ecd565b955050602061209a88828901611ecd565b945050604086013567ffffffffffffffff8111156120b757600080fd5b6120c388828901611f0c565b935050606086013567ffffffffffffffff8111156120e057600080fd5b6120ec88828901611f0c565b925050608086013567ffffffffffffffff81111561210957600080fd5b61211588828901611f75565b9150509295509295909350565b600080600080600060a0868803121561213a57600080fd5b600061214888828901611ecd565b955050602061215988828901611ecd565b945050604061216a88828901611fe9565b935050606061217b88828901611fe9565b925050608086013567ffffffffffffffff81111561219857600080fd5b6121a488828901611f75565b9150509295509295909350565b600080604083850312156121c457600080fd5b60006121d285828601611ecd565b92505060206121e385828601611f36565b9150509250929050565b6000806040838503121561220057600080fd5b600061220e85828601611ecd565b925050602061221f85828601611fe9565b9150509250929050565b60008060006060848603121561223e57600080fd5b600061224c86828701611ecd565b935050602061225d86828701611fe9565b925050604061226e86828701611fe9565b9150509250925092565b6000806040838503121561228b57600080fd5b600083013567ffffffffffffffff8111156122a557600080fd5b6122b185828601611ee2565b925050602083013567ffffffffffffffff8111156122ce57600080fd5b6122da85828601611f0c565b9150509250929050565b6000602082840312156122f657600080fd5b600061230484828501611f4b565b91505092915050565b60006020828403121561231f57600080fd5b600061232d84828501611f60565b91505092915050565b60006020828403121561234857600080fd5b600061235684828501611fe9565b91505092915050565b60008060006040848603121561237457600080fd5b600061238286828701611fe9565b935050602084013567ffffffffffffffff81111561239f57600080fd5b6123ab86828701611f9f565b92509250509250925092565b60006123c383836126ca565b60208301905092915050565b6123d881612bf4565b82525050565b60006123e982612b3d565b6123f38185612b6b565b93506123fe83612b2d565b8060005b8381101561242f57815161241688826123b7565b975061242183612b5e565b925050600181019050612402565b5085935050505092915050565b61244581612c06565b82525050565b600061245682612b48565b6124608185612b7c565b9350612470818560208601612c77565b61247981612e05565b840191505092915050565b600061248f82612b53565b6124998185612b8d565b93506124a9818560208601612c77565b6124b281612e05565b840191505092915050565b60006124ca603483612b8d565b91506124d582612e23565b604082019050919050565b60006124ed602883612b8d565b91506124f882612e72565b604082019050919050565b6000612510602b83612b8d565b915061251b82612ec1565b604082019050919050565b6000612533602683612b8d565b915061253e82612f10565b604082019050919050565b6000612556602483612b8d565b915061256182612f5f565b604082019050919050565b6000612579602983612b8d565b915061258482612fae565b604082019050919050565b600061259c602583612b8d565b91506125a782612ffd565b604082019050919050565b60006125bf603283612b8d565b91506125ca8261304c565b604082019050919050565b60006125e2602383612b8d565b91506125ed8261309b565b604082019050919050565b6000612605602a83612b8d565b9150612610826130ea565b604082019050919050565b6000612628602083612b8d565b915061263382613139565b602082019050919050565b600061264b602983612b8d565b915061265682613162565b604082019050919050565b600061266e602983612b8d565b9150612679826131b1565b604082019050919050565b6000612691602883612b8d565b915061269c82613200565b604082019050919050565b60006126b4602183612b8d565b91506126bf8261324f565b604082019050919050565b6126d381612c5e565b82525050565b6126e281612c5e565b82525050565b60006020820190506126fd60008301846123cf565b92915050565b600060a08201905061271860008301886123cf565b61272560208301876123cf565b818103604083015261273781866123de565b9050818103606083015261274b81856123de565b9050818103608083015261275f818461244b565b90509695505050505050565b600060a08201905061278060008301886123cf565b61278d60208301876123cf565b61279a60408301866126d9565b6127a760608301856126d9565b81810360808301526127b9818461244b565b90509695505050505050565b600060208201905081810360008301526127df81846123de565b905092915050565b6000604082019050818103600083015261280181856123de565b9050818103602083015261281581846123de565b90509392505050565b6000602082019050612833600083018461243c565b92915050565b600060208201905081810360008301526128538184612484565b905092915050565b60006020820190508181036000830152612874816124bd565b9050919050565b60006020820190508181036000830152612894816124e0565b9050919050565b600060208201905081810360008301526128b481612503565b9050919050565b600060208201905081810360008301526128d481612526565b9050919050565b600060208201905081810360008301526128f481612549565b9050919050565b600060208201905081810360008301526129148161256c565b9050919050565b600060208201905081810360008301526129348161258f565b9050919050565b60006020820190508181036000830152612954816125b2565b9050919050565b60006020820190508181036000830152612974816125d5565b9050919050565b60006020820190508181036000830152612994816125f8565b9050919050565b600060208201905081810360008301526129b48161261b565b9050919050565b600060208201905081810360008301526129d48161263e565b9050919050565b600060208201905081810360008301526129f481612661565b9050919050565b60006020820190508181036000830152612a1481612684565b9050919050565b60006020820190508181036000830152612a34816126a7565b9050919050565b6000602082019050612a5060008301846126d9565b92915050565b6000604082019050612a6b60008301856126d9565b612a7860208301846126d9565b9392505050565b6000612a89612a9a565b9050612a958282612cdc565b919050565b6000604051905090565b600067ffffffffffffffff821115612abf57612abe612db4565b5b602082029050602081019050919050565b600067ffffffffffffffff821115612aeb57612aea612db4565b5b602082029050602081019050919050565b600067ffffffffffffffff821115612b1757612b16612db4565b5b612b2082612e05565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ba982612c5e565b9150612bb483612c5e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612be957612be8612d56565b5b828201905092915050565b6000612bff82612c3e565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015612c95578082015181840152602081019050612c7a565b83811115612ca4576000848401525b50505050565b60006002820490506001821680612cc257607f821691505b60208210811415612cd657612cd5612d85565b5b50919050565b612ce582612e05565b810181811067ffffffffffffffff82111715612d0457612d03612db4565b5b80604052505050565b6000612d1882612c5e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d4b57612d4a612d56565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060033d1115612e025760046000803e612dff600051612e16565b90505b90565b6000601f19601f8301169050919050565b60008160e01c9050919050565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206275726e20616d6f756e7420657863656564732062616c60008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b7f455243313135353a206275726e2066726f6d20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b600060443d10156132ae57613331565b6132b6612a9a565b60043d036004823e80513d602482011167ffffffffffffffff821117156132de575050613331565b808201805167ffffffffffffffff8111156132fc5750505050613331565b80602083010160043d038501811115613319575050505050613331565b61332882602001850186612cdc565b82955050505050505b90565b61333d81612bf4565b811461334857600080fd5b50565b61335481612c06565b811461335f57600080fd5b50565b61336b81612c12565b811461337657600080fd5b50565b61338281612c5e565b811461338d57600080fd5b5056fea26469706673582212207c954b474ba2938a61031705a0987bcb898a0dffe9cb3f5a8744e3e16585386e64736f6c63430008040033",
- "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100e95760003560e01c8063862440e21161008c578063e985e9c511610066578063e985e9c514610246578063f242432a14610276578063f2fde38b14610292578063f5298aca146102ae576100e9565b8063862440e2146101f05780638da5cb5b1461020c578063a22cb4651461022a576100e9565b8063156e29f6116100c8578063156e29f61461017e5780632eb2c2d61461019a5780634e1273f4146101b6578063715018a6146101e6576100e9565b8062fdd58e146100ee57806301ffc9a71461011e5780630e89341c1461014e575b600080fd5b610108600480360381019061010391906121ed565b6102ca565b6040516101159190612a3b565b60405180910390f35b610138600480360381019061013391906122e4565b610393565b604051610145919061281e565b60405180910390f35b61016860048036038101906101639190612336565b610475565b6040516101759190612839565b60405180910390f35b61019860048036038101906101939190612229565b61051a565b005b6101b460048036038101906101af9190612063565b6105b6565b005b6101d060048036038101906101cb9190612278565b610657565b6040516101dd91906127c5565b60405180910390f35b6101ee610808565b005b61020a6004803603810190610205919061235f565b610890565b005b610214610934565b60405161022191906126e8565b60405180910390f35b610244600480360381019061023f91906121b1565b61095e565b005b610260600480360381019061025b9190612027565b610adf565b60405161026d919061281e565b60405180910390f35b610290600480360381019061028b9190612122565b610b73565b005b6102ac60048036038101906102a79190611ffe565b610c14565b005b6102c860048036038101906102c39190612229565b610d0c565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561033b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103329061289b565b60405180910390fd5b60008083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061045e57507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061046e575061046d82610d98565b5b9050919050565b606060046000838152602001908152602001600020805461049590612caa565b80601f01602080910402602001604051908101604052809291908181526020018280546104c190612caa565b801561050e5780601f106104e35761010080835404028352916020019161050e565b820191906000526020600020905b8154815290600101906020018083116104f157829003601f168201915b50505050509050919050565b610522610e02565b73ffffffffffffffffffffffffffffffffffffffff16610540610934565b73ffffffffffffffffffffffffffffffffffffffff1614610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d9061299b565b60405180910390fd5b6105b183838360405180602001604052806000815250610e0a565b505050565b6105be610e02565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614806106045750610603856105fe610e02565b610adf565b5b610643576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063a9061293b565b60405180910390fd5b6106508585858585610fa0565b5050505050565b6060815183511461069d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610694906129db565b60405180910390fd5b6000835167ffffffffffffffff8111156106e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561070e5781602001602082028036833780820191505090505b50905060005b84518110156107fd576107a7858281518110610759577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015185838151811061079a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516102ca565b8282815181106107e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018181525050806107f690612d0d565b9050610714565b508091505092915050565b610810610e02565b73ffffffffffffffffffffffffffffffffffffffff1661082e610934565b73ffffffffffffffffffffffffffffffffffffffff1614610884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087b9061299b565b60405180910390fd5b61088e6000611300565b565b610898610e02565b73ffffffffffffffffffffffffffffffffffffffff166108b6610934565b73ffffffffffffffffffffffffffffffffffffffff161461090c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109039061299b565b60405180910390fd5b818160046000868152602001908152602001600020919061092e929190611d14565b50505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b8173ffffffffffffffffffffffffffffffffffffffff1661097d610e02565b73ffffffffffffffffffffffffffffffffffffffff1614156109d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109cb906129bb565b60405180910390fd5b80600160006109e1610e02565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16610a8e610e02565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610ad3919061281e565b60405180910390a35050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610b7b610e02565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610bc15750610bc085610bbb610e02565b610adf565b5b610c00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf7906128fb565b60405180910390fd5b610c0d85858585856113c6565b5050505050565b610c1c610e02565b73ffffffffffffffffffffffffffffffffffffffff16610c3a610934565b73ffffffffffffffffffffffffffffffffffffffff1614610c90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c879061299b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610d00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf7906128bb565b60405180910390fd5b610d0981611300565b50565b610d14610e02565b73ffffffffffffffffffffffffffffffffffffffff16610d32610934565b73ffffffffffffffffffffffffffffffffffffffff1614610d88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7f9061299b565b60405180910390fd5b610d93838383611648565b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610e7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7190612a1b565b60405180910390fd5b6000610e84610e02565b9050610ea581600087610e9688611865565b610e9f88611865565b8761192b565b8260008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f049190612b9e565b925050819055508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051610f82929190612a56565b60405180910390a4610f9981600087878787611933565b5050505050565b8151835114610fe4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fdb906129fb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611054576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104b9061291b565b60405180910390fd5b600061105e610e02565b905061106e81878787878761192b565b60005b845181101561126b5760008582815181106110b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060008583815181106110fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600080600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561119b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111929061297b565b60405180910390fd5b81810360008085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112509190612b9e565b925050819055505050508061126490612d0d565b9050611071565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516112e29291906127e7565b60405180910390a46112f8818787878787611b1a565b505050505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611436576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142d9061291b565b60405180910390fd5b6000611440610e02565b905061146081878761145188611865565b61145a88611865565b8761192b565b600080600086815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156114f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ee9061297b565b60405180910390fd5b83810360008087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508360008087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546115ac9190612b9e565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628888604051611629929190612a56565b60405180910390a461163f828888888888611933565b50505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116af9061295b565b60405180910390fd5b60006116c2610e02565b90506116f2818560006116d487611865565b6116dd87611865565b6040518060200160405280600081525061192b565b600080600085815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015611789576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611780906128db565b60405180910390fd5b82810360008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051611856929190612a56565b60405180910390a45050505050565b60606000600167ffffffffffffffff8111156118aa577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156118d85781602001602082028036833780820191505090505b5090508281600081518110611916577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101818152505080915050919050565b505050505050565b6119528473ffffffffffffffffffffffffffffffffffffffff16611d01565b15611b12578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b815260040161199895949392919061276b565b602060405180830381600087803b1580156119b257600080fd5b505af19250505080156119e357506040513d601f19601f820116820180604052508101906119e0919061230d565b60015b611a89576119ef612de3565b806308c379a01415611a4c5750611a0461329e565b80611a0f5750611a4e565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a439190612839565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a809061285b565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611b10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b079061287b565b60405180910390fd5b505b505050505050565b611b398473ffffffffffffffffffffffffffffffffffffffff16611d01565b15611cf9578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b8152600401611b7f959493929190612703565b602060405180830381600087803b158015611b9957600080fd5b505af1925050508015611bca57506040513d601f19601f82011682018060405250810190611bc7919061230d565b60015b611c7057611bd6612de3565b806308c379a01415611c335750611beb61329e565b80611bf65750611c35565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2a9190612839565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c679061285b565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611cf7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cee9061287b565b60405180910390fd5b505b505050505050565b600080823b905060008111915050919050565b828054611d2090612caa565b90600052602060002090601f016020900481019282611d425760008555611d89565b82601f10611d5b57803560ff1916838001178555611d89565b82800160010185558215611d89579182015b82811115611d88578235825591602001919060010190611d6d565b5b509050611d969190611d9a565b5090565b5b80821115611db3576000816000905550600101611d9b565b5090565b6000611dca611dc584612aa4565b612a7f565b90508083825260208201905082856020860282011115611de957600080fd5b60005b85811015611e195781611dff8882611ecd565b845260208401935060208301925050600181019050611dec565b5050509392505050565b6000611e36611e3184612ad0565b612a7f565b90508083825260208201905082856020860282011115611e5557600080fd5b60005b85811015611e855781611e6b8882611fe9565b845260208401935060208301925050600181019050611e58565b5050509392505050565b6000611ea2611e9d84612afc565b612a7f565b905082815260208101848484011115611eba57600080fd5b611ec5848285612c68565b509392505050565b600081359050611edc81613334565b92915050565b600082601f830112611ef357600080fd5b8135611f03848260208601611db7565b91505092915050565b600082601f830112611f1d57600080fd5b8135611f2d848260208601611e23565b91505092915050565b600081359050611f458161334b565b92915050565b600081359050611f5a81613362565b92915050565b600081519050611f6f81613362565b92915050565b600082601f830112611f8657600080fd5b8135611f96848260208601611e8f565b91505092915050565b60008083601f840112611fb157600080fd5b8235905067ffffffffffffffff811115611fca57600080fd5b602083019150836001820283011115611fe257600080fd5b9250929050565b600081359050611ff881613379565b92915050565b60006020828403121561201057600080fd5b600061201e84828501611ecd565b91505092915050565b6000806040838503121561203a57600080fd5b600061204885828601611ecd565b925050602061205985828601611ecd565b9150509250929050565b600080600080600060a0868803121561207b57600080fd5b600061208988828901611ecd565b955050602061209a88828901611ecd565b945050604086013567ffffffffffffffff8111156120b757600080fd5b6120c388828901611f0c565b935050606086013567ffffffffffffffff8111156120e057600080fd5b6120ec88828901611f0c565b925050608086013567ffffffffffffffff81111561210957600080fd5b61211588828901611f75565b9150509295509295909350565b600080600080600060a0868803121561213a57600080fd5b600061214888828901611ecd565b955050602061215988828901611ecd565b945050604061216a88828901611fe9565b935050606061217b88828901611fe9565b925050608086013567ffffffffffffffff81111561219857600080fd5b6121a488828901611f75565b9150509295509295909350565b600080604083850312156121c457600080fd5b60006121d285828601611ecd565b92505060206121e385828601611f36565b9150509250929050565b6000806040838503121561220057600080fd5b600061220e85828601611ecd565b925050602061221f85828601611fe9565b9150509250929050565b60008060006060848603121561223e57600080fd5b600061224c86828701611ecd565b935050602061225d86828701611fe9565b925050604061226e86828701611fe9565b9150509250925092565b6000806040838503121561228b57600080fd5b600083013567ffffffffffffffff8111156122a557600080fd5b6122b185828601611ee2565b925050602083013567ffffffffffffffff8111156122ce57600080fd5b6122da85828601611f0c565b9150509250929050565b6000602082840312156122f657600080fd5b600061230484828501611f4b565b91505092915050565b60006020828403121561231f57600080fd5b600061232d84828501611f60565b91505092915050565b60006020828403121561234857600080fd5b600061235684828501611fe9565b91505092915050565b60008060006040848603121561237457600080fd5b600061238286828701611fe9565b935050602084013567ffffffffffffffff81111561239f57600080fd5b6123ab86828701611f9f565b92509250509250925092565b60006123c383836126ca565b60208301905092915050565b6123d881612bf4565b82525050565b60006123e982612b3d565b6123f38185612b6b565b93506123fe83612b2d565b8060005b8381101561242f57815161241688826123b7565b975061242183612b5e565b925050600181019050612402565b5085935050505092915050565b61244581612c06565b82525050565b600061245682612b48565b6124608185612b7c565b9350612470818560208601612c77565b61247981612e05565b840191505092915050565b600061248f82612b53565b6124998185612b8d565b93506124a9818560208601612c77565b6124b281612e05565b840191505092915050565b60006124ca603483612b8d565b91506124d582612e23565b604082019050919050565b60006124ed602883612b8d565b91506124f882612e72565b604082019050919050565b6000612510602b83612b8d565b915061251b82612ec1565b604082019050919050565b6000612533602683612b8d565b915061253e82612f10565b604082019050919050565b6000612556602483612b8d565b915061256182612f5f565b604082019050919050565b6000612579602983612b8d565b915061258482612fae565b604082019050919050565b600061259c602583612b8d565b91506125a782612ffd565b604082019050919050565b60006125bf603283612b8d565b91506125ca8261304c565b604082019050919050565b60006125e2602383612b8d565b91506125ed8261309b565b604082019050919050565b6000612605602a83612b8d565b9150612610826130ea565b604082019050919050565b6000612628602083612b8d565b915061263382613139565b602082019050919050565b600061264b602983612b8d565b915061265682613162565b604082019050919050565b600061266e602983612b8d565b9150612679826131b1565b604082019050919050565b6000612691602883612b8d565b915061269c82613200565b604082019050919050565b60006126b4602183612b8d565b91506126bf8261324f565b604082019050919050565b6126d381612c5e565b82525050565b6126e281612c5e565b82525050565b60006020820190506126fd60008301846123cf565b92915050565b600060a08201905061271860008301886123cf565b61272560208301876123cf565b818103604083015261273781866123de565b9050818103606083015261274b81856123de565b9050818103608083015261275f818461244b565b90509695505050505050565b600060a08201905061278060008301886123cf565b61278d60208301876123cf565b61279a60408301866126d9565b6127a760608301856126d9565b81810360808301526127b9818461244b565b90509695505050505050565b600060208201905081810360008301526127df81846123de565b905092915050565b6000604082019050818103600083015261280181856123de565b9050818103602083015261281581846123de565b90509392505050565b6000602082019050612833600083018461243c565b92915050565b600060208201905081810360008301526128538184612484565b905092915050565b60006020820190508181036000830152612874816124bd565b9050919050565b60006020820190508181036000830152612894816124e0565b9050919050565b600060208201905081810360008301526128b481612503565b9050919050565b600060208201905081810360008301526128d481612526565b9050919050565b600060208201905081810360008301526128f481612549565b9050919050565b600060208201905081810360008301526129148161256c565b9050919050565b600060208201905081810360008301526129348161258f565b9050919050565b60006020820190508181036000830152612954816125b2565b9050919050565b60006020820190508181036000830152612974816125d5565b9050919050565b60006020820190508181036000830152612994816125f8565b9050919050565b600060208201905081810360008301526129b48161261b565b9050919050565b600060208201905081810360008301526129d48161263e565b9050919050565b600060208201905081810360008301526129f481612661565b9050919050565b60006020820190508181036000830152612a1481612684565b9050919050565b60006020820190508181036000830152612a34816126a7565b9050919050565b6000602082019050612a5060008301846126d9565b92915050565b6000604082019050612a6b60008301856126d9565b612a7860208301846126d9565b9392505050565b6000612a89612a9a565b9050612a958282612cdc565b919050565b6000604051905090565b600067ffffffffffffffff821115612abf57612abe612db4565b5b602082029050602081019050919050565b600067ffffffffffffffff821115612aeb57612aea612db4565b5b602082029050602081019050919050565b600067ffffffffffffffff821115612b1757612b16612db4565b5b612b2082612e05565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ba982612c5e565b9150612bb483612c5e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612be957612be8612d56565b5b828201905092915050565b6000612bff82612c3e565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015612c95578082015181840152602081019050612c7a565b83811115612ca4576000848401525b50505050565b60006002820490506001821680612cc257607f821691505b60208210811415612cd657612cd5612d85565b5b50919050565b612ce582612e05565b810181811067ffffffffffffffff82111715612d0457612d03612db4565b5b80604052505050565b6000612d1882612c5e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d4b57612d4a612d56565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060033d1115612e025760046000803e612dff600051612e16565b90505b90565b6000601f19601f8301169050919050565b60008160e01c9050919050565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206275726e20616d6f756e7420657863656564732062616c60008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b7f455243313135353a206275726e2066726f6d20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b600060443d10156132ae57613331565b6132b6612a9a565b60043d036004823e80513d602482011167ffffffffffffffff821117156132de575050613331565b808201805167ffffffffffffffff8111156132fc5750505050613331565b80602083010160043d038501811115613319575050505050613331565b61332882602001850186612cdc565b82955050505050505b90565b61333d81612bf4565b811461334857600080fd5b50565b61335481612c06565b811461335f57600080fd5b50565b61336b81612c12565b811461337657600080fd5b50565b61338281612c5e565b811461338d57600080fd5b5056fea26469706673582212207c954b474ba2938a61031705a0987bcb898a0dffe9cb3f5a8744e3e16585386e64736f6c63430008040033",
- "linkReferences": {},
- "deployedLinkReferences": {}
-}
diff --git a/src/config.ts b/src/config.ts
new file mode 100644
index 000000000..c0cffcc0a
--- /dev/null
+++ b/src/config.ts
@@ -0,0 +1,69 @@
+import { AppConfig, ChainFactory, ChainFactoryConfigs } from ".";
+
+export namespace AppConfigs {
+ export const MainNet: () => AppConfig = () => {
+ return {
+ exchangeRateUri: "https://testing-bridge.xp.network/exchange/",
+ nftListUri: "https://nft-index.xp.network/index/",
+ nftListAuthToken:
+ "eyJhbGciOiJFUzI1NiJ9.eyJhdXRob3JpdHkiOjEsImlhdCI6MTY1Mjc5MTU1NiwiZXhwIjoxNjY4MzQzNTU2fQ.gOzLCBPNGFfjqLzSZsMes0yplAhsRiQYzidVfE-IYtQ-aVqQU6LhzKevLxYLudnm28F5_7CzTKsiuUginuLTtQ",
+ txSocketUri: "https://transaction-socket.xp.network",
+ tronScanUri: "https://apilist.tronscan.org/api/",
+ heartbeatUri: "https://xpheartbeat.herokuapp.com",
+ wrappedNftPrefix: "https://nft.xp.network/w/",
+ scVerifyUri: "https://sc-verify.xp.network",
+ network: "mainnet",
+ };
+ };
+ export const TestNet: () => AppConfig = () => {
+ return {
+ exchangeRateUri: "https://testing-bridge.xp.network/exchange/",
+ nftListUri: "https://testnet-notifier.xp.network/testnet-indexer/",
+ nftListAuthToken:
+ "eyJhbGciOiJFUzI1NiJ9.eyJhdXRob3JpdHkiOjEsImlhdCI6MTY1MjA4NzAwNiwiZXhwIjoxNjU5ODYzMDA2fQ.ERjXpljkyuklPTJCSXQXZ-Wh09oxQwA4u8HKIbIwO1TSajvLIlNgxseqBVEd5D4lkqXYGwcezkuezuRc3kKkKg",
+ txSocketUri: "https://testnet-tx-socket.herokuapp.com",
+ tronScanUri: "https://apilist.tronscan.org/api/",
+ heartbeatUri: "https://testnet-validator-pinger.herokuapp.com/",
+ wrappedNftPrefix: "https://testnet-w-nft-api.herokuapp.com/",
+ scVerifyUri: "https://testnet-sc-verify.herokuapp.com",
+ network: "testnet",
+ };
+ };
+
+ export const Staging: () => AppConfig = () => {
+ return {
+ exchangeRateUri: "https://testing-bridge.xp.network/exchange/",
+ nftListUri: "https://tools.xp.network/index",
+ nftListAuthToken:
+ "eyJhbGciOiJFUzI1NiJ9.eyJhdXRob3JpdHkiOjEsImlhdCI6MTY1Mjc5MTU1NiwiZXhwIjoxNjY4MzQzNTU2fQ.gOzLCBPNGFfjqLzSZsMes0yplAhsRiQYzidVfE-IYtQ-aVqQU6LhzKevLxYLudnm28F5_7CzTKsiuUginuLTtQ",
+ txSocketUri: "https://bridge1.xp.network/tx-socket",
+ tronScanUri: "https://apilist.tronscan.org/api/",
+ heartbeatUri: "https://xpheartbeat.herokuapp.com",
+ wrappedNftPrefix: "https://staging-nft.xp.network/w/",
+ scVerifyUri: "https://bridge1.xp.network/sc-verify",
+ network: "staging",
+ };
+ };
+}
+
+export namespace ChainFactories {
+ export const MainNet = async () => {
+ return ChainFactory(
+ AppConfigs.MainNet(),
+ await ChainFactoryConfigs.MainNet()
+ );
+ };
+
+ export const TestNet = async () => {
+ return ChainFactory(
+ AppConfigs.TestNet(),
+ await ChainFactoryConfigs.TestNet()
+ );
+ };
+ export const Staging = async () => {
+ return ChainFactory(
+ AppConfigs.Staging(),
+ await ChainFactoryConfigs.Staging()
+ );
+ };
+}
diff --git a/src/consts.ts b/src/consts.ts
new file mode 100644
index 000000000..30f77064f
--- /dev/null
+++ b/src/consts.ts
@@ -0,0 +1,746 @@
+import {
+ elrondHelperFactory,
+ ElrondParams,
+ ElrondHelper,
+} from "./helpers/elrond";
+import { tronHelperFactory, TronParams, TronHelper } from "./helpers/tron";
+import { web3HelperFactory, Web3Params, Web3Helper } from "./helpers/web3";
+import { web3HelperFactory as HederaHelperFactory } from "./helpers/hedera/helper";
+
+import {
+ SupportedCurrency,
+ SupportedCurrencyName,
+} from "crypto-exchange-rate/dist/model/domain";
+import { DecimalsByCurrency as Decimals } from "crypto-exchange-rate/dist/model/domain/Decimals";
+import {
+ AlgorandParams,
+ AlgorandHelper,
+ algorandHelper,
+} from "./helpers/algorand";
+import { TezosHelper, tezosHelperFactory, TezosParams } from "./helpers/tezos";
+import { ChainNonce, InferChainH, InferChainParam } from "./type-utils";
+import {
+ SecretHelper,
+ secretHelperFactory,
+ SecretParams,
+} from "./helpers/secret";
+import { solanaHelper, SolanaHelper, SolanaParams } from "./helpers/solana";
+import { tonHelper, TonHelper, TonParams } from "./helpers/ton";
+import {
+ dfinityHelper,
+ DfinityHelper,
+ DfinityParams,
+} from "./helpers/dfinity/dfinity";
+import { NearHelper, NearParams, nearHelperFactory } from "./helpers/near";
+import { aptosHelper, AptosHelper, AptosParams } from "./helpers/aptos";
+import { web3ERC20HelperFactory, Web3ERC20Params } from "./helpers/web3_erc20";
+
+// All the supported testnet uri's are here.
+export enum TestNetRpcUri {
+ ELROND = "https://devnet-gateway.elrond.com",
+ HECO = "https://http-testnet.hecochain.com",
+ BSC = "https://data-seed-prebsc-2-s3.binance.org:8545/",
+ ROPSTEN = "https://goerli.infura.io/v3/cec5dc92097a46f0b895ac1e89865467",
+ AVALANCHE = "https://api.avax-test.network/ext/bc/C/rpc",
+ POLYGON = "https://matic-mumbai.chainstacklabs.com",
+ FANTOM = "https://fantom-testnet.public.blastapi.io",
+ TRON = "https://api.shasta.trongrid.io/",
+ CELO = "https://alfajores-forno.celo-testnet.org",
+ HARMONY = "https://api.s0.b.hmny.io",
+ XDAI = "https://sokol.poa.network",
+ UNIQUE = "https://rpc-opal.unique.network/",
+ TEZOS = "https://ghostnet.smartpy.io",
+ VELAS = "https://explorer.testnet.velas.com/rpc",
+ IOTEX = "https://babel-api.testnet.iotex.io",
+ AURORA = "https://testnet.aurora.dev/",
+ GODWOKEN = "https://godwoken-testnet-v1.ckbapp.dev",
+ GATECHAIN = "https://meteora-evm.gatenode.cc",
+ VECHAIN = "https://sync-testnet.veblocks.net",
+ SECRET = "https://api.pulsar.scrttestnet.com",
+ SKALE = "https://staging-v3.skalenodes.com/v1/staging-utter-unripe-menkar",
+ HEDERA = "https://0.testnet.hedera.com/",
+ NEAR = "https://rpc.testnet.near.org",
+ MOONBEAM = "https://rpc.api.moonbase.moonbeam.network",
+ ABEYCHAIN = "https://testrpc.abeychain.com",
+ APTOS = "https://fullnode.testnet.aptoslabs.com",
+ TON = "https://testnet.toncenter.com/api/v2/jsonRPC",
+ SOLANA = "https://api.devnet.solana.com",
+ CADUCEUS = "https://galaxy.block.caduceus.foundation",
+ OKC = "https://exchaintestrpc.okex.org",
+ ARBITRUM = "https://goerli-rollup.arbitrum.io/rpc",
+ BITGERT = "https://testnet-rpc.brisescan.com",
+ // TODO: Algorand
+ // TODO: Fuse
+}
+
+export enum MainNetRpcUri {
+ ELROND = "https://gateway.elrond.com",
+ HECO = "https://http-mainnet-node.huobichain.com",
+ BSC = "https://bsc-dataseed.binance.org/",
+ ETHEREUM = "https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
+ AVALANCHE = "https://api.avax.network/ext/bc/C/rpc",
+ POLYGON = "https://polygon-rpc.com",
+ FANTOM = "https://rpc.fantom.network/",
+ TRON = "https://api.trongrid.io/",
+ CELO = "https://forno.celo.org",
+ HARMONY = "https://rpc.s0.t.hmny.io",
+ XDAI = "https://gnosischain-rpc.gateway.pokt.network/",
+ FUSE = "https://rpc.fuse.io/",
+ VELAS = "https://mainnet.velas.com/rpc",
+ TEZOS = "https://mainnet.smartpy.io",
+ IOTEX = "https://babel-api.mainnet.iotex.io",
+ AURORA = "https://mainnet.aurora.dev",
+ GODWOKEN = "https://v1.mainnet.godwoken.io/rpc",
+ GATECHAIN = "https://evm.gatenode.cc",
+ VECHAIN = "https://sync-mainnet.veblocks.net",
+ SECRET = "https://secret-4.api.trivium.network:9091/",
+ SKALE = "https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague",
+ NEAR = "https://rpc.mainnet.near.org",
+ MOONBEAM = "https://rpc.api.moonbeam.network",
+ ABEYCHAIN = "https://rpc.abeychain.com",
+ TON = "https://toncenter.com/api/v2/jsonRPC",
+ APTOS = "https://fullnode.mainnet.aptoslabs.com/",
+ CADUCEUS = "https://mainnet.block.caduceus.foundation/",
+ OKC = "https://exchainrpc.okex.org/",
+ ARBITRUM = "https://nova.arbitrum.io/rpc",
+ BITGERT = "https://dedicated.brisescan.com",
+ SOLANA = "https://solana-mainnet.g.alchemy.com/v2/4Fm2r6LjJO91nXrKVcZBQXcWgtVe-_gx",
+ // TODO: Algorand
+}
+
+type ElrondMeta = [ElrondHelper, ElrondParams];
+type Web3Meta = [Web3Helper, Web3Params];
+type TronMeta = [TronHelper, TronParams];
+type AlgoMeta = [AlgorandHelper, AlgorandParams];
+type TezosMeta = [TezosHelper, TezosParams];
+type SecretMeta = [SecretHelper, SecretParams];
+type SolanaMeta = [SolanaHelper, SolanaParams];
+type TonMeta = [TonHelper, TonParams];
+type DfinityMeta = [DfinityHelper, DfinityParams];
+type NearMeta = [NearHelper, NearParams];
+type Web3ERC20Meta = [Web3Helper, Web3ERC20Params];
+type AptosMeta = [AptosHelper, AptosParams];
+
+// Static Assert to Ensure all values of Chain are in MetaMap
+type MetaMapAssert = { [idx in (typeof Chain)[keyof typeof Chain]]: unknown };
+
+export type MetaMap = {
+ 2: ElrondMeta;
+ 3: Web3Meta;
+ 4: Web3Meta;
+ 5: Web3Meta;
+ 6: Web3Meta;
+ 7: Web3Meta;
+ 8: Web3Meta;
+ 9: TronMeta;
+ 0xb: Web3Meta;
+ 0xc: Web3Meta;
+ 0xd: Web3Meta;
+ 0xe: Web3Meta;
+ 0xf: AlgoMeta;
+ 0x10: Web3Meta;
+ 0x11: Web3Meta;
+ 0x12: TezosMeta;
+ 0x13: Web3Meta;
+ 0x14: Web3Meta;
+ 0x15: Web3Meta;
+ 0x16: Web3Meta;
+ 0x17: Web3Meta;
+ 0x18: SecretMeta;
+ 0x19: Web3Meta;
+ 0x1a: SolanaMeta;
+ 0x1b: TonMeta;
+ 0x1c: DfinityMeta;
+ 0x1d: Web3Meta;
+ 0x1e: Web3ERC20Meta;
+ 0x1f: NearMeta;
+ 0x20: Web3Meta;
+ 0x21: Web3Meta;
+ 0x22: AptosMeta;
+ 0x23: Web3Meta;
+ 0x24: Web3Meta;
+ 0x25: Web3Meta;
+ 0x26: Web3Meta;
+} & MetaMapAssert;
+
+export namespace Chain {
+ export const ELROND = 2;
+ export const HECO = 3;
+ export const BSC = 4;
+ export const ETHEREUM = 5;
+ export const AVALANCHE = 0x6;
+ export const POLYGON = 7;
+ export const FANTOM = 8;
+ export const TRON = 9;
+ export const CELO = 0xb; //11
+ export const HARMONY = 0xc; //12
+ export const ONT = 0xd; //13
+ export const XDAI = 0xe; //14
+ export const ALGORAND = 0xf; //15
+ export const FUSE = 0x10; // 16
+ export const UNIQUE = 0x11; // 17
+ export const TEZOS = 0x12; // 18
+ export const VELAS = 0x13; // 19
+ export const IOTEX = 0x14; // 20
+ export const AURORA = 0x15; // 21
+ export const GODWOKEN = 0x16; // 22
+ export const GATECHAIN = 0x17; // 23
+ export const SECRET = 0x18; // 24
+ export const VECHAIN = 0x19; // 25
+ export const SOLANA = 0x1a; // 26
+ export const TON = 0x1b; // 27
+ export const DFINITY = 0x1c; // 28
+ export const HEDERA = 0x1d; // 29
+ export const SKALE = 0x1e; // 30
+ export const NEAR = 0x1f; // 31
+ export const MOONBEAM = 0x20; // 32
+ export const ABEYCHAIN = 0x21; // 33
+ export const APTOS = 0x22; // 34
+ export const CADUCEUS = 0x23; // 35
+ export const OKC = 0x24; // 36
+ export const ARBITRUM = 0x25; //37
+ export const BITGERT = 0x26; //37
+}
+
+interface ChainData {
+ name: string;
+ nonce: number;
+ decimals: number;
+ constructor: (p: InferChainParam) => Promise>;
+ blockExplorerUrl: string;
+ tnBlockExplorerUrl?: string | ((tx: string) => string);
+ chainId?: number;
+ tnChainId?: number;
+ currency: SupportedCurrency;
+ currencySymbol: SupportedCurrencyName;
+ type: string;
+ blockExplorerUrlAddr?: string;
+ tnBlockExplorerUrlAddr?: string | ((tx: string) => string);
+ rejectUnfreeze?: string[];
+}
+
+type ChainInfo = {
+ set(k: T, v: ChainData | undefined): void;
+ get(k: T): ChainData | undefined;
+} & Map>;
+
+export enum ChainType {
+ EVM = "EVM",
+ ELROND = "ELROND",
+ TRON = "TRON",
+ TEZOS = "TEZOS",
+ ALGORAND = "ALGORAND",
+ COSMOS = "COSMOS",
+ DFINITY = "DFINITY",
+ SOLANA = "SOLANA",
+ TON = "TON",
+ NEAR = "NEAR",
+ HEDERA = "HEDERA",
+ APTOS = "APTOS",
+}
+
+export const CHAIN_INFO: ChainInfo = new Map();
+CHAIN_INFO.set(Chain.ELROND, {
+ name: "Elrond",
+ nonce: 2,
+ decimals: Decimals.EGLD,
+ constructor: elrondHelperFactory,
+ blockExplorerUrl: "https://explorer.elrond.com/transactions/",
+ blockExplorerUrlAddr: "https://explorer.elrond.com/address/",
+ tnBlockExplorerUrl: "https://testnet-explorer.elrond.com/transactions/",
+ tnBlockExplorerUrlAddr: "https://testnet-explorer.elrond.com/address/",
+ currency: SupportedCurrency.EGLD,
+ currencySymbol: SupportedCurrencyName.EGLD,
+ type: ChainType.ELROND,
+});
+CHAIN_INFO.set(Chain.HECO, {
+ name: "HECO",
+ nonce: 3,
+ chainId: 256,
+ decimals: Decimals.HT,
+ blockExplorerUrl: "https://testnet.hecoinfo.com/tx",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.HT,
+ currencySymbol: SupportedCurrencyName.HT,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.BSC, {
+ name: "BSC",
+ nonce: 4,
+ chainId: 97,
+ decimals: Decimals.BNB,
+ blockExplorerUrl: "https://bscscan.com/tx/",
+ blockExplorerUrlAddr: "https://bscscan.com/address/",
+ tnBlockExplorerUrl: "https://testnet.bscscan.com/tx/",
+ tnBlockExplorerUrlAddr: "https://testnet.bscscan.com/address/",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.BNB,
+ currencySymbol: SupportedCurrencyName.BNB,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.ETHEREUM, {
+ name: "Ethereum",
+ nonce: 5,
+ currency: SupportedCurrency.ETH,
+ currencySymbol: SupportedCurrencyName.ETH,
+ chainId: 5,
+ decimals: Decimals.ETH,
+ blockExplorerUrl: "https://etherscan.io/tx/",
+ blockExplorerUrlAddr: "https://etherscan.io/address/",
+ tnBlockExplorerUrl: "https://goerli.etherscan.io/tx/",
+ tnBlockExplorerUrlAddr: "https://goerli.etherscan.io/address/",
+ constructor: web3HelperFactory,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.AVALANCHE, {
+ name: "Avalanche",
+ nonce: 6,
+ chainId: 43113,
+ decimals: Decimals.AVAX,
+ blockExplorerUrl: "https://snowtrace.io/tx/",
+ tnBlockExplorerUrl: "https://testnet.snowtrace.io/tx/",
+ blockExplorerUrlAddr: "https://snowtrace.io/address/",
+ tnBlockExplorerUrlAddr: "https://testnet.snowtrace.io/address/",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.AVAX,
+ currencySymbol: SupportedCurrencyName.AVAX,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.POLYGON, {
+ name: "Polygon",
+ nonce: 0x7,
+ chainId: 80001,
+ decimals: Decimals.MATIC,
+ blockExplorerUrl: "https://polygonscan.com/tx/",
+ tnBlockExplorerUrl: "https://mumbai.polygonscan.com/tx/",
+ blockExplorerUrlAddr: "https://polygonscan.com/address/",
+ tnBlockExplorerUrlAddr: "https://mumbai.polygonscan.com/address/",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.MATIC,
+ currencySymbol: SupportedCurrencyName.MATIC,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.FANTOM, {
+ name: "Fantom",
+ nonce: 0x8,
+ decimals: Decimals.FTM,
+ chainId: 4002,
+ blockExplorerUrl: "https://ftmscan.com/tx/",
+ blockExplorerUrlAddr: "https://ftmscan.com/address/",
+ tnBlockExplorerUrlAddr: "https://testnet.ftmscan.com/address/",
+ tnBlockExplorerUrl: "https://testnet.ftmscan.com/tx/",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.FTM,
+ currencySymbol: SupportedCurrencyName.FTM,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.TRON, {
+ name: "Tron",
+ nonce: 0x9,
+ decimals: Decimals.TRX,
+ blockExplorerUrl: "https://shasta.tronscan.org/#/transaction/",
+ tnBlockExplorerUrl: "https://shasta.tronscan.org/#/transaction/",
+ blockExplorerUrlAddr: "https://tronscan.io/#/address/",
+ tnBlockExplorerUrlAddr: "https://shasta.tronscan.org/#/address/",
+ constructor: tronHelperFactory,
+ currency: SupportedCurrency.TRX,
+ currencySymbol: SupportedCurrencyName.TRX,
+ type: ChainType.TRON,
+});
+CHAIN_INFO.set(Chain.CELO, {
+ name: "Celo",
+ nonce: 0xb,
+ decimals: Decimals.CELO,
+ chainId: 44787,
+ blockExplorerUrl: "https://alfajores-blockscout.celo-testnet.org/tx",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.CELO,
+ currencySymbol: SupportedCurrencyName.CELO,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.HARMONY, {
+ name: "Harmony",
+ nonce: 0xc,
+ decimals: Decimals.ONE,
+ chainId: 1666700000,
+ blockExplorerUrl: "https://explorer.harmony.one/tx/",
+ tnBlockExplorerUrl: "https://explorer.testnet.harmony.one/tx/",
+ blockExplorerUrlAddr: "https://explorer.harmony.one/address/",
+ tnBlockExplorerUrlAddr: "https://explorer.testnet.harmony.one/address/",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.ONE,
+ currencySymbol: SupportedCurrencyName.ONE,
+ type: ChainType.EVM,
+ rejectUnfreeze: [
+ "0xb90Dc9e354001e6260DE670EDD6aBaDb890C6aC9",
+ "0xAd6f94bDefB6D5ae941392Da5224ED083AE33adc",
+ ],
+});
+CHAIN_INFO.set(Chain.ONT, {
+ name: "Ontology",
+ nonce: 0xd,
+ decimals: Decimals.ONT,
+ chainId: 1666700000,
+ blockExplorerUrl: "https://explorer.pops.one/tx",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.ONT,
+ currencySymbol: SupportedCurrencyName.ONT,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.XDAI, {
+ name: "xDai",
+ nonce: 0xe,
+ decimals: Decimals.XDAI,
+ chainId: 0x64,
+ blockExplorerUrl: "https://blockscout.com/xdai/mainnet/tx/",
+ blockExplorerUrlAddr: "https://blockscout.com/xdai/mainnet/address/",
+ tnBlockExplorerUrl: "https://blockscout.com/xdai/testnet/tx/",
+ tnBlockExplorerUrlAddr: "https://blockscout.com/xdai/testnet/address/",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.XDAI,
+ currencySymbol: SupportedCurrencyName.XDAI,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.ALGORAND, {
+ name: "Algorand",
+ nonce: 0xf,
+ decimals: Decimals.ALGO,
+ chainId: undefined,
+ blockExplorerUrl: "https://algoexplorer.io/tx/",
+ tnBlockExplorerUrl: "https://testnet.algoexplorer.io/tx/",
+ blockExplorerUrlAddr: "https://algoexplorer.io/address/",
+ tnBlockExplorerUrlAddr: "https://testnet.algoexplorer.io/address/",
+ currency: SupportedCurrency.ALGO,
+ currencySymbol: SupportedCurrencyName.ALGO,
+ constructor: (p) => Promise.resolve(algorandHelper(p)),
+ type: ChainType.ALGORAND,
+});
+CHAIN_INFO.set(Chain.FUSE, {
+ name: "FUSE",
+ nonce: 0x10,
+ decimals: Decimals.FUSE,
+ chainId: undefined,
+ blockExplorerUrl: "https://explorer.fuse.io/tx/",
+ tnBlockExplorerUrl: "https://explorer.fusespark.io/tx/",
+ blockExplorerUrlAddr: "https://explorer.fuse.io/address/",
+ tnBlockExplorerUrlAddr: "https://explorer.fusespark.io/address/",
+ currencySymbol: SupportedCurrencyName.FUSE,
+ currency: SupportedCurrency.FUSE,
+ constructor: web3HelperFactory,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.UNIQUE, {
+ name: "Unique",
+ nonce: 0x11,
+ decimals: Decimals.OPL,
+ chainId: 8888,
+ blockExplorerUrl: "CANT FIND",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.OPL,
+ currencySymbol: SupportedCurrencyName.OPL,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.TEZOS, {
+ name: "Tezos",
+ nonce: 0x12,
+ decimals: Decimals.XTZ,
+ constructor: tezosHelperFactory,
+ currency: SupportedCurrency.XTZ,
+ currencySymbol: SupportedCurrencyName.XTZ,
+ blockExplorerUrl: "https://tzkt.io/",
+ tnBlockExplorerUrl: "https://ghostnet.tzkt.io/",
+ tnBlockExplorerUrlAddr: "https://ghostnet.tzkt.io/",
+ blockExplorerUrlAddr: "https://tzkt.io/",
+ type: ChainType.TEZOS,
+});
+CHAIN_INFO.set(Chain.VELAS, {
+ name: "Velas",
+ blockExplorerUrl: "https://explorer.velas.com/tx/",
+ tnBlockExplorerUrlAddr: "https://explorer.testnet.velas.com/address/",
+ blockExplorerUrlAddr: "https://explorer.velas.com/address/",
+ tnBlockExplorerUrl: "https://explorer.testnet.velas.com/tx/",
+ nonce: 0x13,
+ decimals: Decimals.VLX,
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.VLX,
+ currencySymbol: SupportedCurrencyName.VLX,
+ chainId: 111,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.AURORA, {
+ name: "Aurora",
+ blockExplorerUrl: "https://aurorascan.dev/tx/",
+ tnBlockExplorerUrl: "hhttps://testnet.aurorascan.dev/tx/",
+ blockExplorerUrlAddr: "https://aurorascan.dev/address/",
+ tnBlockExplorerUrlAddr: "https://testnet.aurorascan.dev/address",
+ nonce: Chain.AURORA,
+ decimals: Decimals.AURORA,
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.AURORA,
+ currencySymbol: SupportedCurrencyName.AURORA,
+ chainId: 1313161554,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.IOTEX, {
+ name: "IoTeX",
+ blockExplorerUrl: "https://iotexscan.io/tx/",
+ blockExplorerUrlAddr: "https://iotexscan.io/address/",
+ tnBlockExplorerUrl: "https://testnet.iotexscan.io/tx/",
+ tnBlockExplorerUrlAddr: "https://testnet.iotexscan.io/address/",
+ nonce: 0x14,
+ decimals: Decimals.IOTX,
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.IOTX,
+ currencySymbol: SupportedCurrencyName.IOTX,
+ chainId: 4689,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.GODWOKEN, {
+ name: "GodWoken",
+ blockExplorerUrl: "https://gwscan.com/tx/",
+ tnBlockExplorerUrl: "https://v1.testnet.gwscan.com/tx/",
+ blockExplorerUrlAddr: "https://gwscan.com/account/",
+ tnBlockExplorerUrlAddr: "https://v1.testnet.gwscan.com/account/",
+ constructor: web3HelperFactory,
+ nonce: 0x16,
+ decimals: Decimals.CKB,
+ currency: SupportedCurrency.CKB,
+ currencySymbol: SupportedCurrencyName.CKB,
+ chainId: 868455272153094,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.GATECHAIN, {
+ name: "GateChain",
+ blockExplorerUrl: "https://gatescan.org/tx/",
+ tnBlockExplorerUrl: "https://gatescan.org/testnet/tx/",
+ blockExplorerUrlAddr: "https://gatescan.org/address/",
+ tnBlockExplorerUrlAddr: "https://gatescan.org/testnet/address/",
+ constructor: web3HelperFactory,
+ nonce: 0x17,
+ decimals: Decimals.GT,
+ currency: SupportedCurrency.GT,
+ currencySymbol: SupportedCurrencyName.GT,
+ chainId: 85,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.VECHAIN, {
+ name: "VeChain",
+ tnBlockExplorerUrl: "https://explore-testnet.vechain.org/transactions/",
+ blockExplorerUrlAddr: "https://explore.vechain.org/accounts/",
+ blockExplorerUrl: "https://explore.vechain.org/transactions/",
+ tnBlockExplorerUrlAddr: "https://explore-testnet.vechain.org/accounts/",
+ constructor: web3HelperFactory,
+ nonce: 0x19,
+ currency: SupportedCurrency.VET,
+ currencySymbol: SupportedCurrencyName.VET,
+ decimals: Decimals.VET,
+ chainId: 39,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.SECRET, {
+ name: "Secret",
+ //blockExplorerUrl: "", // TODO
+ constructor: secretHelperFactory,
+ nonce: Chain.SECRET,
+ currency: SupportedCurrency.SCRT,
+ currencySymbol: SupportedCurrencyName.SCRT,
+ decimals: Decimals.SCRT,
+ type: ChainType.COSMOS,
+ blockExplorerUrl: "https://secretnodes.com/secret/transactions/",
+ blockExplorerUrlAddr: "https://secretnodes.com/secret/accounts/",
+ tnBlockExplorerUrl: "https://secretnodes.com/pulsar/transactions/",
+ tnBlockExplorerUrlAddr: "https://secretnodes.com/pulsar/accounts/",
+});
+CHAIN_INFO.set(Chain.SOLANA, {
+ name: "Solana",
+ blockExplorerUrl: "https://solscan.io/tx/",
+ blockExplorerUrlAddr: "https://solscan.io/account/",
+ tnBlockExplorerUrl: (tx: string) =>
+ `https://solscan.io/tx/${tx}?cluster=devnet`,
+ tnBlockExplorerUrlAddr: (address: string) =>
+ `https://solscan.io/account/${address}?cluster=devnet`,
+ constructor: solanaHelper,
+ nonce: Chain.SOLANA,
+ currency: SupportedCurrency.SOL,
+ currencySymbol: SupportedCurrencyName.SOL,
+ decimals: Decimals.SOL,
+ type: ChainType.SOLANA,
+});
+
+CHAIN_INFO.set(Chain.HEDERA, {
+ blockExplorerUrl: "https://hashscan.io/mainnet/transactionsById/",
+ tnBlockExplorerUrl: "https://hashscan.io/testnet/transactionsById/",
+ //@ts-ignore
+ constructor:
+ typeof window !== "undefined" ? HederaHelperFactory : web3HelperFactory,
+ currency: SupportedCurrency.HBAR,
+ currencySymbol: SupportedCurrencyName.HBAR,
+ decimals: Decimals.HBAR,
+ nonce: Chain.HEDERA,
+ name: "Hedera",
+ type: ChainType.HEDERA,
+ blockExplorerUrlAddr: "https://hashscan.io/mainnet/account/",
+ tnBlockExplorerUrlAddr: "https://hashscan.io/testnet/account/",
+});
+
+CHAIN_INFO.set(Chain.SKALE, {
+ name: "Skale",
+ //needs additional query params
+ blockExplorerUrl:
+ "https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com/tx/",
+ tnBlockExplorerUrl:
+ "https://rapping-zuben-elakrab.explorer.staging-v2.skalenodes.com/tx/",
+ blockExplorerUrlAddr:
+ "https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com/address/",
+ tnBlockExplorerUrlAddr:
+ "https://rapping-zuben-elakrab.explorer.staging-v2.skalenodes.com/address/",
+ constructor: web3ERC20HelperFactory,
+ currency: SupportedCurrency.ETH,
+ currencySymbol: SupportedCurrencyName.ETH,
+ decimals: Decimals.ETH,
+ tnChainId: 0x1482a7b2,
+ nonce: Chain.SKALE,
+ type: ChainType.EVM,
+});
+
+CHAIN_INFO.set(Chain.DFINITY, {
+ blockExplorerUrl: "", // TODO
+ constructor: dfinityHelper,
+ currency: SupportedCurrency.ICP,
+ currencySymbol: SupportedCurrencyName.ICP,
+ decimals: Decimals.ICP,
+ name: "DFINITY",
+ nonce: Chain.DFINITY,
+ type: ChainType.DFINITY,
+});
+
+CHAIN_INFO.set(Chain.NEAR, {
+ blockExplorerUrl: "https://explorer.mainnet.near.org/transactions/",
+ tnBlockExplorerUrl: "https://explorer.testnet.near.org/transactions/",
+ constructor: nearHelperFactory,
+ currency: SupportedCurrency.NEAR,
+ currencySymbol: SupportedCurrencyName.NEAR,
+ decimals: Decimals.NEAR,
+ name: "NEAR",
+ nonce: Chain.NEAR,
+ type: ChainType.NEAR,
+ blockExplorerUrlAddr: "https://explorer.mainnet.near.org/accounts/",
+ tnBlockExplorerUrlAddr: "https://explorer.testnet.near.org/accounts/",
+});
+
+CHAIN_INFO.set(Chain.MOONBEAM, {
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.GLMR,
+ currencySymbol: SupportedCurrencyName.GLMR,
+ decimals: Decimals.GLMR,
+ name: "MoonBeam",
+ nonce: Chain.MOONBEAM,
+ chainId: 0x507,
+ type: ChainType.EVM,
+ blockExplorerUrlAddr: "https://moonbeam.moonscan.io/address/",
+ tnBlockExplorerUrlAddr: "https://moonbase.moonscan.io/address/",
+ blockExplorerUrl: "https://moonscan.io/tx/",
+ tnBlockExplorerUrl: "https://moonbase.moonscan.io/tx/",
+});
+
+CHAIN_INFO.set(Chain.ABEYCHAIN, {
+ tnBlockExplorerUrl: "https://testnet-explorer.abeychain.com/tx/",
+ tnBlockExplorerUrlAddr: "https://testnet-explorer.abeychain.com/address/",
+ blockExplorerUrl: "https://scan.abeychain.com/tx/",
+ blockExplorerUrlAddr: "https://scan.abeychain.com/address/",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.ABEY,
+ currencySymbol: SupportedCurrencyName.ABEY,
+ decimals: Decimals.ABEY,
+ name: "ABEY",
+ nonce: Chain.ABEYCHAIN,
+ chainId: 178,
+ type: ChainType.EVM,
+});
+CHAIN_INFO.set(Chain.APTOS, {
+ constructor: aptosHelper,
+ currency: SupportedCurrency.APTOS,
+ currencySymbol: SupportedCurrencyName.APTOS,
+ decimals: Decimals.APTOS,
+ name: "Aptos",
+ nonce: Chain.APTOS,
+ type: ChainType.APTOS,
+ //needs additional query params
+ blockExplorerUrl: "https://explorer.aptoslabs.com/txn/",
+ blockExplorerUrlAddr: "https://explorer.aptoslabs.com/account/",
+ tnBlockExplorerUrl: "https://explorer.aptoslabs.com/txn/",
+ tnBlockExplorerUrlAddr: "https://explorer.aptoslabs.com/account/",
+});
+CHAIN_INFO.set(Chain.TON, {
+ name: "TON",
+ constructor: tonHelper,
+ currency: SupportedCurrency.TON,
+ currencySymbol: SupportedCurrencyName.TON,
+ decimals: Decimals.TON,
+ nonce: Chain.TON,
+ type: ChainType.TON,
+ tnBlockExplorerUrl: "https://testnet.tonscan.org/tx/",
+ blockExplorerUrl: "https://tonscan.org/tx/",
+ blockExplorerUrlAddr: "https://tonscan.org/address/",
+ tnBlockExplorerUrlAddr: "https://testnet.tonscan.org/address/",
+});
+CHAIN_INFO.set(Chain.CADUCEUS, {
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.CMP,
+ currencySymbol: SupportedCurrencyName.CMP,
+ decimals: Decimals.CMP,
+ name: "Caduceus",
+ nonce: Chain.CADUCEUS,
+ blockExplorerUrl: "https://mainnet.scan.caduceus.foundation/tx/",
+ tnBlockExplorerUrl: "https://galaxy.scan.caduceus.foundation/tx/",
+ blockExplorerUrlAddr: "https://mainnet.scan.caduceus.foundation/address/",
+ tnBlockExplorerUrlAddr: "https://galaxy.scan.caduceus.foundation/address/",
+ type: ChainType.EVM,
+ chainId: 256256,
+ tnChainId: 512512,
+});
+CHAIN_INFO.set(Chain.OKC, {
+ blockExplorerUrl: "https://www.oklink.com/okc/",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.OKT,
+ currencySymbol: SupportedCurrencyName.OKT,
+ decimals: Decimals.OKT,
+ name: "OKC",
+ nonce: Chain.OKC,
+ type: ChainType.EVM,
+ chainId: 66,
+ blockExplorerUrlAddr: "https://www.oklink.com/en/okc/address/",
+ tnBlockExplorerUrl: "https://www.oklink.com/okc-test/",
+ tnBlockExplorerUrlAddr: "https://www.oklink.com/en/okc-test/address/",
+ tnChainId: 65,
+});
+CHAIN_INFO.set(Chain.ARBITRUM, {
+ blockExplorerUrl: "https://nova.arbiscan.io/tx/",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.ETH,
+ currencySymbol: SupportedCurrencyName.ETH,
+ decimals: Decimals.ETH,
+ name: "Arbitrum",
+ nonce: Chain.ARBITRUM,
+ type: ChainType.EVM,
+ chainId: 42170,
+ blockExplorerUrlAddr: "https://nova.arbiscan.io/address/",
+ tnBlockExplorerUrl: "https://goerli-rollup-explorer.arbitrum.io/tx/",
+ tnBlockExplorerUrlAddr: "https://goerli-rollup-explorer.arbitrum.io/address/",
+ tnChainId: 421613,
+});
+CHAIN_INFO.set(Chain.BITGERT, {
+ blockExplorerUrl: "https://brisescan.com/tx/",
+ constructor: web3HelperFactory,
+ currency: SupportedCurrency.BRISE,
+ currencySymbol: SupportedCurrencyName.BRISE,
+ decimals: Decimals.ETH,
+ name: "Bitgert",
+ nonce: Chain.BITGERT,
+ type: ChainType.EVM,
+ chainId: 3250,
+ blockExplorerUrlAddr: "https://brisescan.com/address/",
+ tnBlockExplorerUrl: "https://testnet-explorer.brisescan.com/tx/",
+ tnBlockExplorerUrlAddr: "https://testnet-explorer.brisescan.com/address/",
+ tnChainId: 64668,
+});
diff --git a/src/emitter.ts b/src/emitter.ts
new file mode 100644
index 000000000..908802616
--- /dev/null
+++ b/src/emitter.ts
@@ -0,0 +1,2 @@
+export const Emitter =
+ typeof window !== "undefined" ? new EventTarget() : undefined;
diff --git a/src/estimator/index.ts b/src/estimator/index.ts
new file mode 100644
index 000000000..942763946
--- /dev/null
+++ b/src/estimator/index.ts
@@ -0,0 +1,67 @@
+import axios from "axios";
+import { ChainNonce } from "../type-utils";
+
+export interface SignatureService {
+ getSignatureNear(
+ from: ChainNonce,
+ toChain: ChainNonce,
+ nft: string,
+ tokenContract: string,
+ tokenId: string,
+ to: string
+ ): Promise;
+ getSignatureDfinity(
+ fc: ChainNonce,
+ tc: ChainNonce,
+ to: string,
+ num: number
+ ): Promise;
+}
+
+interface SignatureServiceResponse {
+ signature: string;
+ fee: string;
+}
+
+export function signatureService(url: string): SignatureService {
+ const signer = axios.create({
+ baseURL: url,
+ });
+ return {
+ async getSignatureNear(
+ fromChain: ChainNonce,
+ toChain: ChainNonce,
+ nft: string,
+ tokenContract: string,
+ tokenId: string,
+ to: string
+ ) {
+ const result = await signer.post<{ data: SignatureServiceResponse }>(
+ "/api/get-signature/",
+ {
+ fromChain,
+ toChain,
+ nft,
+ to,
+ tokenId,
+ tokenContract,
+ }
+ );
+ console.log("near signature response", result);
+ return result.data.data;
+ },
+ async getSignatureDfinity(fc, tc, to, num: number) {
+ const result = await signer.post<{ data: SignatureServiceResponse }>(
+ "/api/get-signature/",
+ {
+ fromChain: fc,
+ toChain: tc,
+ to,
+ num,
+ nft: {},
+ }
+ );
+ return result.data.data;
+ },
+ };
+}
diff --git a/src/factory/cons.ts b/src/factory/cons.ts
new file mode 100644
index 000000000..92fa3aab2
--- /dev/null
+++ b/src/factory/cons.ts
@@ -0,0 +1,127 @@
+import {
+ BatchExchangeRateRepo,
+ cachedExchangeRateRepo,
+ ExchangeRateRepo,
+ networkBatchExchangeRateRepo,
+ NetworkModel,
+} from "crypto-exchange-rate";
+
+import { NftInfo, FullChain } from "..";
+
+import { CHAIN_INFO, ChainType, Chain } from "../consts";
+
+export const _headers = {
+ "Content-Type": "application/json",
+ Accept: "*/*",
+};
+
+export function exchangeRateRepo(
+ baseUrl: string
+): ExchangeRateRepo & BatchExchangeRateRepo {
+ const baseService = NetworkModel.batchExchangeRateService(baseUrl);
+
+ return cachedExchangeRateRepo(
+ networkBatchExchangeRateRepo(
+ baseService,
+ NetworkModel.exchangeRateDtoMapper()
+ )
+ );
+}
+
+export function checkBlockedContracts(to: any, contract: string) {
+ const chain = CHAIN_INFO.get(to);
+ if (chain?.rejectUnfreeze && chain?.rejectUnfreeze.includes(contract)) {
+ throw new Error(
+ `Transfering to ${chain.name} is prohibited by the NFT project team`
+ );
+ }
+}
+
+export function getDefaultContract(
+ nft: NftInfo,
+ fromChain: FullChain,
+ toChain: FullChain
+): string | undefined {
+ const defaultMintError = new Error(
+ `Transfer has been canceled. The NFT you are trying to send will be minted with a default NFT collection`
+ );
+
+ const from = fromChain.getNonce();
+ const to = toChain.getNonce();
+
+ const fromType = CHAIN_INFO.get(from)?.type;
+ const toType = CHAIN_INFO.get(to)?.type;
+
+ const contract =
+ //@ts-ignore contractType is checked
+ "contractType" in nft.native &&
+ //@ts-ignore contractType is checked
+ nft.native.contractType === "ERC1155" &&
+ toChain.XpNft1155
+ ? toChain.XpNft1155
+ : toChain.XpNft;
+
+ if (
+ typeof window !== "undefined" &&
+ (/(allowDefaultMint=true)/.test(window.location.search) ||
+ /testnet/.test(window.location.pathname))
+ ) {
+ return contract;
+ }
+
+ if (
+ (from === Chain.VECHAIN && toType === ChainType.EVM) ||
+ (to === Chain.VECHAIN && fromType === ChainType.EVM)
+ ) {
+ throw defaultMintError;
+ }
+
+ if (
+ (fromType === ChainType.EVM && toType === ChainType.ELROND) ||
+ (fromType === ChainType.ELROND && toType === ChainType.EVM)
+ ) {
+ throw defaultMintError;
+ }
+
+ if (
+ (fromType === ChainType.EVM && toType === ChainType.TEZOS) ||
+ (fromType === ChainType.TEZOS && toType === ChainType.EVM)
+ ) {
+ throw defaultMintError;
+ }
+
+ if (from === Chain.SECRET) {
+ throw defaultMintError;
+ }
+
+ if (fromType === ChainType.TRON) {
+ throw defaultMintError;
+ }
+
+ return contract;
+}
+
+export function prepareTokenId(nft: NftInfo, from: number) {
+ const tokenId =
+ //@ts-ignore
+ nft.native && "tokenId" in nft.native && nft.native.tokenId.toString();
+
+ if (tokenId) {
+ const notNumber = isNaN(Number(tokenId));
+
+ if (notNumber) {
+ if (from === Chain.ELROND) {
+ if (nft.native.nonce) return String(nft.native.nonce);
+ const hex = tokenId.split("-")?.at(2);
+ return String(hex ? parseInt(hex, 16) : "");
+ }
+
+ if (from === Chain.TON || from === Chain.SECRET) {
+ return "1";
+ }
+ } else {
+ return tokenId;
+ }
+ }
+ return undefined;
+}
diff --git a/src/factory/factories.ts b/src/factory/factories.ts
new file mode 100644
index 000000000..b26281bbc
--- /dev/null
+++ b/src/factory/factories.ts
@@ -0,0 +1,1019 @@
+import { ChainParams } from ".";
+//@ts-ignore
+import TronWeb from "tronweb";
+import { Chain, MainNetRpcUri, TestNetRpcUri } from "../consts";
+import { ethers } from "ethers";
+import { TezosToolkit } from "@taquito/taquito";
+import { evNotifier } from "../notifier";
+import { Driver, SimpleNet } from "@vechain/connex-driver";
+import * as thor from "web3-providers-connex";
+import { Framework } from "@vechain/connex-framework";
+import { hethers } from "@hashgraph/hethers";
+import { HttpAgent } from "@dfinity/agent";
+import { Principal } from "@dfinity/principal";
+import TonWeb from "tonweb";
+import { FeeMargins } from "../helpers/chain";
+import { signatureService } from "../estimator";
+
+/*const EVM_VALIDATORS = [
+ "0xffa74a26bf87a32992bb4be080467bb4a8019e00",
+ "0x837b2eb764860b442c971f98f505e7c5f419edd7",
+ "0x9671ce5a02eb53cf0f2cbd220b34e50c39c0bf23",
+ "0x90e79cc7a06dbd227569920a8c4a625f630d77f4",
+ "0xdc80905cafeda39cb19a566baeef52472848e82f",
+ "0x77745cd585798e55938940e3d4dd0fd7cde7bdd6",
+ "0xc2a29b4e9fa71e9033a52611544403241c56ac5e",
+];*/
+
+// const _EVM_TESTNET_VALIDATORS = [
+// "0x50aCEC08ce70aa4f2a8ab2F45d8dCd1903ea4E14",
+// "0xae87208a5204B6606d3AB177Be5fdf62267Cd499",
+// "0x5002258315873AdCbdEF25a8E71C715A4f701dF5",
+// ];
+
+const middleware_uri = "https://notifier.xp.network";
+const testnet_middleware_uri =
+ "https://testnet-notifier.xp.network/notify-test/";
+
+const signature_service_uri = "https://fee.xp.network";
+const signatureSvc = signatureService(signature_service_uri);
+
+export namespace ChainFactoryConfigs {
+ export const TestNet: () => Promise> = async () => {
+ const feeMargin = { min: 1, max: 5 };
+ const notifier = evNotifier(testnet_middleware_uri);
+
+ // VeChain related:
+ const net = new SimpleNet(TestNetRpcUri.VECHAIN);
+ const driver = await Driver.connect(net);
+ const provider = thor.ethers.modifyProvider(
+ new ethers.providers.Web3Provider(
+ new thor.ConnexProvider({ connex: new Framework(driver) })
+ )
+ );
+
+ return {
+ elrondParams: {
+ node_uri: TestNetRpcUri.ELROND,
+ minter_address:
+ "erd1qqqqqqqqqqqqqpgqy2nx5z4cpr90de4sga2v2yx62fph3lg8g6vskt0k2f",
+ esdt_swap_address:
+ "erd1qqqqqqqqqqqqqpgqc854pa9ruzgs5f8rdzzc02xgq8kqku3ng6vs59vmf8",
+ esdt_nft: "XPNFT-af3fde",
+ esdt_swap: "WEGLD-708f9b",
+ notifier,
+ nonce: 2,
+ feeMargin,
+ },
+ tonParams: {
+ tonweb: new TonWeb(
+ new TonWeb.HttpProvider(TestNetRpcUri.TON, {
+ apiKey:
+ "abe8c1222f19b0891a9a35889d112dc88562093467db8dda39961eeacd50f9b1",
+ })
+ ),
+ bridgeAddr: "kQBwUu-b4O6qDYq3iDRvsYUnTD6l3WCxLXkv0aH6ywAaPs3c",
+ burnerAddr: "kQCbH9gGgqJzXuusUVajW_40brrl2fxTYqMkk6HUhJnIgOQA",
+ xpnftAddr: "EQDji0YH-SNT-qi6o5dQQBLeWL0Xmm46fnqj34EYhOL34WDc",
+ feeMargin,
+ notifier,
+ },
+ solanaParams: {
+ xpnftAddr: "C7bw5dJZwhjWd6TZE3LnE2b1RLqWDiy9XRMA1rajPKQY",
+ bridgeContractAddr: "FXaXLtmkuoJCJeX6BnLwQJWgT8cPdwuXN8BmmQzVvuRA",
+ endpoint: TestNetRpcUri.SOLANA,
+ notifier,
+ feeMargin,
+ },
+ vechainParams: {
+ notifier,
+ feeMargin,
+ nonce: Chain.VECHAIN,
+ provider,
+ minter_addr: "0x5142f6Cc88a9a91b4F6a1972Ce412d57245092A8",
+ erc721_addr: "0x1cCF127eB11bD9bdbf2b4000dCef04c34C13850B",
+ erc1155_addr: "0x1109b0CAB4C4e51aBA040a8A6d16273c305941F8",
+ erc721Minter: "0x1E749e1580889334Bd61254fFab15c1B3ADe1Afd",
+ erc1155Minter: "0xDA5e020bA795191ff97A5AF97631bACbdcD1354b",
+ },
+ tronParams: {
+ provider: new TronWeb({ fullHost: TestNetRpcUri.TRON }),
+ notifier,
+ minter_addr: "TY46GA3GGdMtu9GMaaSPPSQtqq9CZAv5sK",
+ erc721_addr: "TDhb2kyurMwoc1eMndKzqNebji1ap1DJC4",
+ erc1155_addr: "TBeSKv5RSFLAi7SCD7hR64xuvP6N26oEqR",
+ erc1155Minter: "TBeSKv5RSFLAi7SCD7hR64xuvP6N26oEqR",
+ erc721Minter: "TMVDt5PP53eQro5hLafibv2xWzSSDSMyjy",
+ validators: [
+ "TJuG3kvmGBDxGyUPBbvKePUjbopLurtqSo",
+ "TN9bHXEWditocT4Au15mgm7JM56XBnRCvm",
+ "TRHLhivxVogGhtxKn6sC8UF2Fr3WBdaT8N",
+ ],
+ nonce: Chain.TRON,
+ feeMargin,
+ },
+ caduceusParams: {
+ notifier,
+ feeMargin,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.CADUCEUS),
+ erc1155_addr: "0xeBCDdF17898bFFE81BCb3182833ba44f4dB25525",
+ erc721_addr: "0x8CEe805FE5FA49e81266fcbC27F37D85062c1707",
+ erc1155Minter: "0x9cdda01E00A5A425143F952ee894ff99B5F7999F",
+ erc721Minter: "0x34933A5958378e7141AA2305Cdb5cDf514896035",
+ minter_addr: "0x3fe9EfFa80625B8167B2F0d8cF5697F61D77e4a2",
+ nonce: Chain.CADUCEUS,
+ },
+ avalancheParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.AVALANCHE),
+ minter_addr: "0xDdF1f6B8Ae8cd26dBE7C4C3ed9ac8E6D8B3a4FdC",
+ erc721_addr: "0xE1D8Df2e06797F22e7ce25c95A7ddccb926f8A1E",
+ erc1155Minter: "0xfA9214AEe59a6631A400DC039808457524dE70A2",
+ erc721Minter: "0x54Db938575DD089702822F191AEbB25C2Af7D1Ef",
+ erc1155_addr: "0xfA9214AEe59a6631A400DC039808457524dE70A2",
+ nonce: Chain.AVALANCHE,
+ feeMargin,
+ },
+ polygonParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.POLYGON),
+ minter_addr: "0x224f78681099D66ceEdf4E52ee62E5a98CCB4b9e",
+ erc721_addr: "0xb678b13E41a47e46A4046a4D8315b32E0F34389c",
+ erc1155Minter: "0x5A768f8dDC67ccCA1431879BcA28E93a6c7722bb",
+ erc1155_addr: "0xc1D778Ce89154357471bA6c4C6E51f0e590FFe57",
+ erc721Minter: "0x6516E2D3387A9CF4E5e868E7842D110c95A9f3B4",
+ nonce: Chain.POLYGON,
+ feeMargin,
+ },
+ dfinityParams: {
+ agent: new HttpAgent({
+ host: "https://ic0.app",
+ }),
+ bridgeContract: Principal.fromText("53bb2-rqaaa-aaaap-aa3vq-cai"),
+ xpnftId: Principal.fromText("5ogqx-qyaaa-aaaap-aa3wa-cai"),
+ umt: Principal.fromText("54aho-4iaaa-aaaap-aa3va-cai"),
+ notifier,
+ feeMargin,
+ signatureSvc,
+ },
+ moonbeamParams: {
+ nonce: Chain.MOONBEAM,
+ notifier,
+ feeMargin,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.MOONBEAM),
+ erc721Minter: "0x1F71E80E1E785dbDB34c69909C11b71bAd8D9802",
+ erc1155Minter: "0x10E3EE8526Cc7610393E2f6e25dEee0bD38d057e",
+ erc1155_addr: "0xd023739a76Df4cC6260A1Ba25e8BEbCe8389D60D",
+ erc721_addr: "0x42027aF22E36e839e138dc387F1b7428a85553Cc",
+ minter_addr: "0x0F00f81162ABC95Ee6741a802A1218C67C42e714",
+ },
+ aptosParams: {
+ rpcUrl: TestNetRpcUri.APTOS,
+ bridge:
+ "0x2b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d58",
+ xpnft: "XPNFT",
+ notifier,
+ feeMargin,
+ nonce: Chain.APTOS,
+ network: "testnet",
+ },
+ abeyChainParams: {
+ nonce: Chain.ABEYCHAIN,
+ notifier,
+ feeMargin,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.ABEYCHAIN),
+ erc721Minter: "0x34933A5958378e7141AA2305Cdb5cDf514896035",
+ erc1155Minter: "0x9cdda01E00A5A425143F952ee894ff99B5F7999F",
+ erc1155_addr: "0xeBCDdF17898bFFE81BCb3182833ba44f4dB25525",
+ erc721_addr: "0x8CEe805FE5FA49e81266fcbC27F37D85062c1707",
+ minter_addr: "0x3fe9EfFa80625B8167B2F0d8cF5697F61D77e4a2",
+ },
+ fantomParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.FANTOM),
+ minter_addr: "0x9a287810bA8F0564DaDd9F2Ea9B7B2459497416B",
+ erc721_addr: "0x3F51015C76D7A64514E9B86D500bBFD44F95bdE9",
+ erc1155Minter: "string",
+ erc1155_addr: "0xE657b66d683bF4295325c5E66F6bb0fb6D1F7551",
+ erc721Minter: "string",
+ nonce: Chain.FANTOM,
+ feeMargin,
+ },
+ bscParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.BSC),
+ minter_addr: "0x3Dd26fFf61D2a79f5fB77100d6daDBF073F334E6",
+ erc721_addr: "0x783eF7485DCF27a3Cf59F5A0A406eEe3f9b2AaeB",
+ erc1155Minter: "0x5dA3b7431f4581a7d35aEc2f3429174DC0f2A2E1",
+ erc721Minter: "0x97CD6fD6cbFfaa24f5c858843955C2601cc7F2b9",
+ erc1155_addr: "0xb5278A4808e2345A3B9d08bAc8909A121aFaEBB3",
+ nonce: Chain.BSC,
+ feeMargin,
+ },
+ celoParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.CELO),
+ minter_addr: "0x9a287810bA8F0564DaDd9F2Ea9B7B2459497416B",
+ erc721_addr: "0x3F51015C76D7A64514E9B86D500bBFD44F95bdE9",
+ erc1155_addr: "",
+ erc1155Minter: "string",
+ erc721Minter: "string",
+ nonce: Chain.CELO,
+ feeMargin,
+ },
+ harmonyParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.HARMONY),
+ minter_addr: "0x198Cae9EE853e7b44E99c0b35Bddb451F83485d5",
+ erc721_addr: "0x1280c5c11bF0aAaaEAeBc998893B42e08B26fD5A",
+ erc1155Minter: "0xB546c2358A6e4b0B83192cCBB83CaE37FA572fe1",
+ erc721Minter: "0xb036640d6f7cAfd338103dc60493250561Af2eBc",
+ erc1155_addr: "0x44FCF0001A2B03260e4Bba44AF93a60C64cE79A2",
+ nonce: Chain.HARMONY,
+ feeMargin,
+ },
+ ropstenParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.ROPSTEN),
+ erc1155_addr: "0x46Df0d0Dd629d61BDFA567dE61912FDeD883A60d",
+ erc721_addr: "0x33DC209D33AddF60cf90Dd4B10f9a198A1A93f63",
+ erc1155Minter: "0xE90105827d04522e52AdfA6BF695730E5706C0C2",
+ erc721Minter: "0x90d38996B210D45bDF2FD54d091C6061dff0dA9F",
+ minter_addr: "0x04a5f9158829Cae5a0a549954AdEaBD47BbB3d2d",
+ nonce: Chain.ETHEREUM,
+ feeMargin,
+ },
+ okcParams: {
+ erc721Minter: "0xaB9eD7b9734471249255B4d969B32995015116d9",
+ erc1155Minter: "0x48B218C9f626F079b82f572E3c5B46251c40fc47",
+ erc1155_addr: "0x57d2Ad1a14C77627D5f82B7A0F244Cfe391e59C5",
+ erc721_addr: "0xbED4a5b36fae07943589a0b34CC2Ec3a1c208E53",
+ minter_addr: "0x7cB14C4aB12741B5ab185C6eAFb5Eb7b5282A032",
+ feeMargin,
+ nonce: Chain.OKC,
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.OKC),
+ },
+ arbitrumParams: {
+ erc721Minter: "0x10E3EE8526Cc7610393E2f6e25dEee0bD38d057e",
+ erc1155Minter: "0xd023739a76Df4cC6260A1Ba25e8BEbCe8389D60D",
+ erc1155_addr: "0x42027aF22E36e839e138dc387F1b7428a85553Cc",
+ erc721_addr: "0x0F00f81162ABC95Ee6741a802A1218C67C42e714",
+ minter_addr: "0xaB9eD7b9734471249255B4d969B32995015116d9",
+ feeMargin,
+ nonce: Chain.ARBITRUM,
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.ARBITRUM),
+ },
+ bitgertParams: {
+ erc721Minter: "0xf185759aDb97977b419e3bc25b14E751c93865e",
+ erc1155Minter: "0xb0801bffD146c21EF91E86625756aAa7f74aDB3a",
+ erc1155_addr: "0x7b7Bb6ba1796f2C766cFae6A2C60463766615c69",
+ erc721_addr: "0x56E5298Ba72125DbF8180b199f74aC2B51d31Deb",
+ minter_addr: "0x39d4F26213245D33f506ECA1ce68D08dCF4d8d14",
+ feeMargin,
+ nonce: Chain.BITGERT,
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.BITGERT),
+ },
+ xDaiParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.XDAI),
+ minter_addr: "0x90d38996B210D45bDF2FD54d091C6061dff0dA9F",
+ erc721_addr: "0x0e02b55e1D0ec9023A04f1278F39685B53739010",
+ erc1155Minter: "0x0AA29baB4F811A9f3dcf6a0F9cAEa9bE18ECED78",
+ erc721Minter: "0x7cB14C4aB12741B5ab185C6eAFb5Eb7b5282A032",
+ erc1155_addr: "0x1C6d7aa611B30C9C1e5f52068E145b77b0e661b2",
+ nonce: Chain.XDAI,
+ feeMargin,
+ },
+ algorandParams: {
+ algodApiKey:
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ indexerUri: "https://algoindexer.testnet.algoexplorerapi.io",
+ algodUri: "https://node.testnet.algoexplorerapi.io",
+ nonce: Chain.ALGORAND,
+ sendNftAppId: 83148194,
+ algodPort: 443,
+ notifier,
+ feeMargin,
+ },
+ auroraParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.AURORA),
+ erc721_addr: "0x8CEe805FE5FA49e81266fcbC27F37D85062c1707",
+ minter_addr: "0x3fe9EfFa80625B8167B2F0d8cF5697F61D77e4a2",
+ erc1155Minter: "0x9cdda01E00A5A425143F952ee894ff99B5F7999F",
+ erc1155_addr: "",
+ erc721Minter: "0x34933A5958378e7141AA2305Cdb5cDf514896035",
+ nonce: Chain.AURORA,
+ feeMargin,
+ },
+ uniqueParams: {
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.UNIQUE),
+ nonce: Chain.UNIQUE,
+ erc721_addr: "0xeBCDdF17898bFFE81BCb3182833ba44f4dB25525",
+ erc1155_addr: "",
+ minter_addr: "0x8CEe805FE5FA49e81266fcbC27F37D85062c1707",
+ erc1155Minter: "string",
+ erc721Minter: "string",
+ notifier,
+ feeMargin,
+ },
+ tezosParams: {
+ bridgeAddress: "KT1NJG7j4Z5LbU3obL5TUaJPGNT45ukRTQrH",
+ notifier,
+ Tezos: new TezosToolkit(TestNetRpcUri.TEZOS),
+ xpnftAddress: "KT1GRqXuUpGJGDLCRsgQ9nDvVu7tap6LPxTC",
+ validators: [
+ "tz1iKCCYmhayfpp1HvVA8Fmp4PkY5Z7XnDdX",
+ "tz1g4CJW1mzVLvN8ycHFg9JScpuzYrJhZcnD",
+ "tz1exbY3JKPRpo2KLegK8iqoVNRLn1zFrnZi",
+ ],
+ feeMargin,
+ },
+ velasParams: {
+ notifier,
+ erc721_addr: "0xE657b66d683bF4295325c5E66F6bb0fb6D1F7551",
+ erc1155_addr: "0x5D822bA2a0994434392A0f947C83310328CFB0DE",
+ minter_addr: "0x5051679FEDf0D7F01Dc23e72674d0ED58de9be6a",
+ erc1155Minter: "0x941972fa041F507eBb8CfD5d11C05Eb1a51f2E95",
+ erc721Minter: "0x5df32A2F15D021DeF5086cF94fbCaC4594208A26",
+ nonce: Chain.VELAS,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.VELAS),
+ feeMargin,
+ },
+ iotexParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.IOTEX),
+ minter_addr: "0xE657b66d683bF4295325c5E66F6bb0fb6D1F7551",
+ erc721_addr: "0x5D822bA2a0994434392A0f947C83310328CFB0DE",
+ erc1155_addr: "0x46Df0d0Dd629d61BDFA567dE61912FDeD883A60d",
+ erc1155Minter: "0x5df32A2F15D021DeF5086cF94fbCaC4594208A26",
+ erc721Minter: "0xC3dB3dBcf007961541BE1ddF15cD4ECc0Fc758d5",
+ nonce: Chain.IOTEX,
+ feeMargin,
+ },
+ hederaParams: {
+ notifier,
+ provider: hethers.getDefaultProvider("testnet") as any,
+ feeMargin,
+ nonce: Chain.HEDERA,
+ api: "https://testnet.mirrornode.hedera.com/",
+ htcToken: "0x00000000000000000000000000000000003b22a5",
+ erc721_addr: "0x00000000000000000000000000000000003b2294",
+ erc1155_addr: "0x00000000000000000000000000000000003b2294",
+ minter_addr: "0x00000000000000000000000000000000003b229e",
+ erc721Minter: "0x000000000000000000000000000000000037008d",
+ erc1155Minter: "0x0000000000000000000000000000000000370090",
+ },
+ skaleParams: {
+ nonce: Chain.SKALE,
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.SKALE),
+ feeMargin,
+ erc1155_addr: "0x57d2Ad1a14C77627D5f82B7A0F244Cfe391e59C5",
+ erc1155Minter: "0x48B218C9f626F079b82f572E3c5B46251c40fc47",
+ erc721Minter: "0xaB9eD7b9734471249255B4d969B32995015116d9",
+ erc721_addr: "0xbED4a5b36fae07943589a0b34CC2Ec3a1c208E53",
+ minter_addr: "0x7cB14C4aB12741B5ab185C6eAFb5Eb7b5282A032",
+ paymentTokenAddress: "0x0F00f81162ABC95Ee6741a802A1218C67C42e714",
+ },
+ godwokenParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.GODWOKEN),
+ minter_addr: "0x3fe9EfFa80625B8167B2F0d8cF5697F61D77e4a2",
+ erc721_addr: "0x8CEe805FE5FA49e81266fcbC27F37D85062c1707",
+ erc1155_addr: "0xeBCDdF17898bFFE81BCb3182833ba44f4dB25525",
+ erc721Minter: "0x34933A5958378e7141AA2305Cdb5cDf514896035",
+ erc1155Minter: "0x9cdda01E00A5A425143F952ee894ff99B5F7999F",
+ nonce: Chain.GODWOKEN,
+ feeMargin,
+ },
+ gateChainParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(TestNetRpcUri.GATECHAIN),
+ minter_addr: "0x2B24de7BFf5d2ab01b1C53682Ee5987c9BCf1BAc",
+ erc721_addr: "0x3fe9EfFa80625B8167B2F0d8cF5697F61D77e4a2",
+ erc1155_addr: "0x8CEe805FE5FA49e81266fcbC27F37D85062c1707",
+ erc721Minter: "0x9cdda01E00A5A425143F952ee894ff99B5F7999F",
+ erc1155Minter: "0xeBCDdF17898bFFE81BCb3182833ba44f4dB25525",
+ nonce: Chain.GATECHAIN,
+ feeMargin,
+ },
+ secretParams: {
+ notifier,
+ rpcUrl: TestNetRpcUri.SECRET,
+ bridge: {
+ contractAddress: "secret1ecsxtsrct6h647lpztnnzc9e47ezh0uu673c8h",
+ codeHash:
+ "29a127369d1f4326fb684435fde702fa9619c812dfb5b3a1929529bab0e308e0",
+ },
+ xpnft: {
+ contractAddress: "secret1x4afa2shvq4uwwtl0ld8qnjfm3jkmyvap3yn9g",
+ codeHash:
+ "090ab9b7968745369f8888302a16650164e2ffc2f44c393a7382f74e122a9a8e",
+ },
+ umt: {
+ contractAddress: "secret146snljq0kjsva7qrx4am54nv3fhfaet7srx4n2",
+ codeHash:
+ "af076a49141264ec048270318f1358c9be193893c3f829425cab53ee5eb05e5c",
+ },
+ chainId: "pulsar-2",
+ feeMargin,
+ },
+
+ nearParams: {
+ networkId: "testnet",
+ nonce: Chain.NEAR,
+ rpcUrl: TestNetRpcUri.NEAR,
+ bridge: "xp_new_bridge.testnet",
+ xpnft: "xp_new_nft.testnet",
+ walletUrl: "https://wallet.testnet.near.org",
+ helperUrl: "https://helper.testnet.near.org",
+ feeMargin,
+ notifier,
+ signatureSvc,
+ },
+ };
+ };
+
+ export const Staging: () => Promise> = async () => {
+ const feeMargin: FeeMargins = { min: 1, max: 5 };
+ const notifier = evNotifier("https://bridge1.xp.network/notifier");
+
+ return {
+ tonParams: {
+ bridgeAddr: "kQBGFgZOXaF7LPRxWrjd9l6Iws6KGhWiMs3BKzAZGyeMq2AS",
+ burnerAddr: "kQAee5m2tk_-ipbrq40Geey7_yZmjZwAYZFjuKy9CbWvVykL",
+ notifier,
+ tonweb: new TonWeb(
+ new TonWeb.HttpProvider("https://toncenter.com/api/v2/jsonRPC", {
+ apiKey:
+ "05645d6b549f33bf80cee8822bd63df720c6781bd00020646deb7b2b2cd53b73",
+ })
+ ),
+ xpnftAddr: "EQCgk1I2zujGrXaNXnWZEtFD93tSKNjvRfqKV0xp7EswHgw9",
+ feeMargin,
+ },
+ nearParams: {
+ networkId: "mainnet",
+ nonce: Chain.NEAR,
+ rpcUrl: MainNetRpcUri.NEAR,
+ bridge:
+ "e138f27300334f546bbd792e65dc8753af29d534c5248a3f55e875693bddcf19",
+ xpnft: "damphir7.near",
+ feeMargin,
+ notifier,
+ walletUrl: "https://wallet.mainnet.near.org",
+ helperUrl: "https://helper.mainnet.near.org",
+ signatureSvc,
+ },
+ solanaParams: {
+ xpnftAddr: "",
+ bridgeContractAddr: "kVvEBTB1h9GWEC7GcuDNTEmk6uxbCM11GvSmwvuCAwx",
+ endpoint: MainNetRpcUri.SOLANA,
+ notifier,
+ feeMargin,
+ },
+ caduceusParams: {
+ notifier,
+ feeMargin,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.CADUCEUS),
+ erc1155_addr: "0x820c0b504fe85b43E3c43D2EA24cb764ad78d52e",
+ erc721_addr: "0x086815f8154e3cdD89cD3aEc78377e3197a572d0",
+ erc1155Minter: "0xe3266d5181FffE43A205ce5bE9437B9f717Bad84",
+ erc721Minter: "0x8411EeadD374bDE549F61a166FFBeFca592bC60a",
+ minter_addr: "0x28c43F505d210D6f8f78C58b450b76890dc76F21",
+ nonce: Chain.CADUCEUS,
+ },
+ avalancheParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.AVALANCHE),
+ erc721Minter: "0xb3cE27eDadFE006f9f47C5ed5b62E63DFd9Cf3bD",
+ erc1155Minter: "0x23d399368EF31ca950E4Fd2063F2e4A5ACC0f9c2",
+ erc721_addr: "0xcEFC9182e9AB181b3FED4e89CdA55E0B9010aFe1",
+ minter_addr: "0x52e7D07DE51F8163E0f29061EaAa7D3FEaf6b47E",
+ erc1155_addr: "0x77037e4f8aCb09f9bdedB9311bB6d9e74ed44371",
+ nonce: Chain.AVALANCHE,
+ feeMargin,
+ },
+ algorandParams: {
+ algodApiKey: "kZWDAxYR7Y6S6RoyfGIi28SATZ5DfTIs5pF0UMW4",
+ algodUri: "https://mainnet-algorand.api.purestake.io/ps2",
+ indexerUri: "https://mainnet-algorand.api.purestake.io/idx2",
+ nonce: Chain.ALGORAND,
+ sendNftAppId: 942656248,
+ algodPort: 443,
+ notifier,
+ feeMargin,
+ },
+ fantomParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.FANTOM),
+ erc721Minter: "",
+ erc1155Minter: "",
+ erc1155_addr: "0xAE3bF9a0abd3D753aBB579c6E8BFD5D5F5e89c70",
+ erc721_addr: "0x3CF207B7E4633400B8A29B3c758296d290a51345",
+ minter_addr: "0xD0060e9d327fCeF5A0B0919e3624eABa56565348",
+ nonce: Chain.FANTOM,
+ feeMargin,
+ },
+ elrondParams: {
+ node_uri: MainNetRpcUri.ELROND,
+ minter_address:
+ "erd1qqqqqqqqqqqqqpgqacac9ux4uz0pjg8ck2sf0ugxre0feczzvcas2tsatn",
+ esdt_swap_address:
+ "erd1qqqqqqqqqqqqqpgqjlnfddgj2dl4kz3x4n55yhfv7v06mxhzvcas2ec5ps",
+ esdt_nft: "XPNFT-976581",
+ esdt_swap: "WEGLD-8c393e",
+ notifier,
+ nonce: Chain.ELROND,
+ feeMargin,
+ },
+ harmonyParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.HARMONY),
+ minter_addr: "0x77037e4f8aCb09f9bdedB9311bB6d9e74ed44371",
+ erc721_addr: "0x23d399368EF31ca950E4Fd2063F2e4A5ACC0f9c2",
+ erc1155_addr: "0xb3cE27eDadFE006f9f47C5ed5b62E63DFd9Cf3bD",
+ erc1155Minter: "0x28c43F505d210D6f8f78C58b450b76890dc76F21",
+ erc721Minter: "0x086815f8154e3cdD89cD3aEc78377e3197a572d0",
+ nonce: Chain.HARMONY,
+ feeMargin,
+ },
+ velasParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.VELAS),
+ erc721Minter: "0x4d739e4953CE42f71604cbE142FD293841F9ed1c",
+ erc1155Minter: "0xeEc7955F2F7AA4E36B582D8f022c9417ecB75a44",
+ erc721_addr: "0x19678D8f9601AD0F099D401A3f82e4d6745B0e56",
+ erc1155_addr: "0x4a153028F0b40C41432127E050015963D130b01A",
+ minter_addr: "0xe535A8De7C42a8bc1633f16965fbc259a3Ef58B6",
+ nonce: Chain.VELAS,
+ feeMargin,
+ },
+ bscParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.BSC),
+ erc721Minter: "0x83feaeA88b1377970E7cD11492d084B63e09C87E",
+ erc1155_addr: "0x1B20ceec70e9635f5B56928de16A9dBc8EB8e3b6",
+ erc1155Minter: "0x5Af6A4C6E261315C5B7811bEb9c620CfF4722793",
+ erc721_addr: "0x9796B2F03e3afF786048cd67a1D33282476AB1d4",
+ minter_addr: "0x7Eac6825A851d79ae24301eA497AD8db2a0F4976",
+ nonce: Chain.BSC,
+ feeMargin,
+ },
+ secretParams: {
+ bridge: {
+ contractAddress: "secret1t0g8tvc0tyvpwdsdc5zepa9j2ptr3vfte26qhu",
+ codeHash:
+ "684afe616d92b29c097c5f00365d07c005e99c90ff1227507a0284b601a2cc5e",
+ },
+ xpnft: {
+ contractAddress: "secret1ggvqzks96k7hawhdx3harrtnffhttrrq2qxmdg",
+ codeHash:
+ "b7f44f7d2f72bfec52b027ee6b3ef802246735b50b2bfe747851876f818d7f45",
+ },
+ notifier,
+ rpcUrl: MainNetRpcUri.SECRET,
+ umt: {
+ contractAddress: "",
+ codeHash: "",
+ },
+ chainId: "24",
+ feeMargin,
+ },
+ abeyChainParams: {
+ notifier,
+ feeMargin,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.ABEYCHAIN),
+ erc1155_addr: "0x8776073043eef8929F4a9cBa8Aacc6B59A21BA52",
+ erc1155Minter: "0x5Ed657a379e06CBAc1Ba1a9cF6D28e71c66B0c83",
+ erc721_addr: "0x3C8C51809Ee58E9D3BA37e37112843e41DcBD7B7",
+ erc721Minter: "0xD580913Ef2c8CA4Ca90D4bE6851ACa004cf586D8",
+ minter_addr: "0x14db0f56042Fa87F3b3921E871f87248f4C56A71",
+ nonce: Chain.ABEYCHAIN,
+ },
+ moonbeamParams: {
+ notifier,
+ feeMargin,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.MOONBEAM),
+ erc1155_addr: "0x554560C6800f123B4A713F80A5AC9F21486F5De8",
+ erc721_addr: "0x6f64e03fcc34b774b3b82825a91aABA336Fbf931",
+ erc1155Minter: "0xA97FD39705583296221f39cb245fb573B28722A1",
+ erc721Minter: "0x0e5C62beAD14795F3eA9969B139F5433DF85319e",
+ minter_addr: "0xce50496C6616F4688d5775966E302A49e3876Dff",
+ nonce: Chain.MOONBEAM,
+ },
+ polygonParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.POLYGON),
+ erc721Minter: "0x32732607F67f9FC2007AF84e54B2ea9042327ed3",
+ erc1155Minter: "0x62E26979F555Ec475981D8D1A7e269f747643f22",
+ erc721_addr: "0x54024A9351B7aD68921914942f776489E71c467e",
+ erc1155_addr: "0x8D3e050555356a2eD4ad8cfFb189994035F5803C",
+ minter_addr: "0xF712f9De44425d8845A1d597a247Fe88F4A23b6f",
+ nonce: Chain.POLYGON,
+ feeMargin,
+ },
+ skaleParams: {
+ notifier,
+ feeMargin,
+ nonce: Chain.SKALE,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.SKALE),
+ erc721Minter: "0x0e02b55e1D0ec9023A04f1278F39685B53739010",
+ erc1155Minter: "0x90d38996B210D45bDF2FD54d091C6061dff0dA9F",
+ erc1155_addr: "0xE90105827d04522e52AdfA6BF695730E5706C0C2",
+ erc721_addr: "0x46Df0d0Dd629d61BDFA567dE61912FDeD883A60d",
+ minter_addr: "0x33DC209D33AddF60cf90Dd4B10f9a198A1A93f63",
+ paymentTokenAddress: "0x59ab97Ee239e02112652587F9Ef86CB6F762983b", // Euphoria ETH (ETH) Token
+ },
+ aptosParams: {
+ rpcUrl: MainNetRpcUri.APTOS,
+ bridge:
+ "0x813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec37",
+ xpnft: "XPNFT",
+ notifier,
+ feeMargin,
+ nonce: Chain.APTOS,
+ network: "staging",
+ },
+ };
+ };
+
+ export const MainNet: () => Promise> = async () => {
+ const feeMargin = { min: 1, max: 5 };
+ const notifier = evNotifier(middleware_uri);
+
+ // VeChain related:
+ const net = new SimpleNet(MainNetRpcUri.VECHAIN);
+ const driver = await Driver.connect(net);
+ const provider = thor.ethers.modifyProvider(
+ new ethers.providers.Web3Provider(
+ new thor.ConnexProvider({ connex: new Framework(driver) })
+ )
+ );
+
+ return {
+ tonParams: {
+ bridgeAddr: "kQAV8Z_aSl_e3PUMwXAb-mdE9l5Bsf83vn40NKc2LtsiFlGm",
+ burnerAddr: "kQDsF-yKhKqg4ygCynLfYRaw_QJeSoK2BeRpamO-nXeuuSiT",
+ notifier,
+ tonweb: new TonWeb(
+ new TonWeb.HttpProvider("https://toncenter.com/api/v2/jsonRPC", {
+ apiKey:
+ "05645d6b549f33bf80cee8822bd63df720c6781bd00020646deb7b2b2cd53b73",
+ })
+ ),
+ xpnftAddr: "EQABqbZubs5e3QQF3lxVZMvdaxlaIdNQWq8W1rn8rvVvWHys",
+ feeMargin,
+ },
+ elrondParams: {
+ node_uri: MainNetRpcUri.ELROND,
+ minter_address:
+ "erd1qqqqqqqqqqqqqpgq3y98dyjdp72lwzvd35yt4f9ua2a3n70v0drsfycvu8",
+ esdt_swap_address:
+ "erd1qqqqqqqqqqqqqpgq5vuvac70kn36yk4rvf9scr6p8tlu23220drsfgszfy",
+ esdt_nft: "XPNFT-cb7482",
+ esdt_swap: "WEGLD-5f1f8d",
+ notifier,
+ nonce: Chain.ELROND,
+ feeMargin,
+ },
+ caduceusParams: {
+ notifier,
+ feeMargin,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.CADUCEUS),
+ erc1155_addr: "0xF8AE68714fF6704883281603a22b56f47eB23511",
+ erc721_addr: "0x97799bEDB7AD04d61899F0255BA12EAF641d666D",
+ erc1155Minter: "0xFbA4cB4B617328cfE7a92907e4fb34bf1d798eBA",
+ erc721Minter: "0x6b3b43029dD4695f8780d7f16E0313dA02d9507B",
+ minter_addr: "0x98e9510261F34438e340c03cD35b492f87f628A8",
+ nonce: Chain.CADUCEUS,
+ },
+ okcParams: {
+ erc721Minter: "0x8411EeadD374bDE549F61a166FFBeFca592bC60a",
+ erc1155Minter: "0xe3266d5181FffE43A205ce5bE9437B9f717Bad84",
+ erc1155_addr: "0x820c0b504fe85b43E3c43D2EA24cb764ad78d52e",
+ erc721_addr: "0x086815f8154e3cdD89cD3aEc78377e3197a572d0",
+ minter_addr: "0x28c43F505d210D6f8f78C58b450b76890dc76F21",
+ feeMargin,
+ nonce: Chain.OKC,
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.OKC),
+ },
+ arbitrumParams: {
+ erc721Minter: "0x536dDc3Be14A980d3cd15635b3D05985C297FD07",
+ erc1155Minter: "0x4F4F48f70892475b0D4863f61F47157Dd1Db9F1a",
+ erc1155_addr: "0xBd2005050a99142d7B77B415e7b603633f3B3746",
+ erc721_addr: "0x445712E8dcf35E42FFAbb79b900aADcE2284fB65",
+ minter_addr: "0x72d270bb71A90B82260b12c31D427C3F33AC0692",
+ feeMargin,
+ nonce: Chain.ARBITRUM,
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.ARBITRUM),
+ },
+ bitgertParams: {
+ erc721Minter: "string",
+ erc1155Minter: "string",
+ erc1155_addr: "string",
+ erc721_addr: "string",
+ minter_addr: "string",
+ feeMargin,
+ nonce: Chain.BITGERT,
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.BITGERT),
+ },
+ dfinityParams: {
+ agent: new HttpAgent({
+ host: "https://ic0.app",
+ }),
+ bridgeContract: Principal.fromText("e3io4-qaaaa-aaaak-qasua-cai"),
+ xpnftId: Principal.fromText("e4jii-5yaaa-aaaak-qasuq-cai"),
+ umt: Principal.fromText("evkdu-lqaaa-aaaak-qasva-cai"),
+ notifier,
+ feeMargin,
+ signatureSvc,
+ },
+ vechainParams: {
+ notifier,
+ feeMargin,
+ nonce: Chain.VECHAIN,
+ provider,
+ minter_addr: "0xE860cef926E5e76E0E88fdc762417a582F849C27",
+ erc721_addr: "0xf0E778BD5C4c2F219A2A5699e3AfD2D82D50E271",
+ erc1155_addr: "",
+ erc721Minter: "0x6e2B43FeF2E750e1562AC572e60B6C484a027424",
+ erc1155Minter: "0x4E3a506800b894f3d7B46475Ab693DD5a567bB5C",
+ },
+ tronParams: {
+ provider: new TronWeb({ fullHost: MainNetRpcUri.TRON }),
+ notifier,
+ minter_addr: "TAncANF5aYbvgXDatmwTdvTa5N9PTrq95k",
+ erc721_addr: "TVdp7szDHg3opRyuciQaJi93LLk7y83hrC",
+ erc1155_addr: "",
+ erc1155Minter: "TYoj1JVpJt1TAWBFj3GkaKLC2vrcFnjZ1G",
+ erc721Minter: "TPSQTbFWaxiDZbGD7MoqR6N2aWDSWBUNfA",
+ validators: [
+ "TJuG3kvmGBDxGyUPBbvKePUjbopLurtqSo",
+ "TN9bHXEWditocT4Au15mgm7JM56XBnRCvm",
+ "TRHLhivxVogGhtxKn6sC8UF2Fr3WBdaT8N",
+ "TJuG3kvmGBDxGyUPBbvKePUjbopLurtqSo",
+ "TN9bHXEWditocT4Au15mgm7JM56XBnRCvm",
+ "TRHLhivxVogGhtxKn6sC8UF2Fr3WBdaT8N",
+ "TJuG3kvmGBDxGyUPBbvKePUjbopLurtqSo",
+ ],
+ nonce: Chain.TRON,
+ feeMargin,
+ },
+ avalancheParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.AVALANCHE),
+ erc721Minter: "0x9b2bACF4E69c81EF4EF42da84872aAC39ce7EC62",
+ erc1155Minter: "0x73E8deFC951D228828da35Ff8152f25c1e5226fa",
+ erc721_addr: "0x7bf2924985CAA6192D721B2B9e1109919aC6ff58",
+ minter_addr: "0xC254a8D4eF5f825FD31561bDc69551ed2b8db134",
+ erc1155_addr: "0x73E8deFC951D228828da35Ff8152f25c1e5226fa",
+ nonce: Chain.AVALANCHE,
+ feeMargin,
+ },
+ polygonParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.POLYGON),
+ erc721Minter: "0x7E8493F59274651Cc0919feCf12E6A77153cdA72",
+ erc1155Minter: "0x73E8deFC951D228828da35Ff8152f25c1e5226fa",
+ erc721_addr: "0xC254a8D4eF5f825FD31561bDc69551ed2b8db134",
+ erc1155_addr: "0x7bf2924985CAA6192D721B2B9e1109919aC6ff58",
+ minter_addr: "0x14CAB7829B03D075c4ae1aCF4f9156235ce99405",
+ nonce: Chain.POLYGON,
+ feeMargin,
+ },
+ fantomParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.FANTOM),
+ erc721Minter: "0xC81D46c6F2D59182c5A64FD5C372266c98985AdF",
+ erc1155Minter: "0x146a99Ff19ece88EC87f5be03085cA6CD3163E15",
+ erc1155_addr: "0x4bA4ADdc803B04b71412439712cB1911103380D6",
+ erc721_addr: "0x75f93b47719Ab5270d27cF28a74eeA247d5DfeFF",
+ minter_addr: "0x97dd1B3AE755539F56Db8b29258d7C925b20b84B",
+ nonce: Chain.FANTOM,
+ feeMargin,
+ },
+ bscParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.BSC),
+ erc721Minter: "0xa66dA346C08dD77bfB7EE5E68C45010B6F2538ff",
+ erc1155_addr: "0x3F888c0Ee72943a3Fb1c169684A9d1e8DEB9f537",
+ erc1155Minter: "0xF5e0c79CB0B7e7CF6Ad2F9779B01fe74F958964a",
+ erc721_addr: "0x0cC5F00e673B0bcd1F780602CeC6553aec1A57F0",
+ minter_addr: "0x0B7ED039DFF2b91Eb4746830EaDAE6A0436fC4CB",
+ nonce: Chain.BSC,
+ feeMargin,
+ },
+ celoParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.CELO),
+ minter_addr: "string",
+ erc721_addr: "string",
+ erc1155Minter: "string",
+ erc721Minter: "string",
+ erc1155_addr: "",
+ nonce: Chain.CELO,
+ feeMargin,
+ },
+ harmonyParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.HARMONY),
+ minter_addr: "0x1358844f14feEf4D99Bc218C9577d1c7e0Cb2E89",
+ erc721_addr: "0xDcAA2b071c1851D8Da43f85a34a5A57d4Fa93A1A",
+ erc1155_addr: "0xFEeD85607C1fbc2f30EAc13281480ED6265e121E",
+ erc1155Minter: "0xF547002799955812378137FA30C21039E69deF05",
+ erc721Minter: "0x57d2Ad1a14C77627D5f82B7A0F244Cfe391e59C5",
+ nonce: Chain.HARMONY,
+ feeMargin,
+ },
+ ropstenParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.ETHEREUM),
+ minter_addr: "0x1cC24128C04093d832D4b50609e182ed183E1688",
+ erc721_addr: "0x32E8854DC2a5Fd7049DCF10ef2cb5f01300c7B47",
+ erc1155_addr: "0x041AE550CB0e76a3d048cc2a4017BbCB74756b43",
+ erc1155Minter: "0xca8E2a118d7674080d71762a783b0729AadadD42",
+ erc721Minter: "0xF547002799955812378137FA30C21039E69deF05",
+ nonce: Chain.ETHEREUM,
+ feeMargin,
+ },
+ xDaiParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.XDAI),
+ erc721Minter: "0x82A7d50A0030935808dAF6e5f0f06645866fb7Bb",
+ erc1155Minter: "0xFEeD85607C1fbc2f30EAc13281480ED6265e121E",
+ erc721_addr: "0x1358844f14feEf4D99Bc218C9577d1c7e0Cb2E89",
+ erc1155_addr: "0xDcAA2b071c1851D8Da43f85a34a5A57d4Fa93A1A",
+ minter_addr: "0x81e1Fdad0658b69914801aBaDA7Aa0Abb31653E5",
+ nonce: Chain.XDAI,
+ feeMargin,
+ },
+ algorandParams: {
+ algodApiKey:
+ "e5b7d342b8a742be5e213540669b611bfd67465b754e7353eca8fd19b1efcffd",
+ algodUri: "https://algorand-node.xp.network/",
+ indexerUri: "https://algoindexer.algoexplorerapi.io",
+ nonce: Chain.ALGORAND,
+ sendNftAppId: 769053604,
+ algodPort: 443,
+ notifier,
+ feeMargin,
+ },
+ fuseParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.FUSE),
+ erc721Minter: "0xC81D46c6F2D59182c5A64FD5C372266c98985AdF",
+ erc1155Minter: "0x146a99Ff19ece88EC87f5be03085cA6CD3163E15",
+ erc721_addr: "0x93239b1CF8CAd847f387735876EdBa7D75ae4f7A",
+ erc1155_addr: "0x2496b44516c8639dA00E8D12ccE64862e3760190",
+ minter_addr: "0xa66dA346C08dD77bfB7EE5E68C45010B6F2538ff",
+ nonce: Chain.FUSE,
+ feeMargin,
+ },
+ tezosParams: {
+ bridgeAddress: "KT1WKtpe58XPCqNQmPmVUq6CZkPYRms5oLvu",
+ notifier,
+ Tezos: new TezosToolkit(MainNetRpcUri.TEZOS),
+ xpnftAddress: "KT1NEx6MX2GUEKMTX9ydyu8mn9WBNEz3QPEp",
+ validators: [
+ "tz1MwAQrsg5EgeFD1AQHT2FTutnj9yQJNcjM",
+ "tz1b5AMdXs9nDxsqoN9wa3HTusvhahgBRWuF",
+ "tz1L5DjmMEHbj5npRzZewSARLmTQQyESW4Mj",
+ "tz1csq1THV9rKQQexo2XfSjSEJEg2wRCSHsD",
+ "tz1TBhd1NeZNtWsTbecee8jDMDzeBNLmpViN",
+ "tz1SHcDnXRgb7kWidiaM2J6bbTS7x5jzBr67",
+ ],
+ feeMargin,
+ },
+ velasParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.VELAS),
+ erc721Minter: "0x3F888c0Ee72943a3Fb1c169684A9d1e8DEB9f537",
+ erc1155Minter: "0x0cC5F00e673B0bcd1F780602CeC6553aec1A57F0",
+ erc721_addr: "0x9e5761f7A1360E8B3E9d30Ed9dd3161E8b75d4E8",
+ erc1155_addr: "0x0B7ED039DFF2b91Eb4746830EaDAE6A0436fC4CB",
+ minter_addr: "0x40d8160A0Df3D9aad75b9208070CFFa9387bc051",
+ nonce: Chain.VELAS,
+ feeMargin,
+ },
+ iotexParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.IOTEX),
+ minter_addr: "0x4bA4ADdc803B04b71412439712cB1911103380D6",
+ erc721_addr: "0x6eD7dfDf9678eCb2051c46A1A5E38B4f310b18c5",
+ erc721Minter: "0xD87755CCeaab0edb28b3f0CD7D6405E1bB827B65",
+ erc1155Minter: "0x81e1Fdad0658b69914801aBaDA7Aa0Abb31653E5",
+ erc1155_addr: "0x93Ff4d90a548143c28876736Aa9Da2Bb7B1b52D4",
+ nonce: Chain.IOTEX,
+ feeMargin,
+ },
+ auroraParams: {
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.AURORA),
+ minter_addr: "0x32E8854DC2a5Fd7049DCF10ef2cb5f01300c7B47",
+ erc721_addr: "0x041AE550CB0e76a3d048cc2a4017BbCB74756b43",
+ erc1155_addr: "0xca8E2a118d7674080d71762a783b0729AadadD42",
+ erc1155Minter: "0x0000000000000000000000000000000000000000",
+ erc721Minter: "0x0000000000000000000000000000000000000000",
+ nonce: Chain.AURORA,
+ notifier,
+ feeMargin,
+ },
+ godwokenParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.GODWOKEN),
+ minter_addr: "0xeBCDdF17898bFFE81BCb3182833ba44f4dB25525",
+ erc721_addr: "0x9cdda01E00A5A425143F952ee894ff99B5F7999F",
+ erc1155_addr: "0x34933A5958378e7141AA2305Cdb5cDf514896035",
+ erc721Minter: "0x0000000000000000000000000000000000000000",
+ erc1155Minter: "0x0000000000000000000000000000000000000000",
+ nonce: Chain.GODWOKEN,
+ feeMargin,
+ },
+ gateChainParams: {
+ notifier,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.GATECHAIN),
+ minter_addr: "0xFc7f7fD2DBdAF6D8F3ee3f222b3a6a9f89729f05",
+ erc721_addr: "0xD6939f722B977afd7DD934A31bc94d08d4ea4336",
+ erc1155_addr: "",
+ erc1155Minter: "0xc45759e51CdDBa46db4D1becC8B8Bcbe5d4a9bB4",
+ erc721Minter: "0x0000000000000000000000000000000000000000",
+ nonce: Chain.GATECHAIN,
+ feeMargin,
+ },
+ skaleParams: {
+ notifier,
+ feeMargin,
+ nonce: Chain.SKALE,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.SKALE),
+ erc721Minter: "0xC71C2e7b5Ee01f2cb08b41E240976E8Be6012fB0",
+ erc1155Minter: "0xbe6cB5C730C07a788dAB0aD7ed629d9c418a9c14",
+ erc1155_addr: "0x783cA58315336dD646aCeCF0b55f728099ee73ec",
+ erc721_addr: "0xf4C24d031C336CdcC5CC251E5abbE777235A65f3",
+ minter_addr: "0xa8440b0702923A54bb0FF3B55f458Cfe8142C1A0",
+ paymentTokenAddress: "0x59ab97Ee239e02112652587F9Ef86CB6F762983b", // Euphoria ETH (ETH) Token
+ },
+ moonbeamParams: {
+ nonce: Chain.MOONBEAM,
+ notifier,
+ feeMargin,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.MOONBEAM),
+ erc721Minter: "",
+ erc1155Minter: "",
+ erc1155_addr: "0xe535A8De7C42a8bc1633f16965fbc259a3Ef58B6",
+ erc721_addr: "0xfD3Ce0a10D4731b136a7C9e3f8a37edA1EFbf77f",
+ minter_addr: "0xBA3Cc81cfc54a4ce99638b5da1F17b15476E7231",
+ },
+ abeyChainParams: {
+ nonce: Chain.ABEYCHAIN,
+ notifier,
+ feeMargin,
+ provider: new ethers.providers.JsonRpcProvider(MainNetRpcUri.ABEYCHAIN),
+ erc721Minter: "0xBb5e9896cEe600DaC470775B6f235Db105E861BD",
+ erc1155Minter: "0x35c3c3959d19A310Fc052545fCC29200dc440CdA",
+ erc1155_addr: "0xF9DfD29ddEDEa3224f9c7E12c7Bbe37101341786",
+ erc721_addr: "0x55B1D1891ABb21A5d245d149B49007b55Bd3746D",
+ minter_addr: "0x4ceDb46481d7118E1D292C318E37510E5919bBe6",
+ },
+
+ secretParams: {
+ notifier,
+ rpcUrl: MainNetRpcUri.SECRET,
+ bridge: {
+ contractAddress: "secret18f66qjjuyudmh7q6s50hwpt9y679lanjs82jkg",
+ codeHash:
+ "224f175c92947bbfd656d26e21b5eee40f73eac6aa6b64c328db3c55261ee6b4",
+ },
+ xpnft: {
+ contractAddress: "secret16zcej6asqrtfq08u3fdjhs03zpl7lgy7q32eps",
+ codeHash:
+ "b7f44f7d2f72bfec52b027ee6b3ef802246735b50b2bfe747851876f818d7f45",
+ },
+ umt: {
+ contractAddress: "",
+ codeHash: "",
+ },
+ chainId: "24",
+ feeMargin,
+ },
+ nearParams: {
+ networkId: "mainnet",
+ nonce: Chain.NEAR,
+ rpcUrl: MainNetRpcUri.NEAR,
+ bridge: "",
+ xpnft: "",
+ feeMargin,
+ notifier,
+ walletUrl: "https://wallet.mainnet.near.org",
+ helperUrl: "https://helper.mainnet.near.org",
+ signatureSvc,
+ },
+ };
+ };
+}
diff --git a/src/factory/index.ts b/src/factory/index.ts
new file mode 100644
index 000000000..e1fffbd2e
--- /dev/null
+++ b/src/factory/index.ts
@@ -0,0 +1,1092 @@
+import { Chain, CHAIN_INFO } from "../consts";
+import { ElrondParams } from "../helpers/elrond";
+import { TronParams } from "../helpers/tron";
+import { Web3Params } from "../helpers/web3";
+
+export * from "./cons";
+export * from "./factories";
+
+import BigNumber from "bignumber.js";
+import {
+ ChainNonceGet,
+ EstimateTxFees,
+ ExtractAction,
+ ExtractTxnStatus,
+ MintNft,
+ NftInfo,
+ socketHelper,
+ TransactionStatus,
+ TransferNftForeign,
+ UnfreezeForeignNft,
+ ValidateAddress,
+} from "..";
+
+import { UserSigner } from "@elrondnetwork/erdjs/out";
+import { ContractFactory, Wallet } from "@hashgraph/hethers";
+import algosdk from "algosdk";
+import axios from "axios";
+import { ethers, utils } from "ethers";
+import { Base64 } from "js-base64";
+import { bridgeHeartbeat } from "../heartbeat";
+import {
+ AlgorandHelper,
+ AlgorandParams,
+ AlgoSignerH,
+ algoSignerWrapper,
+ ClaimNftInfo,
+} from "../helpers/algorand";
+import { AptosParams } from "../helpers/aptos";
+import {
+ BalanceCheck,
+ EstimateTxFeesBatch,
+ FeeMargins,
+ GetFeeMargins,
+ TransferNftForeignBatch,
+ UnfreezeForeignNftBatch,
+ WhitelistCheck,
+} from "../helpers/chain";
+import { DfinityParams } from "../helpers/dfinity/dfinity";
+import {
+ HEDERA_PROXY_ABI,
+ HEDERA_PROXY_BC,
+ HEDERA_TOKEN_SERVICE_ABI,
+} from "../helpers/hedera/hts_abi";
+import { NearParams } from "../helpers/near";
+import { SecretParams } from "../helpers/secret";
+import { SolanaParams } from "../helpers/solana";
+import { TezosParams } from "../helpers/tezos";
+import { TonParams } from "../helpers/ton";
+import { Web3ERC20Params } from "../helpers/web3_erc20";
+import {
+ ChainNonce,
+ HelperMap,
+ InferChainH,
+ InferChainParam,
+ InferNativeNft,
+ InferSigner,
+ ParamMap,
+} from "../type-utils";
+import {
+ checkBlockedContracts,
+ exchangeRateRepo,
+ getDefaultContract,
+ prepareTokenId,
+ _headers,
+} from "./cons";
+import base64url from "base64url";
+
+export type FullChain = TransferNftForeign<
+ Signer,
+ RawNft,
+ Resp
+> &
+ UnfreezeForeignNft &
+ EstimateTxFees &
+ ChainNonceGet &
+ ValidateAddress & { XpNft: string; XpNft1155?: string } & GetFeeMargins;
+
+type FullChainBatch = FullChain &
+ TransferNftForeignBatch &
+ UnfreezeForeignNftBatch &
+ EstimateTxFeesBatch;
+
+/**
+ * A type representing a chain factory.
+ */
+export type ChainFactory = {
+ /**
+ * Creates an helper factory for a given chain
+ * @param chain: {@link ChainNonce} to create the helper for.
+ */
+ inner(chain: T): Promise>;
+ /**
+ * Whether or not the bridge is alive for a given chain
+ * this is checked regardless before using any bridge related function(e.g transferNft) is called
+ */
+ bridgeStatus(): Promise<{ [chainNonce: number]: "alive" | "dead" }>;
+ /**
+ * Check the balance of an account
+ *
+ * @param inner The chain to check the balance in
+ * @param address address of the account
+ */
+ balance(inner: BalanceCheck, address: string): Promise;
+ /**
+ * Transfers the NFT from one chain to other.
+ * @param fromChain {@link FullChain} the chain to transfer from. Use inner method of the factory to get this.
+ * @param toChain {@link FullChain} the chain to transfer to. Use inner method of the factory to get this.
+ * WARN: Algorand NFTs must be manually claimed by the receiver
+ * @param nft {@link NftInfo} the nft to be transferred. Can be fetched from the `nftList` method of the factory.
+ * @param sender {@link Sender} The owner of the NFT.
+ * @param receiver Address of the Receiver of the NFT. Could be Web3 or Elrond or Tron Address.
+ * @param fee validator fees from {@link estimateFees} (will be calculated automatically if not given)
+ * @param mintWith an arbitrary address of the target chain minter contract
+ * @param gasLimit an arbitrary gas limit value (required for some chains)
+ */
+
+ transferNft(
+ fromChain: FullChain,
+ toChain: FullChain,
+ nft: NftInfo,
+ sender: SignerF,
+ receiver: string,
+ fee?: BigNumber.Value,
+ mintWith?: string,
+ gasLimit?: ethers.BigNumberish | undefined,
+ extraFee?: BigNumber.Value,
+ gasPrice?: ethers.BigNumberish | undefined
+ ): Promise;
+
+ transferBatchNft(
+ fromChain: FullChainBatch,
+ toChain: FullChainBatch,
+ nft: NftInfo[],
+ sender: SignerF,
+ receiver: string,
+ fee?: BigNumber.Value,
+ mintWith?: string
+ ): Promise;
+
+ claimHederaNFT(
+ serialNumber: ethers.BigNumberish,
+ proxyAddress: string,
+ htsToken: string,
+ sender: Wallet
+ ): Promise;
+
+ listHederaClaimableNFT(
+ proxyContract: string,
+ htsToken: string,
+ sender: Wallet
+ ): Promise;
+
+ transferSft(
+ fromChain: FullChainBatch,
+ toChain: FullChainBatch,
+ nft: NftInfo,
+ sender: SignerF,
+ receiver: string,
+ amt: bigint,
+ fee?: BigNumber.Value,
+ mintWith?: string
+ ): Promise;
+ /**
+ * Mints an NFT on the chain.
+ * @param chain: {@link MintNft} Chain to mint the nft on. Can be obtained from the `inner` method on the factory.
+ * @param owner: {@link Signer} A signer to sign transaction, can come from either metamask, tronlink, or the elrond's maiar defi wallet.
+ * @param args: {@link NftMintArgs} Arguments to mint the nft. Contract is must for web3 and tron. Identifier is must for elrond.
+ */
+ mint(
+ chain: MintNft,
+ owner: Signer,
+ args: Args
+ ): Promise;
+ /**
+ * Lists all the NFTs on the chain owner by {@param owner}.
+ * @param chain: Chain on which the NFT was minted. Can be obtained from the `inner` method on the factory.
+ * @param owner: Address of the owner of the NFT as a raw string.
+ */
+ nftList(
+ chain: ChainNonceGet & T,
+ owner: string
+ ): Promise>[]>;
+ /**
+ * Estimates the required fee for transferring an NFT.
+ * @param fromChain: {@link FullChain} Chain on which the NFT was minted. Can be obtained from the `inner` method on the factory.
+ * @param toChain: {@link FullChain} Chain to which the NFT must be sent. Can be obtained from the `inner` method on the factory.
+ * @param nft: {@link NftInfo} The NFT that has to be transferred. Generally comes from the `nftList` method of the factory.
+ * @param receiver: Address of the receiver of the NFT in raw string..
+ */
+ estimateFees(
+ fromChain: FullChain,
+ toChain: FullChain,
+ nft: NftInfo,
+ receiver: string
+ ): Promise;
+
+ estimateWithContractDep(
+ fromChain: FullChain,
+ toChain: FullChain,
+ nft: NftInfo,
+ receiver: string
+ ): Promise<{ calcContractDep: BigNumber }>;
+
+ estimateSFTfees(
+ fromChain: FullChain,
+ amount: bigint,
+ price: number
+ ): Promise;
+
+ estimateBatchFees(
+ fromChain: FullChain,
+ toChain: FullChain,
+ nft: NftInfo[],
+ receiver: string
+ ): Promise;
+ /**
+ * @param nonce : {@link ChainNonce} could be a ElrondNonce, Web3Nonce, or TronNonce.
+ * @param params : New Params to be set.
+ */
+ updateParams(
+ nonce: T,
+ params: InferChainParam
+ ): void;
+ pkeyToSigner(
+ nonce: S,
+ key: string
+ ): Promise>>;
+ /**
+ * Get transaction in the destination chain
+ * WARN: use claimAlgorandNft instead for algorand.
+ *
+ * @param chain source chain
+ * @param destination destination chain
+ * @param hash transaction hash from source chain
+ *
+ * @returns transaction hash in original chain, unique action id
+ */
+ getDestinationTransaction(
+ chain: ExtractAction & ExtractTxnStatus,
+ destination: number,
+ hash: Txn
+ ): Promise<[string, TransactionStatus]>;
+ /**
+ * Claim an algorand nft
+ *
+ * @param originChain chain from which the nft was transferred
+ * @param txn Transaction Hash of the original
+ * @param claimer the account which can claim the nft
+ */
+ waitAlgorandNft(
+ originChain: ExtractAction & ChainNonceGet,
+ txn: Txn,
+ claimer: AlgoSignerH
+ ): Promise;
+ /**
+ * @param claimer: the account which can claim the nfts
+ */
+ claimableAlgorandNfts(claimer: string): Promise;
+
+ getVerifiedContract(
+ from: string,
+ targetChain: number,
+ fc: number,
+ tokenId?: string
+ ): Promise;
+
+ checkWhitelist(
+ chain: Partial> & ChainNonceGet,
+ nft: NftInfo
+ ): Promise;
+
+ isWrappedNft(
+ nft: NftInfo,
+ fromChain: number
+ ): Promise<{ bool: boolean; wrapped: any }>;
+
+ setProvider(fromChain: number, provider: any): Promise;
+
+ whitelistEVM(
+ chain: T,
+ address: string,
+ nonce: number
+ ): Promise<{ success: true }>;
+};
+
+/**
+ * A type representing all the supported chain params.
+ */
+export interface ChainParams {
+ elrondParams: ElrondParams;
+ hecoParams: Web3Params;
+ bscParams: Web3Params;
+ ropstenParams: Web3Params;
+ avalancheParams: Web3Params;
+ polygonParams: Web3Params;
+ fantomParams: Web3Params;
+ tronParams: TronParams;
+ celoParams: Web3Params;
+ harmonyParams: Web3Params;
+ ontologyParams: Web3Params;
+ xDaiParams: Web3Params;
+ algorandParams: AlgorandParams;
+ fuseParams: Web3Params;
+ uniqueParams: Web3Params;
+ tezosParams: TezosParams;
+ velasParams: Web3Params;
+ iotexParams: Web3Params;
+ vechainParams: Web3Params;
+ auroraParams: Web3Params;
+ godwokenParams: Web3Params;
+ gateChainParams: Web3Params;
+ secretParams: SecretParams;
+ hederaParams: Web3Params;
+ skaleParams: Web3ERC20Params;
+ dfinityParams: DfinityParams;
+ nearParams: NearParams;
+ moonbeamParams: Web3Params;
+ abeyChainParams: Web3Params;
+ tonParams: TonParams;
+ aptosParams: AptosParams;
+ solanaParams: SolanaParams;
+ caduceusParams: Web3Params;
+ okcParams: Web3Params;
+ arbitrumParams: Web3Params;
+ bitgertParams: Web3Params;
+}
+
+export type MoralisNetwork = "mainnet" | "testnet";
+
+/**
+ * A struct for the configuration of the library.
+ * @field exchangeRateUri: The URI of the exchange rate service.
+ * @field moralisServer: The URI of the moralis server.
+ * @field moralisAppId: The app id of the moralis server.
+ * @field tronScanUri: The URI of the tron scan service.
+ */
+export interface AppConfig {
+ exchangeRateUri: string;
+ heartbeatUri: string;
+ txSocketUri: string;
+ nftListUri: string;
+ nftListAuthToken: string;
+ tronScanUri: string;
+ wrappedNftPrefix: string;
+ scVerifyUri: string;
+ network: "testnet" | "mainnet" | "staging";
+}
+
+function mapNonceToParams(chainParams: Partial): ParamMap {
+ const cToP: ParamMap = new Map();
+ cToP.set(Chain.ELROND, chainParams.elrondParams);
+ cToP.set(Chain.HECO, chainParams.hecoParams);
+ cToP.set(Chain.BSC, chainParams.bscParams);
+ cToP.set(Chain.ETHEREUM, chainParams.ropstenParams);
+ cToP.set(Chain.AVALANCHE, chainParams.avalancheParams);
+ cToP.set(Chain.POLYGON, chainParams.polygonParams);
+ cToP.set(Chain.FANTOM, chainParams.fantomParams);
+ cToP.set(Chain.TRON, chainParams.tronParams);
+ cToP.set(Chain.CELO, chainParams.celoParams!);
+ cToP.set(Chain.HARMONY, chainParams.harmonyParams);
+ cToP.set(Chain.ONT, chainParams.ontologyParams);
+ cToP.set(Chain.XDAI, chainParams.xDaiParams);
+ cToP.set(Chain.ALGORAND, chainParams.algorandParams);
+ cToP.set(Chain.FUSE, chainParams.fuseParams);
+ cToP.set(Chain.UNIQUE, chainParams.uniqueParams);
+ cToP.set(Chain.TEZOS, chainParams.tezosParams);
+ cToP.set(Chain.VELAS, chainParams.velasParams);
+ cToP.set(Chain.IOTEX, chainParams.iotexParams);
+ cToP.set(Chain.AURORA, chainParams.auroraParams);
+ cToP.set(Chain.GODWOKEN, chainParams.godwokenParams);
+ cToP.set(Chain.GATECHAIN, chainParams.gateChainParams);
+ cToP.set(Chain.VECHAIN, chainParams.vechainParams);
+ cToP.set(Chain.SECRET, chainParams.secretParams);
+ cToP.set(Chain.HEDERA, chainParams.hederaParams);
+ cToP.set(Chain.SKALE, chainParams.skaleParams);
+ cToP.set(Chain.DFINITY, chainParams.dfinityParams);
+ cToP.set(Chain.NEAR, chainParams.nearParams);
+ cToP.set(Chain.MOONBEAM, chainParams.moonbeamParams);
+ cToP.set(Chain.ABEYCHAIN, chainParams.abeyChainParams);
+ cToP.set(Chain.TON, chainParams.tonParams);
+ cToP.set(Chain.APTOS, chainParams.aptosParams);
+ cToP.set(Chain.SOLANA, chainParams.solanaParams);
+ cToP.set(Chain.CADUCEUS, chainParams.caduceusParams);
+ cToP.set(Chain.OKC, chainParams.okcParams);
+ cToP.set(Chain.ARBITRUM, chainParams.arbitrumParams);
+ cToP.set(Chain.BITGERT, chainParams.bitgertParams);
+ return cToP;
+}
+/**
+ * This function is the basic entry point to use this package as a library.
+ * @param appConfig: {@link AppConfig} The configuration of the library.
+ * @param chainParams: {@link ChainParams} Contains the details for all the chains to mint and transfer NFTs between them.
+ * @returns {ChainFactory}: A factory object that can be used to mint and transfer NFTs between chains.
+ */
+export function ChainFactory(
+ appConfig: AppConfig,
+ chainParams: Partial
+): ChainFactory {
+ let helpers: HelperMap = new Map();
+ let cToP = mapNonceToParams(chainParams);
+
+ const heartbeatRepo = bridgeHeartbeat(appConfig.heartbeatUri);
+
+ const remoteExchangeRate = exchangeRateRepo(appConfig.exchangeRateUri);
+
+ const txSocket = socketHelper(appConfig.txSocketUri);
+
+ const nftlistRest = axios.create({
+ baseURL: appConfig.nftListUri,
+ headers: {
+ Authorization: `Bearer ${appConfig.nftListAuthToken}`,
+ },
+ });
+
+ const inner = async (
+ chain: T
+ ): Promise> => {
+ let helper = helpers.get(chain);
+ if (helper === undefined) {
+ helper = await CHAIN_INFO.get(chain)!.constructor(cToP.get(chain)!);
+ helpers.set(chain, helper);
+ }
+ return helper!;
+ };
+
+ const setProvider = async (chain: T, provider: any) => {
+ const args = {
+ ...cToP.get(chain)!,
+ provider,
+ };
+ const helper = await CHAIN_INFO.get(chain)!.constructor(args);
+ helpers.set(chain, helper);
+ };
+
+ async function calcExchangeFees(
+ fromChain: T,
+ toChain: T,
+ val: BigNumber,
+ toChainFee: FeeMargins
+ ): Promise {
+ const rate = await remoteExchangeRate.getBatchedRate([
+ CHAIN_INFO.get(toChain)!.currency,
+ CHAIN_INFO.get(fromChain)!.currency,
+ ]);
+ const feeR = val.dividedBy(CHAIN_INFO.get(toChain)!.decimals);
+ const fromExRate = rate.get(CHAIN_INFO.get(fromChain)!.currency)!;
+ const toExRate = rate.get(CHAIN_INFO.get(toChain)!.currency)!;
+ const usdFee = Math.min(
+ Math.max(toChainFee.min, feeR.times(toExRate * 0.1).toNumber()),
+ toChainFee.max
+ );
+ const feeProfit = usdFee / fromExRate;
+
+ return feeR
+ .times(toExRate / fromExRate)
+ .plus(feeProfit * 0.5)
+ .times(CHAIN_INFO.get(fromChain)!.decimals)
+ .integerValue(BigNumber.ROUND_CEIL);
+ }
+ const estimateFees = async (
+ fromChain: FullChain,
+ toChain: FullChain,
+ nft: NftInfo,
+ receiver: string,
+ extraFee?: BigNumber.Value
+ ) => {
+ const estimate = await toChain.estimateValidateTransferNft(
+ receiver,
+ nft as any,
+ ""
+ );
+
+ let conv = await calcExchangeFees(
+ fromChain.getNonce(),
+ toChain.getNonce(),
+ estimate,
+ toChain.getFeeMargin()
+ );
+
+ if (extraFee) {
+ conv = conv.multipliedBy(extraFee).integerValue(BigNumber.ROUND_CEIL);
+ console.log("extra conv");
+ }
+
+ return conv;
+ };
+
+ const estimateWithContractDep = async <
+ SignerF,
+ RawNftF,
+ SignerT,
+ RawNftT,
+ Resp
+ >(
+ fromChain: FullChain,
+ toChain: FullChain,
+ nft: NftInfo
+ ) => {
+ let calcContractDep: BigNumber = new BigNumber("0"),
+ originalContract,
+ originalChain;
+ try {
+ const { bool, wrapped } = await isWrappedNft(
+ nft,
+ fromChain.getNonce(),
+ toChain.getNonce()
+ );
+
+ if (bool) {
+ originalContract = wrapped?.contract?.toLowerCase();
+ originalChain = wrapped?.origin;
+ } else {
+ originalContract = nft.native.contract.toLowerCase();
+ originalChain = nft.native.chainId;
+ }
+
+ const [checkWithOutTokenId, verifyList] = await Promise.all([
+ axios
+ .post(`https://sc-verify.xp.network/default/checkWithOutTokenId`, {
+ fromChain: Number(originalChain),
+ chain:
+ fromChain?.getNonce() == originalChain //if first time sending
+ ? Number(toChain.getNonce())
+ : toChain.getNonce() == originalChain //if sending back
+ ? Number(fromChain.getNonce())
+ : Number(toChain.getNonce()), //all the rest
+ sc: originalContract,
+ })
+ .catch(() => false),
+ axios
+ .get(
+ `https://sc-verify.xp.network/verify/list?from=${originalContract}&targetChain=${toChain.getNonce()}&fromChain=${fromChain.getNonce()}&tokenId=1`
+ )
+ .then((res) => {
+ return res.data.data.length > 0 && res.data.code == 200;
+ })
+ .catch(() => false),
+ ]);
+
+ if (!checkWithOutTokenId && !verifyList && toChain?.estimateContractDep) {
+ //@ts-ignore
+ const contractFee = await toChain?.estimateContractDep(toChain);
+ calcContractDep = await calcExchangeFees(
+ fromChain.getNonce(),
+ toChain.getNonce(),
+ contractFee,
+ toChain.getFeeMargin()
+ );
+ }
+
+ return { calcContractDep };
+ } catch (error: any) {
+ console.log(
+ error.message,
+ console.log("error in estimateWithContractDep")
+ );
+ return { calcContractDep };
+ }
+ };
+
+ const estimateSFTfees = async (
+ fromChain: FullChain,
+ amount: bigint,
+ price: number = 0.05
+ ) => {
+ const rate = await remoteExchangeRate.getBatchedRate([
+ CHAIN_INFO.get(fromChain.getNonce())!.currency,
+ ]);
+
+ const fromExRate = rate.get(
+ CHAIN_INFO.get(fromChain.getNonce())!.currency
+ )!;
+ const y = price / fromExRate;
+
+ const sftFees = Number(amount) <= 10 ? 0 : y * (Number(amount) - 10);
+ return new BigNumber(sftFees)
+ .multipliedBy(CHAIN_INFO.get(fromChain.getNonce())!.decimals)
+ .integerValue();
+ };
+
+ async function bridgeStatus(): Promise<{ [x: number]: "alive" | "dead" }> {
+ const res = await heartbeatRepo.status();
+ return Object.fromEntries(
+ Object.entries(res).map(([c, s]) => [
+ c,
+ s.bridge_alive ? "alive" : "dead",
+ ])
+ );
+ }
+
+ async function estimateBatchFees(
+ fromChain: FullChainBatch,
+ toChain: FullChainBatch,
+ nft: NftInfo[],
+ receiver: string
+ ): Promise {
+ const estimate = await toChain.estimateValidateTransferNftBatch(
+ receiver,
+ nft as any,
+ new Array(nft.length).fill(toChain.XpNft)
+ );
+ const conv = await calcExchangeFees(
+ fromChain.getNonce(),
+ toChain.getNonce(),
+ estimate.times(nft.length),
+ toChain.getFeeMargin()
+ );
+ return conv;
+ }
+
+ async function requireBridge(chains: number[]): Promise {
+ const status = await heartbeatRepo.status();
+ let deadChain: number | undefined;
+ const alive = chains.every((c) => {
+ const stat = status[c].bridge_alive;
+ if (!stat) {
+ deadChain = c;
+ }
+ return stat;
+ });
+ if (!alive) {
+ throw Error(`chain ${deadChain} is dead! its unsafe to use the bridge`);
+ }
+ }
+
+ const oldXpWraps = new Set([
+ "0xe12B16FFBf7D79eb72016102F3e3Ae6fe03fCA56",
+ "0xc69ECD37122A9b5FD7e62bC229d478BB83063C9d",
+ "0xe12B16FFBf7D79eb72016102F3e3Ae6fe03fCA56",
+ "0xa1B8947Ff4C1fD992561F629cfE67aEb90DfcBd5",
+ "0x09F4e56187541f2bC660B0810cA509D2f8c65c96",
+ "0x8B2957DbDC69E158aFceB9822A2ff9F2dd5BcD65",
+ "0xE773Be36b35e7B58a9b23007057b5e2D4f6686a1",
+ "0xFC2b3dB912fcD8891483eD79BA31b8E5707676C9",
+ "0xb4A252B3b24AF2cA83fcfdd6c7Fac04Ff9d45A7D",
+ ]);
+
+ function checkNotOldWrappedNft(contract: string) {
+ if (oldXpWraps.has(contract)) {
+ throw new Error(`${contract} is an old wrapped NFT`);
+ }
+ }
+
+ async function isWrappedNft(nft: NftInfo, fc: number, tc?: number) {
+ if (fc === Chain.TEZOS) {
+ return {
+ bool:
+ typeof (nft.native as any).meta?.token?.metadata?.wrapped !==
+ "undefined",
+ wrapped: undefined,
+ };
+ }
+ /*if (fc === Chain.NEAR) {
+ const data = (nft as any).native?.wrapped || (nft as any).wrapped;
+ return {
+ bool: typeof data !== "undefined",
+ wrapped: undefined,
+ };
+ }*/
+ try {
+ checkNotOldWrappedNft(nft.collectionIdent);
+ } catch (_) {
+ return { bool: false, wrapped: undefined };
+ }
+
+ const wrapped = (await axios.get(nft.uri).catch(() => undefined))?.data
+ .wrapped;
+ const contract = wrapped?.contract || wrapped?.source_mint_ident;
+ tc && contract && checkBlockedContracts(tc, contract);
+
+ return { bool: typeof wrapped !== "undefined", wrapped };
+ }
+
+ async function algoOptInCheck(
+ nft: NftInfo,
+ toChain: FullChain,
+ receiver: string
+ ) {
+ if ("meta" in (nft.native as Record)) return;
+ const nftDat = await axios.get(nft.uri);
+ if (
+ nftDat.data.wrapped.origin == Chain.ALGORAND.toString() &&
+ "isOptIn" in toChain &&
+ !(await (toChain as AlgorandHelper).isOptIn(
+ receiver,
+ parseInt(nftDat.data.wrapped.assetID)
+ ))
+ ) {
+ throw Error("receiver hasn't opted-in to wrapped nft");
+ }
+ }
+
+ async function getVerifiedContract(
+ from: string,
+ tc: number,
+ fc: number,
+ tokenId?: string
+ ): Promise {
+ const res = await axios
+ .post<{ data: string }>(
+ `${appConfig.scVerifyUri}/default/`,
+ {
+ sc: from,
+ chain: tc,
+ fromChain: fc,
+ tokenId: tokenId && !isNaN(Number(tokenId)) ? tokenId : undefined,
+ },
+ {
+ headers: _headers,
+ }
+ )
+ .catch(() => {
+ return undefined;
+ });
+ return res?.data.data;
+ }
+
+ async function checkMintWith(
+ from: string,
+ to: string,
+ targetChain: number,
+ fromChain: number,
+ tokenId?: string
+ ): Promise {
+ const res = await axios
+ .post<{ data: "allowed" | "not allowed" }>(
+ `${appConfig.scVerifyUri}/verify`,
+ { from, to, targetChain, fromChain, tokenId },
+ {
+ headers: _headers,
+ }
+ )
+ .catch(() => undefined);
+
+ return res?.data.data == "allowed";
+ }
+
+ return {
+ estimateWithContractDep,
+ getVerifiedContract,
+ balance: (i, a) => i.balance(a),
+ async transferBatchNft(from, to, nfts, signer, receiver, fee, mw) {
+ type Result = ReturnType;
+ let result: Result[] = [];
+ if (appConfig.network === "mainnet") {
+ await requireBridge([from.getNonce(), to.getNonce()]);
+ }
+
+ if (!fee) {
+ fee = await estimateBatchFees(from, to, nfts, receiver);
+ }
+ if (!(await to.validateAddress(receiver))) {
+ throw Error("invalid address");
+ }
+ console.log(`Batch Minting With: ${mw || to.XpNft1155!}`);
+ const wrapped: NftInfo[] = [];
+ const unwrapped: NftInfo[] = [];
+ await Promise.all(
+ nfts.map(async (e) => {
+ // @ts-ignore
+ if (e.native.contractType && e.native.contractType === "ERC721") {
+ throw new Error(`ERC721 is not supported`);
+ }
+ if ((await isWrappedNft(e, from.getNonce())).bool) {
+ wrapped.push(e);
+ } else {
+ unwrapped.push(e);
+ }
+ })
+ );
+ unwrapped.length &&
+ result.push(
+ from.transferNftBatchToForeign(
+ signer,
+ to.getNonce(),
+ receiver,
+ unwrapped,
+ mw || to.XpNft1155!,
+ new BigNumber(fee)
+ )
+ );
+ wrapped.length &&
+ result.push(
+ from.unfreezeWrappedNftBatch(
+ signer,
+ to.getNonce(),
+ receiver,
+ wrapped,
+ new BigNumber(fee)
+ )
+ );
+ return await Promise.all(result);
+ },
+ estimateBatchFees,
+ async whitelistEVM(chain: T, address: string) {
+ const chainLocal = cToP.get(chain);
+
+ if (!chainLocal) throw new Error("Chain not found");
+ const params = await CHAIN_INFO.get(chain)?.constructor(chainLocal);
+ if (!params) throw new Error("An error occured");
+ const isAddressValid = await params.validateAddress(address);
+ if (!isAddressValid) throw new Error("Address is not valid");
+
+ try {
+ await chainLocal.notifier.notifyEVM(chain, address);
+ return { success: true };
+ } catch (error) {
+ throw new Error("An error occured");
+ }
+ },
+ async transferSft(from, to, nft, sender, receiver, amt, fee?, mintWith?) {
+ if (Number(amt) > 50)
+ throw new Error("Currenly more that 50 SFTs is not supported");
+ let transfers = Array(parseInt(amt.toString())).fill(nft);
+ if (!fee) {
+ fee = await estimateFees(from, to, transfers[0], receiver);
+ }
+ const sftFees = await estimateSFTfees(from, amt, 0.05);
+ const x = new BigNumber(fee).plus(sftFees);
+
+ console.log(x.toNumber());
+
+ if (amt === BigInt(1)) {
+ const response = this.transferNft(
+ from,
+ to,
+ nft,
+ sender,
+ receiver,
+ new BigNumber(x!).integerValue(),
+ mintWith
+ );
+ return response as any;
+ } else {
+ const response = this.transferBatchNft(
+ from,
+ to,
+ transfers,
+ sender,
+ receiver,
+ new BigNumber(x!).integerValue(),
+ mintWith
+ );
+ return response as any;
+ }
+
+ const response = this.transferBatchNft(
+ from,
+ to,
+ transfers,
+ sender,
+ receiver,
+ new BigNumber(x!).integerValue(),
+ mintWith
+ );
+ return response;
+ },
+ async getDestinationTransaction(
+ chain: ExtractAction & ExtractTxnStatus,
+ targetNonce: number,
+ txn: T
+ ) {
+ const action = await chain.extractAction(txn);
+ const hash = await txSocket.waitTxHash(targetNonce, action);
+ const status = await chain.extractTxnStatus(hash);
+ return [hash, status];
+ },
+ async pkeyToSigner(nonce: T, key: string) {
+ switch (nonce) {
+ case Chain.ELROND: {
+ return UserSigner.fromPem(key);
+ }
+ case Chain.TRON: {
+ return key;
+ }
+ case Chain.ALGORAND: {
+ const algo = await inner(Chain.ALGORAND);
+ const mnem = algosdk.secretKeyToMnemonic(Base64.toUint8Array(key));
+ return algoSignerWrapper(
+ algo.algod,
+ algosdk.mnemonicToSecretKey(mnem)
+ );
+ }
+ default: {
+ const chainH = (await inner(nonce)) as any;
+ return chainH.createWallet(key);
+ }
+ }
+ },
+ estimateFees,
+ estimateSFTfees,
+ inner,
+ bridgeStatus,
+ updateParams(
+ chainNonce: T,
+ params: InferChainParam
+ ) {
+ helpers.delete(chainNonce);
+ cToP.set(chainNonce, params);
+ },
+ async nftList(chain: ChainNonceGet & T, owner: string) {
+ if (chain.getNonce() === Chain.TON) {
+ console.log("decode for ton");
+ owner = base64url.encode(owner);
+ }
+
+ let res = await nftlistRest.get<{ data: NftInfo>[] }>(
+ `/nfts/${chain.getNonce()}/${owner}`
+ );
+
+ if (res.headers["Retry-After"]) {
+ await new Promise((r) => setTimeout(r, 30000));
+ return await this.nftList(chain, owner);
+ }
+ return res.data.data;
+ },
+ transferNft: async (
+ fromChain,
+ toChain,
+ nft,
+ sender,
+ receiver,
+ fee,
+ mintWith,
+ gasLimit,
+ extraFee,
+ gasPrice
+ ) => {
+ //@ts-ignore
+ if (nft.native.contract) {
+ if (![9, 18, 24, 31, 27, 26].includes(fromChain.getNonce())) {
+ //@ts-ignore
+ checkNotOldWrappedNft(utils.getAddress(nft.native.contract));
+ }
+ }
+
+ if (appConfig.network === "mainnet") {
+ await requireBridge([fromChain.getNonce(), toChain.getNonce()]);
+ }
+
+ if (!fee) {
+ fee = await estimateFees(fromChain, toChain, nft, receiver, extraFee);
+ console.log(new BigNumber(fee).toString());
+ }
+ // if (!(await toChain.validateAddress(receiver))) {
+ // throw Error("invalid address");
+ // }
+
+ if (
+ (await isWrappedNft(nft, fromChain.getNonce(), toChain.getNonce())).bool
+ ) {
+ await algoOptInCheck(nft, toChain, receiver);
+
+ const res = await fromChain.unfreezeWrappedNft(
+ sender,
+ receiver,
+ nft,
+ new BigNumber(fee),
+ toChain.getNonce().toString(),
+ gasLimit,
+ gasPrice
+ );
+
+ return res;
+ } else {
+ const mw =
+ //@ts-ignore contract is checked
+ "contract" in nft.native &&
+ mintWith &&
+ (await checkMintWith(
+ nft.collectionIdent,
+ mintWith,
+ toChain.getNonce(),
+ fromChain.getNonce(),
+ prepareTokenId(nft, fromChain.getNonce())
+ ))
+ ? mintWith
+ : getDefaultContract(nft, fromChain, toChain);
+
+ console.log(`Minting With : ${mw}`);
+
+ if (mw === undefined) {
+ throw new Error(`Mint with is not set`);
+ }
+
+ const res = await fromChain.transferNftToForeign(
+ sender,
+ toChain.getNonce(),
+ receiver,
+ nft,
+ new BigNumber(fee),
+ mw,
+ gasLimit,
+ gasPrice
+ );
+
+ return res;
+ }
+ },
+ mint: async (
+ chain: MintNft,
+ owner: Signer,
+ args: Args
+ ): Promise => {
+ return await chain.mintNft(owner, args);
+ },
+ /**
+ * Claim a transferred NFT
+ * @param serialNumber The Serial Number of the claimable NFTs
+ * @param contractAddress The MintWith HTS Proxy Contract used in the transfer
+ * @param sender wallet of the sender
+ * @returns txn response of the claimer
+ */
+ async claimHederaNFT(serialNumber, contractAddress, htsToken, sender) {
+ const htscf = new ContractFactory(
+ HEDERA_PROXY_ABI,
+ HEDERA_PROXY_BC,
+ sender
+ );
+ const hts_contract = htscf.attach(contractAddress);
+ const cf = new ContractFactory(HEDERA_TOKEN_SERVICE_ABI, "0x", sender);
+ const contract = cf.attach("0x0000000000000000000000000000000000000167");
+ (
+ await contract.associateToken(await sender.getAddress(), htsToken, {
+ gasLimit: 1000000,
+ })
+ ).wait();
+
+ const res = await hts_contract.functions.claimNft(
+ serialNumber,
+ htsToken,
+ {
+ gasLimit: 1000000,
+ }
+ );
+ return res;
+ },
+ /**
+ * Returns all the claimable NFTs of the contract
+ * @param proxyContract the address of the HTS Proxy contract that was used as mintWith in the transfer
+ * @param sender wallet of the sender
+ * @returns array of tokens that were minted
+ */
+ async listHederaClaimableNFT(proxyContract, htsToken, sender) {
+ const cf = new ContractFactory(HEDERA_PROXY_ABI, HEDERA_PROXY_BC, sender);
+ const contract = cf.attach(proxyContract);
+ const tokens = await contract.functions.getClaimableNfts(
+ await sender.getAddress(),
+ htsToken,
+ {
+ gasLimit: 1000000,
+ }
+ );
+ return tokens[0];
+ },
+ waitAlgorandNft: async (origin, hash, claimer) => {
+ const action = await origin.extractAction(hash);
+
+ return await txSocket.waitAlgorandNft(
+ origin.getNonce(),
+ claimer.address,
+ action
+ );
+ },
+ claimableAlgorandNfts: async (claimer) => {
+ const algo: AlgorandHelper = await inner(Chain.ALGORAND);
+ return await algo.claimableNfts(txSocket, claimer);
+ },
+ async checkWhitelist(chain, nft) {
+ if (
+ !chain.isNftWhitelisted ||
+ (await isWrappedNft(nft, chain.getNonce())).bool
+ ) {
+ return true;
+ }
+
+ return await chain.isNftWhitelisted(nft);
+ },
+ isWrappedNft,
+ setProvider,
+ };
+}
diff --git a/src/fakeERC1155.json b/src/fakeERC1155.json
deleted file mode 100644
index 50e1189f7..000000000
--- a/src/fakeERC1155.json
+++ /dev/null
@@ -1,437 +0,0 @@
-{
- "abi": [
- {
- "inputs": [],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "bool",
- "name": "approved",
- "type": "bool"
- }
- ],
- "name": "ApprovalForAll",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "previousOwner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "OwnershipTransferred",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- },
- {
- "indexed": false,
- "internalType": "uint256[]",
- "name": "values",
- "type": "uint256[]"
- }
- ],
- "name": "TransferBatch",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "indexed": false,
- "internalType": "uint256",
- "name": "value",
- "type": "uint256"
- }
- ],
- "name": "TransferSingle",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": false,
- "internalType": "string",
- "name": "value",
- "type": "string"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "URI",
- "type": "event"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "balanceOf",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address[]",
- "name": "accounts",
- "type": "address[]"
- },
- {
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- }
- ],
- "name": "balanceOfBatch",
- "outputs": [
- {
- "internalType": "uint256[]",
- "name": "",
- "type": "uint256[]"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "burn",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "account",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "operator",
- "type": "address"
- }
- ],
- "name": "isApprovedForAll",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "mint",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "renounceOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256[]",
- "name": "ids",
- "type": "uint256[]"
- },
- {
- "internalType": "uint256[]",
- "name": "amounts",
- "type": "uint256[]"
- },
- {
- "internalType": "bytes",
- "name": "data",
- "type": "bytes"
- }
- ],
- "name": "safeBatchTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "uint256",
- "name": "amount",
- "type": "uint256"
- },
- {
- "internalType": "bytes",
- "name": "data",
- "type": "bytes"
- }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "operator",
- "type": "address"
- },
- {
- "internalType": "bool",
- "name": "approved",
- "type": "bool"
- }
- ],
- "name": "setApprovalForAll",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- },
- {
- "internalType": "string",
- "name": "uri_",
- "type": "string"
- }
- ],
- "name": "setURI",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes4",
- "name": "interfaceId",
- "type": "bytes4"
- }
- ],
- "name": "supportsInterface",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "transferOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "id",
- "type": "uint256"
- }
- ],
- "name": "uri",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }
- ]
-}
diff --git a/src/fakeERC721.json b/src/fakeERC721.json
deleted file mode 100644
index 8a0718e80..000000000
--- a/src/fakeERC721.json
+++ /dev/null
@@ -1,365 +0,0 @@
-{
- "abi": [
- {
- "inputs": [],
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "_owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "_approved",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "Approval",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "_owner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "_operator",
- "type": "address"
- },
- {
- "indexed": false,
- "internalType": "bool",
- "name": "_approved",
- "type": "bool"
- }
- ],
- "name": "ApprovalForAll",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "previousOwner",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "newOwner",
- "type": "address"
- }
- ],
- "name": "OwnershipTransferred",
- "type": "event"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "internalType": "address",
- "name": "_from",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "address",
- "name": "_to",
- "type": "address"
- },
- {
- "indexed": true,
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "Transfer",
- "type": "event"
- },
- {
- "inputs": [],
- "name": "CANNOT_TRANSFER_TO_ZERO_ADDRESS",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "NOT_CURRENT_OWNER",
- "outputs": [
- {
- "internalType": "string",
- "name": "",
- "type": "string"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_approved",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "approve",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_owner",
- "type": "address"
- }
- ],
- "name": "balanceOf",
- "outputs": [
- {
- "internalType": "uint256",
- "name": "",
- "type": "uint256"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "getApproved",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_owner",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "_operator",
- "type": "address"
- }
- ],
- "name": "isApprovedForAll",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [],
- "name": "owner",
- "outputs": [
- {
- "internalType": "address",
- "name": "",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "ownerOf",
- "outputs": [
- {
- "internalType": "address",
- "name": "_owner",
- "type": "address"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "_to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "_to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- },
- {
- "internalType": "bytes",
- "name": "_data",
- "type": "bytes"
- }
- ],
- "name": "safeTransferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_operator",
- "type": "address"
- },
- {
- "internalType": "bool",
- "name": "_approved",
- "type": "bool"
- }
- ],
- "name": "setApprovalForAll",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "bytes4",
- "name": "_interfaceID",
- "type": "bytes4"
- }
- ],
- "name": "supportsInterface",
- "outputs": [
- {
- "internalType": "bool",
- "name": "",
- "type": "bool"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_from",
- "type": "address"
- },
- {
- "internalType": "address",
- "name": "_to",
- "type": "address"
- },
- {
- "internalType": "uint256",
- "name": "_tokenId",
- "type": "uint256"
- }
- ],
- "name": "transferFrom",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- {
- "internalType": "address",
- "name": "_newOwner",
- "type": "address"
- }
- ],
- "name": "transferOwnership",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- }
- ]
-}
diff --git a/src/heartbeat/index.ts b/src/heartbeat/index.ts
new file mode 100644
index 000000000..ec022a78f
--- /dev/null
+++ b/src/heartbeat/index.ts
@@ -0,0 +1,19 @@
+import axios from "axios";
+import { StatusResp } from "./resp";
+
+export type BridgeHeartbeat = {
+ status(): Promise;
+};
+
+export function bridgeHeartbeat(baseURL: string): BridgeHeartbeat {
+ const api = axios.create({
+ baseURL,
+ });
+
+ return {
+ async status() {
+ const res = await api.get("/status");
+ return res.data;
+ },
+ };
+}
diff --git a/src/heartbeat/resp.ts b/src/heartbeat/resp.ts
new file mode 100644
index 000000000..68263169d
--- /dev/null
+++ b/src/heartbeat/resp.ts
@@ -0,0 +1,18 @@
+type DeathReason = {
+ component: "node" | "validator" | "balance";
+ error: string;
+};
+
+type ValidatorStatus = {
+ status: "alive" | "dead";
+ death_reason?: DeathReason;
+};
+
+type ChainStatus = {
+ bridge_alive: boolean;
+ validators: ValidatorStatus[];
+};
+
+export type StatusResp = {
+ [chainNonce: string]: ChainStatus;
+};
diff --git a/src/helpers/algorand.ts b/src/helpers/algorand.ts
new file mode 100644
index 000000000..1e8112f10
--- /dev/null
+++ b/src/helpers/algorand.ts
@@ -0,0 +1,565 @@
+import WalletConnect from "@walletconnect/client";
+import algosdk, { SuggestedParams } from "algosdk";
+import { formatJsonRpcRequest } from "@json-rpc-tools/utils";
+import { BigNumber } from "bignumber.js";
+import { Base64 } from "js-base64";
+import {
+ AlgorandSocketHelper,
+ Chain,
+ ChainNonceGet,
+ EstimateTxFees,
+ NftInfo,
+ PreTransfer,
+ TransferNftForeign,
+ UnfreezeForeignNft,
+ ValidateAddress,
+} from "..";
+import MyAlgoConnect from "@randlabs/myalgo-connect";
+import { EvNotifier } from "../notifier";
+import { BalanceCheck, FeeMargins, GetFeeMargins, GetTokenURI } from "./chain";
+
+type TxResp = {
+ txId: string;
+};
+
+type AlgoNft = {
+ "metadata-hash"?: string;
+ name?: string;
+ "unit-name"?: string;
+ url: string;
+ creator: string;
+ nftId: number;
+};
+
+type SignedTxn = {
+ txID?: string;
+ blob: string;
+};
+
+type Ledger = "MainNet" | "TestNet" | "any";
+
+type BrowserSigner = {
+ accounts(args: { ledger: Ledger }): Promise<{ address: string }[]>;
+ signTxn(transactions: { txn: string }[]): Promise;
+ send(info: { ledger: Ledger; tx: string }): Promise;
+};
+
+export type ClaimNftInfo = {
+ appId: number;
+ nftId: number;
+};
+
+/**
+ * Selected address & ledger must be given explicitly
+ */
+export type AlgoSignerH = {
+ readonly algoSigner: BrowserSigner;
+ readonly address: string;
+ readonly ledger: Ledger;
+};
+
+/**
+ * This library is written in typescript.
+ * unfortunately the browser extension injects the AlgoSigner in a way we can't get a typed object wwithout this hack.
+ *
+ * @return Strongly typed AlgoSigner from extension
+ */
+export function typedAlgoSigner(): BrowserSigner {
+ //@ts-expect-error why do you inject libraries like this :|
+ if (typeof AlgoSigner === "undefined") {
+ throw Error("algosigner not available!");
+ }
+
+ //@ts-expect-error why do you inject libraries like this :|
+ return AlgoSigner;
+}
+
+export function algoSignerWrapper(
+ algod: algosdk.Algodv2,
+ acc: algosdk.Account
+): AlgoSignerH {
+ const signer: BrowserSigner = {
+ accounts(_) {
+ return Promise.resolve([
+ {
+ address: acc.addr,
+ },
+ ]);
+ },
+ signTxn(txns) {
+ return Promise.resolve(
+ txns.map((t) => {
+ const signed = algosdk.signTransaction(
+ algosdk.decodeUnsignedTransaction(Base64.toUint8Array(t.txn)),
+ acc.sk
+ );
+ return {
+ txID: signed.txID,
+ blob: Base64.fromUint8Array(signed.blob),
+ };
+ })
+ );
+ },
+ send({ tx }) {
+ return algod.sendRawTransaction(Base64.toUint8Array(tx)).do();
+ },
+ };
+
+ return {
+ algoSigner: signer,
+ address: acc.addr,
+ ledger: "any",
+ };
+}
+
+export type FullClaimNft = ClaimNftInfo & {
+ name: string;
+ uri: string;
+};
+
+export type AlgorandHelper = ChainNonceGet &
+ TransferNftForeign &
+ UnfreezeForeignNft &
+ EstimateTxFees &
+ ValidateAddress & {
+ algod: algosdk.Algodv2;
+ claimNft(claimer: AlgoSignerH, info: ClaimNftInfo): Promise;
+ claimableNfts(
+ txSocket: AlgorandSocketHelper,
+ owner: string
+ ): Promise;
+ isOptIn(address: string, nftId: number): Promise;
+ optInNft(
+ signer: AlgoSignerH,
+ info: ClaimNftInfo
+ ): Promise;
+ walletConnectSigner(connector: WalletConnect, address: string): AlgoSignerH;
+ myAlgoSigner(myAlgo: MyAlgoConnect, address: string): AlgoSignerH;
+ } & Pick<
+ PreTransfer,
+ "preTransfer"
+ > & { XpNft: string } & GetFeeMargins &
+ BalanceCheck &
+ GetTokenURI;
+
+export type AlgorandParams = {
+ algodApiKey: string;
+ algodUri: string;
+ indexerUri: string;
+ algodPort: number | undefined;
+ sendNftAppId: number;
+ notifier: EvNotifier;
+ feeMargin: FeeMargins;
+};
+
+// type MinWrappedNft = {
+// wrapped: {
+// origin: string;
+// };
+// };
+
+const encoder = new TextEncoder();
+const MINT_NFT_COST = new BigNumber(1000);
+
+export function algorandHelper(args: AlgorandParams): AlgorandHelper {
+ const appAddr = algosdk.getApplicationAddress(args.sendNftAppId);
+ const algod = new algosdk.Algodv2(
+ args.algodApiKey,
+ args.algodUri,
+ args.algodPort
+ );
+ const indexer = new algosdk.Indexer(
+ args.algodApiKey,
+ args.indexerUri,
+ args.algodPort
+ );
+
+ async function waitTxnConfirm(txId: string) {
+ const status = await algod.status().do();
+ let lastRound = status["last-round"];
+ algod.pendingTransactionsInformation();
+ let pendingInfo = (await algod
+ .pendingTransactionInformation(txId)
+ .do()
+ .catch(() => ({}))) as Record;
+
+ while (
+ !(pendingInfo["confirmed-round"] && pendingInfo["confirmed-round"] > 0)
+ ) {
+ lastRound += 1;
+ await algod.statusAfterBlock(lastRound).do();
+ pendingInfo = await algod.pendingTransactionInformation(txId).do();
+ }
+ }
+
+ // async function compileProgram(
+ // client: Algodv2,
+ // programSource: string
+ // ) {
+ // const enc = new TextEncoder();
+ // const programBytes = enc.encode(programSource);
+ // const compileResponse = await client.compile(programBytes).do();
+ // const compiledBytes = new Uint8Array(
+ // Buffer.from(compileResponse.result, 'base64')
+ // );
+ // return compiledBytes;
+ // };
+
+ // async function getMintPoolProgram(client: Algodv2, recv: any) {
+ // const poolSrc = fs.readFileSync(__dirname + '/bridge_pool.tmpl.teal');
+ // return await compileProgram(
+ // client,
+ // poolSrc.toString().replace('TMPL_RECV_ADDR', recv)
+ // );
+ // }
+
+ const transferNft = async (
+ signer: AlgoSignerH,
+ chain_nonce: number,
+ to: string,
+ nft: NftInfo,
+ txFees: BigNumber,
+ mintWith?: string
+ ) => {
+ const suggested = await algod.getTransactionParams().do();
+
+ const transferTx =
+ algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({
+ from: signer.address,
+ to: appAddr,
+ amount: 1,
+ assetIndex: nft.native.nftId,
+ suggestedParams: suggested,
+ });
+
+ const paymentTxn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
+ from: signer.address,
+ suggestedParams: suggested,
+ to: appAddr,
+ amount: BigInt(txFees.toString()),
+ });
+ const appArgs = [
+ encoder.encode("freeze_nft"),
+ encoder.encode(to),
+ new Uint8Array(
+ Buffer.concat([
+ Buffer.from(new Uint32Array([0]).buffer),
+ Buffer.from(new Uint32Array([chain_nonce]).buffer).reverse(),
+ ])
+ ),
+ ];
+ if (mintWith) {
+ appArgs.push(encoder.encode(mintWith));
+ }
+ const tCallTx = algosdk.makeApplicationNoOpTxnFromObject({
+ from: signer.address,
+ appIndex: args.sendNftAppId,
+ appArgs,
+ foreignAssets: [nft.native.nftId],
+ suggestedParams: suggested,
+ });
+ algosdk.assignGroupID([tCallTx, transferTx, paymentTxn]);
+ const encodedTxns = [
+ { txn: Base64.fromUint8Array(tCallTx.toByte()) },
+ { txn: Base64.fromUint8Array(transferTx.toByte()) },
+ { txn: Base64.fromUint8Array(paymentTxn.toByte()) },
+ ];
+ const signedTxns = await signer.algoSigner.signTxn(encodedTxns);
+ const sendRes = await algod
+ .sendRawTransaction([
+ Base64.toUint8Array(signedTxns[0].blob),
+ Base64.toUint8Array(signedTxns[1].blob),
+ Base64.toUint8Array(signedTxns[2].blob),
+ ])
+ .do();
+ await waitTxnConfirm(sendRes.txId);
+
+ await args.notifier.notifyAlgorand(sendRes.txId);
+
+ return sendRes.txId as string;
+ };
+
+ async function isOptIn(addr: string, nftId: number) {
+ const userRes = await indexer.lookupAccountByID(addr).do();
+ const user = userRes["account"];
+ if (!user.assets) return false;
+
+ for (let i = 0; i < user["assets"].length; i++) {
+ if (user["assets"][i]["asset-id"] === nftId) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ async function optInNft(signer: AlgoSignerH, nft: ClaimNftInfo) {
+ if (await isOptIn(signer.address, nft.nftId)) {
+ return undefined;
+ }
+
+ const suggested = await algod.getTransactionParams().do();
+ const optIn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({
+ from: signer.address,
+ to: signer.address,
+ amount: 0,
+ assetIndex: nft.nftId,
+ suggestedParams: suggested,
+ });
+ const encodedTx = Base64.fromUint8Array(optIn.toByte());
+ const signedTx = await signer.algoSigner.signTxn([{ txn: encodedTx }]);
+ const res = await signer.algoSigner.send({
+ ledger: signer.ledger,
+ tx: signedTx[0].blob,
+ });
+ await waitTxnConfirm(res.txId);
+ return res.txId;
+ }
+
+ async function claimNft(signer: AlgoSignerH, info: ClaimNftInfo) {
+ await optInNft(signer, info);
+
+ const suggested = await algod.getTransactionParams().do();
+ const txn = algosdk.makeApplicationNoOpTxnFromObject({
+ from: signer.address,
+ suggestedParams: suggested,
+ appIndex: info.appId,
+ appArgs: [encoder.encode("transfer_nft")],
+ foreignAssets: [info.nftId],
+ });
+
+ const encodedTx = Base64.fromUint8Array(txn.toByte());
+ const signedTx = await signer.algoSigner.signTxn([{ txn: encodedTx }]);
+ const res = await signer.algoSigner.send({
+ ledger: signer.ledger,
+ tx: signedTx[0].blob,
+ });
+ await waitTxnConfirm(res.txId);
+ return res.txId;
+ }
+
+ return {
+ XpNft: "",
+ algod,
+ getNonce: () => Chain.ALGORAND,
+ claimNft,
+ optInNft,
+ isOptIn,
+ async balance(address) {
+ const acc = await algod
+ .accountInformation(address)
+ .do()
+ .catch(() => undefined);
+ if (!acc) return new BigNumber(0);
+
+ return new BigNumber(acc.amount);
+ },
+ async preTransfer(sender, nft, fee) {
+ if (await isOptIn(sender.address, nft.native.nftId)) {
+ return undefined;
+ }
+
+ const suggested = await algod.getTransactionParams().do();
+ const callTx = algosdk.makeApplicationNoOpTxnFromObject({
+ from: sender.address,
+ appIndex: args.sendNftAppId,
+ appArgs: [encoder.encode("optin_asset")],
+ foreignAssets: [nft.native.nftId],
+ suggestedParams: suggested,
+ });
+ const feesTx = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
+ from: sender.address,
+ suggestedParams: suggested,
+ to: appAddr,
+ amount: BigInt(fee.toString()),
+ });
+
+ algosdk.assignGroupID([callTx, feesTx]);
+ const encodedTxns = [
+ { txn: Base64.fromUint8Array(callTx.toByte()) },
+ { txn: Base64.fromUint8Array(feesTx.toByte()) },
+ ];
+ const signedTxns = await sender.algoSigner.signTxn(encodedTxns);
+ const sendRes = await algod
+ .sendRawTransaction([
+ Base64.toUint8Array(signedTxns[0].blob),
+ Base64.toUint8Array(signedTxns[1].blob),
+ ])
+ .do();
+ await waitTxnConfirm(sendRes.txId);
+
+ return suggested;
+ },
+ getFeeMargin() {
+ return args.feeMargin;
+ },
+ transferNftToForeign: transferNft,
+ unfreezeWrappedNft: async (signer, to, nft, txFees, nonce) => {
+ const suggested = await algod.getTransactionParams().do();
+
+ const transferTx =
+ algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({
+ from: signer.address,
+ to: appAddr,
+ amount: 1,
+ assetIndex: nft.native.nftId,
+ suggestedParams: suggested,
+ });
+ const sTransferTx = await signer.algoSigner.signTxn([
+ { txn: Base64.fromUint8Array(transferTx.toByte()) },
+ ]);
+ const transferRes = await algod
+ .sendRawTransaction(Base64.toUint8Array(sTransferTx[0].blob))
+ .do();
+ await waitTxnConfirm(transferRes.txId as string);
+
+ const paymentTxn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
+ from: signer.address,
+ suggestedParams: suggested,
+ to: appAddr,
+ amount: BigInt(txFees.toString()),
+ });
+ const appArgs = [
+ encoder.encode("withdraw_nft"),
+ encoder.encode(to),
+ new Uint8Array(
+ Buffer.from(new Uint32Array([parseInt(nonce)]).buffer).reverse()
+ ),
+ new Uint8Array(Buffer.from("")),
+ ];
+ const tCallTx = algosdk.makeApplicationNoOpTxnFromObject({
+ from: signer.address,
+ appIndex: args.sendNftAppId,
+ appArgs,
+ foreignAssets: [nft.native.nftId],
+ suggestedParams: suggested,
+ });
+ algosdk.assignGroupID([tCallTx, paymentTxn]);
+ const encodedTxns = [
+ { txn: Base64.fromUint8Array(tCallTx.toByte()) },
+ { txn: Base64.fromUint8Array(paymentTxn.toByte()) },
+ ];
+ const signedTxns = await signer.algoSigner.signTxn(encodedTxns);
+ const sendRes = await algod
+ .sendRawTransaction([
+ Base64.toUint8Array(signedTxns[0].blob),
+ Base64.toUint8Array(signedTxns[1].blob),
+ ])
+ .do();
+ await waitTxnConfirm(sendRes.txId);
+
+ await args.notifier.notifyAlgorand(sendRes.txId);
+
+ return sendRes.txId as string;
+ },
+ estimateValidateTransferNft: () => Promise.resolve(MINT_NFT_COST),
+ estimateValidateUnfreezeNft: () => Promise.resolve(MINT_NFT_COST),
+ validateAddress: (adr) => Promise.resolve(algosdk.isValidAddress(adr)),
+ claimableNfts: async (txSocket: AlgorandSocketHelper, owner: string) => {
+ await txSocket.cleanNfts(owner);
+ const claims = await txSocket.claimNfts(owner);
+
+ const res = await Promise.all(
+ claims.map(async (v) => {
+ const appId = parseInt(v.app_id);
+ const nftId = parseInt(v.nft_id);
+ const assetRes = await indexer
+ .lookupAssetByID(nftId)
+ .do()
+ .catch(() => undefined);
+ if (assetRes == undefined) return [];
+ const assetInfo = assetRes.asset;
+
+ const bal = await indexer
+ .lookupAssetBalances(nftId)
+ .currencyGreaterThan(0)
+ .currencyLessThan(2)
+ .limit(1)
+ .do();
+ if (bal.balances[0].address == owner || bal.balances[0].amount == 0)
+ return [];
+
+ return [
+ {
+ nftId,
+ appId,
+ uri: assetInfo.params.url as string,
+ name: (assetInfo.params.name as string) || "",
+ },
+ ];
+ })
+ );
+
+ return res.flat();
+ },
+ walletConnectSigner(
+ connector: WalletConnect,
+ address: string
+ ): AlgoSignerH {
+ const signer: BrowserSigner = {
+ accounts(_) {
+ return Promise.resolve(
+ connector.accounts.map((s) => ({ address: s }))
+ );
+ },
+ async signTxn(txns) {
+ const req = formatJsonRpcRequest("algo_signTxn", [txns]);
+ const signed: Array =
+ await connector.sendCustomRequest(req);
+ const decoded = signed.map((s) => {
+ return {
+ blob: s ?? "",
+ } as SignedTxn;
+ });
+ if (decoded.length != txns.length) {
+ throw Error("Couldn't sign all transactions!");
+ }
+
+ return decoded;
+ },
+ send(info: { tx: string }): Promise {
+ return algod.sendRawTransaction(Base64.toUint8Array(info.tx)).do();
+ },
+ };
+
+ return {
+ algoSigner: signer,
+ address,
+ ledger: "any",
+ };
+ },
+ myAlgoSigner(myAlgo, address): AlgoSignerH {
+ const signer: BrowserSigner = {
+ async accounts(_) {
+ const accs = await myAlgo.connect();
+ return accs;
+ },
+ async signTxn(txns) {
+ const stxs = await myAlgo.signTransaction(txns.map(({ txn }) => txn));
+ return stxs.map((tx) => ({
+ txID: tx.txID,
+ blob: Base64.fromUint8Array(tx.blob),
+ }));
+ },
+ send(info: { tx: string }): Promise {
+ return algod.sendRawTransaction(Base64.toUint8Array(info.tx)).do();
+ },
+ };
+
+ return {
+ algoSigner: signer,
+ address,
+ ledger: "any",
+ };
+ },
+ async getTokenURI(_, tokenId) {
+ if (tokenId) {
+ const res = await indexer.lookupAssetByID(+tokenId).do();
+ if (res?.asset?.params) {
+ return res.asset.params.url as string;
+ }
+ }
+ return "";
+ },
+ };
+}
diff --git a/src/helpers/aptos/bridge_client.ts b/src/helpers/aptos/bridge_client.ts
new file mode 100644
index 000000000..68665086b
--- /dev/null
+++ b/src/helpers/aptos/bridge_client.ts
@@ -0,0 +1,345 @@
+import {
+ AptosAccount,
+ AptosClient,
+ HexString,
+ MaybeHexString,
+ TransactionBuilderABI,
+} from "aptos";
+import {
+ MAINNET_BRIDGE_ABIS,
+ STAGING_BRIDGE_ABIS,
+ TESTNET_BRIDGE_ABIS,
+} from "./bridge_client_abis";
+
+interface BridgeData {
+ action_cnt: string;
+ burning_nfts: {
+ handle: string;
+ };
+ consumed_actions: {
+ handle: string;
+ };
+ group_key: string;
+ paused: boolean;
+ frozen_nfts: {
+ handle: string;
+ };
+ whitelist: {
+ handle: string;
+ };
+}
+
+export class BridgeClient {
+ private aptosClient: AptosClient;
+ private transactionBuilder: TransactionBuilderABI;
+ private address: string;
+
+ constructor(
+ aptosClient: AptosClient,
+ address: string,
+ network: "mainnet" | "staging" | "testnet"
+ ) {
+ this.aptosClient = aptosClient;
+ let abi;
+ switch (network) {
+ case "mainnet":
+ abi = MAINNET_BRIDGE_ABIS;
+ break;
+ case "staging":
+ abi = STAGING_BRIDGE_ABIS;
+ break;
+ case "testnet":
+ abi = TESTNET_BRIDGE_ABIS;
+ break;
+ default:
+ throw new Error("Invalid network");
+ }
+ this.transactionBuilder = new TransactionBuilderABI(
+ abi.map((abi) => new HexString(abi).toUint8Array())
+ );
+ this.address = address;
+ }
+
+ async initialize(
+ account: AptosAccount,
+ groupKey: Uint8Array
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::initialize`,
+ [],
+ [groupKey]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async pause(
+ account: AptosAccount,
+ actionId: number | bigint,
+ signature: Uint8Array
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::pause`,
+ [],
+ [actionId, signature]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async unpause(
+ account: AptosAccount,
+ actionId: number | bigint,
+ signature: Uint8Array
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::unpause`,
+ [],
+ [actionId, signature]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async validateWhitelist(
+ account: AptosAccount,
+ collectionCreator: HexString,
+ collectionName: string,
+ actionId: number | bigint,
+ signature: Uint8Array
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::validate_whitelist`,
+ [],
+ [collectionCreator.toString(), collectionName, actionId, signature]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async validateBlacklist(
+ account: AptosAccount,
+ collectionCreator: HexString,
+ collectionName: string,
+ actionId: number | bigint,
+ signature: Uint8Array
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::validate_blacklist`,
+ [],
+ [collectionCreator.toString(), collectionName, actionId, signature]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async validateWithdrawFees(
+ account: AptosAccount,
+ to: HexString,
+ actionId: number | bigint,
+ signature: Uint8Array
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::validate_withdraw_fees`,
+ [],
+ [to.toString(), actionId, signature]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async validateTransferNft(
+ account: AptosAccount,
+ collection: string,
+ name: string,
+ description: string,
+ maximum: number | bigint,
+ uri: string,
+ royaltyPayeeAddress: HexString,
+ royaltyPointsDenominator: number | bigint,
+ royaltyPointsNumerator: number | bigint,
+ mutateSetting: boolean[],
+ to: HexString,
+ actionId: number | bigint,
+ signature: Uint8Array
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::validate_transfer_nft`,
+ [],
+ [
+ collection,
+ name,
+ description,
+ maximum,
+ uri,
+ royaltyPayeeAddress.toString(),
+ royaltyPointsDenominator.toString(),
+ royaltyPointsNumerator.toString(),
+ mutateSetting,
+ to.toString(),
+ actionId,
+ signature,
+ ]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async withdrawNft(
+ account: AptosAccount,
+ _bridgeAdmin: HexString,
+ collectionCreator: HexString,
+ collectionName: string,
+ tokenName: string,
+ propertyVersion: string,
+ price: number | bigint,
+ chainNonce: number | bigint,
+ to: string,
+ mintWith: string
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::withdraw_nft`,
+ [],
+ [
+ collectionCreator.toString(),
+ collectionName,
+ tokenName,
+ propertyVersion,
+ price,
+ chainNonce,
+ to,
+ mintWith,
+ ]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async validateBurnNft(
+ account: AptosAccount,
+ collectionCreator: HexString,
+ collectionName: string,
+ tokenName: string,
+ propertyVersion: string,
+ actionId: number | bigint,
+ signature: Uint8Array
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::validate_burn_nft`,
+ [],
+ [
+ collectionCreator.toString(),
+ collectionName,
+ tokenName,
+ propertyVersion,
+ actionId,
+ signature,
+ ]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async freezeNft(
+ account: AptosAccount,
+ collectionCreator: HexString,
+ collectionName: string,
+ tokenName: string,
+ propertyVersion: number | bigint,
+ price: number | bigint,
+ chainNonce: number | bigint,
+ to: string,
+ mintWith: string
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::freeze_nft`,
+ [],
+ [
+ collectionCreator.toString(),
+ collectionName,
+ tokenName,
+ propertyVersion,
+ price,
+ chainNonce,
+ to,
+ mintWith,
+ ]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async validateUnfreezeNft(
+ account: AptosAccount,
+ collectionCreator: HexString,
+ collectionName: string,
+ tokenName: string,
+ propertyVersion: string,
+ to: HexString,
+ actionId: number | bigint,
+ signature: Uint8Array
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::validate_unfreeze_nft`,
+ [],
+ [
+ collectionCreator.toString(),
+ collectionName,
+ tokenName,
+ propertyVersion,
+ to.toString(),
+ actionId,
+ signature,
+ ]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async updateGroupKey(
+ account: AptosAccount,
+ groupKey: Uint8Array,
+ actionId: number | bigint,
+ signature: Uint8Array
+ ): Promise {
+ const payload = this.transactionBuilder.buildTransactionPayload(
+ `${this.getAddress()}::bridge::update_group_key`,
+ [],
+ [groupKey, actionId, signature]
+ );
+
+ return this.aptosClient.generateSignSubmitTransaction(account, payload);
+ }
+
+ async getBridgeData() {
+ const resources = await this.aptosClient.getAccountResources(
+ this.getAddress()
+ );
+ const accountResource = resources.find(
+ (r) => r.type == `${this.getAddress()}::bridge::Bridge`
+ );
+ return accountResource?.data as BridgeData;
+ }
+
+ getAddress() {
+ return this.address;
+ }
+
+ async isWhitelist(collectionCreator: MaybeHexString, collectionName: string) {
+ const data = await this.getBridgeData();
+ const { handle } = data.whitelist;
+ try {
+ const res = await this.aptosClient.getTableItem(handle, {
+ key_type: `${this.getAddress()}::bridge::CollectionId`,
+ value_type: "bool",
+ key: {
+ creator: collectionCreator.toString(),
+ name: collectionName,
+ },
+ });
+ return res;
+ } catch (e: any) {
+ return false;
+ }
+ }
+}
diff --git a/src/helpers/aptos/bridge_client_abis.ts b/src/helpers/aptos/bridge_client_abis.ts
new file mode 100644
index 000000000..b37ad3758
--- /dev/null
+++ b/src/helpers/aptos/bridge_client_abis.ts
@@ -0,0 +1,67 @@
+export const MAINNET_BRIDGE_ABIS = [
+ // ../build/aptos-bridge/abis/bridge/initialize.abi
+ "010a696e697469616c697a65f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d066272696467650000010967726f75705f6b65790601",
+ // ../build/aptos-bridge/abis/bridge/pause.abi
+ "01057061757365f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d0662726964676500000209616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/unpause.abi
+ "0107756e7061757365f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d0662726964676500000209616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/update_group_key.abi
+ "01107570646174655f67726f75705f6b6579f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d066272696467650000030d6e65775f67726f75705f6b6579060109616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/validate_whitelist.abi
+ "011276616c69646174655f77686974656c697374f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d0662726964676500000412636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670009616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/validate_blacklist.abi
+ "011276616c69646174655f626c61636b6c697374f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d0662726964676500000412636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670009616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/validate_withdraw_fees.abi
+ "011676616c69646174655f77697468647261775f66656573f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d0662726964676500000302746f0409616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/validate_tranfer_nft.abi
+ "011576616c69646174655f7472616e736665725f6e6674f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d0662726964676500000f0a636f6c6c656374696f6e07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700046e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000b6465736372697074696f6e07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700076d6178696d756d020375726907000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670015726f79616c74795f70617965655f61646472657373041a726f79616c74795f706f696e74735f64656e6f6d696e61746f720218726f79616c74795f706f696e74735f6e756d657261746f72020e6d75746174655f73657474696e6706000d70726f70657274795f6b6579730607000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000f70726f70657274795f76616c7565730606010e70726f70657274795f74797065730607000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670002746f0409616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/withdraw_nft.abi
+ "010c77697468647261775f6e6674f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d0662726964676500000812636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000a746f6b656e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e02057072696365020b636861696e5f6e6f6e63650202746f07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700096d696e745f7769746807000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700",
+ // ../build/aptos-bridge/abis/bridge/validate_burn_nft.abi
+ "011176616c69646174655f6275726e5f6e6674f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d0662726964676500000612636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000a746f6b656e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e0209616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/freeze_nft.abi
+ "010a667265657a655f6e6674f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d0662726964676500000812636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000a746f6b656e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e02057072696365020b636861696e5f6e6f6e63650202746f07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700096d696e745f7769746807000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700",
+ // ../build/aptos-bridge/abis/bridge/validate_unfreeze_nft.abi
+ "011576616c69646174655f756e667265657a655f6e6674f1528ec9c413e37f0ce63eb699fa6c7521b925ff4857b2c95e857e43078c916d0662726964676500000712636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000a746f6b656e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e0202746f0409616374696f6e5f696403097369676e61747572650601",
+];
+
+export const TESTNET_BRIDGE_ABIS = [
+ // ../build/aptos-bridge/abis/bridge/initialize.abi
+ "010a696e697469616c697a652b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d58066272696467650000010967726f75705f6b65790601",
+ // ../build/aptos-bridge/abis/bridge/pause.abi
+ "010570617573652b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d580662726964676500000209616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/unpause.abi
+ "0107756e70617573652b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d580662726964676500000209616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/update_group_key.abi
+ "01107570646174655f67726f75705f6b65792b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d58066272696467650000030d6e65775f67726f75705f6b6579060109616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/validate_whitelist.abi
+ "011276616c69646174655f77686974656c6973742b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d580662726964676500000412636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670009616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/validate_blacklist.abi
+ "011276616c69646174655f626c61636b6c6973742b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d580662726964676500000412636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670009616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/validate_withdraw_fees.abi
+ "011676616c69646174655f77697468647261775f666565732b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d580662726964676500000302746f0409616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/validate_tranfer_nft.abi
+ "011576616c69646174655f7472616e736665725f6e66742b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d580662726964676500000c0a636f6c6c656374696f6e07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700046e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000b6465736372697074696f6e07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700076d6178696d756d020375726907000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670015726f79616c74795f70617965655f61646472657373041a726f79616c74795f706f696e74735f64656e6f6d696e61746f720218726f79616c74795f706f696e74735f6e756d657261746f72020e6d75746174655f73657474696e67060002746f0409616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/withdraw_nft.abi
+ "010c77697468647261775f6e66742b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d580662726964676500000812636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000a746f6b656e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e02057072696365020b636861696e5f6e6f6e63650202746f07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700096d696e745f7769746807000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700",
+ // ../build/aptos-bridge/abis/bridge/freeze_nft.abi
+ "010a667265657a655f6e66742b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d580662726964676500000812636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000a746f6b656e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e02057072696365020b636861696e5f6e6f6e63650202746f07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700096d696e745f7769746807000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700",
+ // ../build/aptos-bridge/abis/bridge/validate_unfreeze_nft.abi
+ "011576616c69646174655f756e667265657a655f6e66742b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d580662726964676500000712636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000a746f6b656e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e0202746f0409616374696f6e5f696403097369676e61747572650601",
+ // ../build/aptos-bridge/abis/bridge/create_collection.abi
+ "01116372656174655f636f6c6c656374696f6e2b9c2009290f6a291df678bca9b03aa55f909cbdbbcc215d4868f5bd8e5a7d58066272696467650000050f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670016636f6c6c656374696f6e5f6465736372697074696f6e07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000e636f6c6c656374696f6e5f75726907000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700076d6178696d756d020e6d75746174655f73657474696e670600",
+];
+
+export const STAGING_BRIDGE_ABIS = [
+ "010a696e697469616c697a65813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec37066272696467650000010967726f75705f6b65790601",
+ "01057061757365813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec370662726964676500000209616374696f6e5f696403097369676e61747572650601",
+ "0107756e7061757365813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec370662726964676500000209616374696f6e5f696403097369676e61747572650601",
+ "01107570646174655f67726f75705f6b6579813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec37066272696467650000030d6e65775f67726f75705f6b6579060109616374696f6e5f696403097369676e61747572650601",
+ "011276616c69646174655f77686974656c697374813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec370662726964676500000412636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670009616374696f6e5f696403097369676e61747572650601",
+ "011276616c69646174655f626c61636b6c697374813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec370662726964676500000412636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670009616374696f6e5f696403097369676e61747572650601",
+ "011676616c69646174655f77697468647261775f66656573813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec370662726964676500000302746f0409616374696f6e5f696403097369676e61747572650601",
+ "011576616c69646174655f7472616e736665725f6e6674813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec370662726964676500000c0a636f6c6c656374696f6e07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700046e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000b6465736372697074696f6e07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700076d6178696d756d020375726907000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e670015726f79616c74795f70617965655f61646472657373041a726f79616c74795f706f696e74735f64656e6f6d696e61746f720218726f79616c74795f706f696e74735f6e756d657261746f72020e6d75746174655f73657474696e67060002746f0409616374696f6e5f696403097369676e61747572650601",
+ "010c77697468647261775f6e6674813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec370662726964676500000812636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000a746f6b656e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e02057072696365020b636861696e5f6e6f6e63650202746f07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700096d696e745f7769746807000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700",
+ "010a667265657a655f6e6674813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec370662726964676500000812636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000a746f6b656e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e02057072696365020b636861696e5f6e6f6e63650202746f07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700096d696e745f7769746807000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700",
+ "011576616c69646174655f756e667265657a655f6e6674813d070ca33bf08223e957257c25cb66072fa8960b0af4810c2e78990126ec370662726964676500000712636f6c6c656374696f6e5f63726561746f72040f636f6c6c656374696f6e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67000a746f6b656e5f6e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e0202746f0409616374696f6e5f696403097369676e61747572650601",
+];
diff --git a/src/helpers/aptos/index.ts b/src/helpers/aptos/index.ts
new file mode 100644
index 000000000..4f0d46c90
--- /dev/null
+++ b/src/helpers/aptos/index.ts
@@ -0,0 +1,233 @@
+import {
+ ChainNonceGet,
+ ClaimNFT,
+ EstimateTxFees,
+ FeeMargins,
+ GetFeeMargins,
+ GetProvider,
+ MintNft,
+ TransferNftForeign,
+ UnfreezeForeignNft,
+ ValidateAddress,
+ BalanceCheck,
+} from "../chain";
+
+import {
+ AptosAccount,
+ AptosClient,
+ HexString,
+ CoinClient,
+ TokenClient,
+} from "aptos";
+
+import { Chain } from "../../consts";
+import BigNumber from "bignumber.js";
+import { BridgeClient } from "./bridge_client";
+import { EvNotifier } from "../../notifier";
+
+export type AptosNFT = {
+ collection_creator: string;
+ collection_name: string;
+ token_name: string;
+ property_version: number;
+};
+
+/**
+ * @param collection name of the collection u already own. if u dont own any token, then set this as undefined
+ * @param name name of the NFT
+ * @param description description of the NFT
+ * @param uri The URI which the NFT points to
+ * @param createCollection set this as true if u set collection as undefined. it will create a new collection.
+ */
+export type AptosMintArgs = {
+ collection: string | undefined;
+ name: string;
+ description: string;
+ uri: string;
+ createCollection: boolean;
+};
+
+export type AptosClaimArgs = {
+ sender: HexString;
+ propertyVersion: number;
+ collectionName: string;
+ creator: string;
+ name: string;
+};
+
+export type AptosHelper = ChainNonceGet &
+ TransferNftForeign &
+ UnfreezeForeignNft &
+ EstimateTxFees &
+ ValidateAddress & {
+ XpNft: string;
+ } & GetFeeMargins &
+ MintNft &
+ GetProvider &
+ ClaimNFT &
+ BalanceCheck & {
+ setPetraSigner(signer: any): void;
+ };
+
+export type AptosParams = {
+ feeMargin: FeeMargins;
+ rpcUrl: string;
+ xpnft: string;
+ bridge: string;
+ notifier: EvNotifier;
+ network: "mainnet" | "staging" | "testnet";
+};
+
+export async function aptosHelper({
+ feeMargin,
+ rpcUrl,
+ xpnft,
+ bridge,
+ notifier,
+ network,
+}: AptosParams): Promise {
+ const client = new AptosClient(rpcUrl);
+
+ const bridgeClient = new BridgeClient(client, bridge, network);
+ const coinClient = new CoinClient(client);
+
+ return {
+ getNonce() {
+ return Chain.APTOS;
+ },
+ getFeeMargin() {
+ return feeMargin;
+ },
+ setPetraSigner(signer: any) {
+ //imposter
+ client.generateSignSubmitTransaction = async function (
+ _: AptosAccount,
+ payload: any
+ ) {
+ const trx = await signer.signAndSubmitTransaction(payload);
+ return trx.hash;
+ };
+ },
+ balance: async (address) => {
+ return new BigNumber((await coinClient.checkBalance(address)).toString());
+ },
+ async validateAddress(adr) {
+ try {
+ await client.getAccount(adr);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ },
+ XpNft: xpnft,
+
+ async estimateValidateTransferNft(_to, _metadata, _mintWith) {
+ return new BigNumber(0);
+ },
+ async estimateValidateUnfreezeNft(_to, _metadata, _mintWith) {
+ return new BigNumber(0);
+ },
+ async transferNftToForeign(
+ sender,
+ chain_nonce,
+ to,
+ id,
+ txFees,
+ mintWith,
+ _gasLimit?
+ ) {
+ const receipt = await bridgeClient.freezeNft(
+ sender,
+ HexString.ensure(id.native.collection_creator),
+ id.native.collection_name,
+ id.native.token_name,
+ id.native.property_version,
+ BigInt(txFees.toString()),
+ chain_nonce,
+ to,
+ mintWith
+ );
+ await new Promise((r) => setTimeout(r, 10000));
+ await notifier.notifyAptos(receipt);
+ return receipt;
+ },
+ getProvider() {
+ return client;
+ },
+ async mintNft(owner, options) {
+ //AptosAccount.fromAptosAccountObject({""})
+ const tc = new TokenClient(client);
+ if (options.createCollection) {
+ await tc.createCollection(
+ owner,
+ "UMT",
+ "UserNftMinter - Mint your NFTs Here To Test",
+ "https://example.com",
+ BigInt(2 ** 64) - BigInt(1)
+ );
+ const response = await tc.createToken(
+ owner,
+ "UMT",
+ options.name,
+ options.description,
+ 1,
+ options.uri,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined
+ );
+ return response;
+ } else {
+ const response = await tc.createToken(
+ owner,
+ options.collection!,
+ options.name,
+ options.description,
+ 1,
+ options.uri,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ undefined
+ );
+ return response;
+ }
+ },
+ async claimNFT(signer, params) {
+ const tokenClient = new TokenClient(client);
+ const claim = await tokenClient.claimToken(
+ signer,
+ params.sender,
+ params.creator,
+ params.collectionName,
+ params.name,
+ params.propertyVersion
+ );
+ return claim;
+ },
+ async unfreezeWrappedNft(sender, to, id, txFees, nonce) {
+ const receipt = await bridgeClient.withdrawNft(
+ sender,
+ HexString.ensure(bridge),
+ HexString.ensure(id.native.collection_creator),
+ id.native.collection_name,
+ id.native.token_name,
+ id.native.property_version.toString(),
+ BigInt(txFees.toString()),
+ parseInt(nonce),
+ to,
+ id.native.collection_creator
+ );
+ await new Promise((r) => setTimeout(r, 10000));
+ await notifier.notifyAptos(receipt);
+ return receipt;
+ },
+ };
+}
diff --git a/src/helpers/bridge_pool.teal.ts b/src/helpers/bridge_pool.teal.ts
new file mode 100644
index 000000000..2988ce9df
--- /dev/null
+++ b/src/helpers/bridge_pool.teal.ts
@@ -0,0 +1,65 @@
+export const BRIDGE_TEAL = `#pragma version 5
+intcblock 1 6 3
+bytecblock TMPL_RECV_ADDR
+txn TypeEnum
+pushint 4 // axfer
+==
+txn AssetAmount
+intc_0 // 1
+==
+&&
+txn AssetReceiver
+bytec_0 // TMPL_RECV_ADDR
+==
+&&
+bnz main_l6
+gtxn 0 TypeEnum
+intc_1 // appl
+==
+gtxna 0 ApplicationArgs 0
+pushbytes 0x6372656174655f6e6674 // "create_nft"
+==
+&&
+gtxna 0 Accounts 1
+bytec_0 // TMPL_RECV_ADDR
+==
+&&
+gtxn 1 TypeEnum
+intc_2 // acfg
+==
+&&
+gtxn 1 ConfigAssetTotal
+intc_0 // 1
+==
+&&
+gtxn 1 ConfigAssetDecimals
+pushint 0 // 0
+==
+&&
+bnz main_l5
+gtxn 0 TypeEnum
+intc_1 // appl
+==
+gtxna 0 ApplicationArgs 0
+pushbytes 0x77697468647261775f6e6674 // "withdraw_nft"
+==
+&&
+gtxn 1 TypeEnum
+intc_2 // acfg
+==
+&&
+gtxn 1 ConfigAsset
+gtxna 0 Assets 0
+==
+&&
+bnz main_l4
+err
+main_l4:
+intc_0 // 1
+return
+main_l5:
+intc_0 // 1
+return
+main_l6:
+intc_0 // 1
+return`;
diff --git a/src/helpers/chain.ts b/src/helpers/chain.ts
index 99608989f..2f2b95306 100644
--- a/src/helpers/chain.ts
+++ b/src/helpers/chain.ts
@@ -1,150 +1,216 @@
+import axios from "axios";
+import BigNumber from "bignumber.js";
+import { ethers } from "ethers";
+import { ChainNonce } from "../type-utils";
+
/**
- * Transfer Liquidity to a foregin chain, freezing the original liquidity
- *
- * @param sender Account which owns the liquidity on the native chain, able to sign transactions
- * @param chain_nonce Nonce of the target chain
- * @param to Address of the receiver on the foreign chain
- * @param value Amount of liquidity to send
- *
- * @returns Transaction and the Identifier of this action to track the status
+ * NFT Info
*/
-export interface TransferForeign {
- transferNativeToForeign(
- sender: Signer,
- chain_nonce: number,
- to: ForeignAddr,
- value: Balance
- ): Promise<[Tx, EventIdent]>;
-}
+export type NftInfo = {
+ readonly uri: string;
+ readonly native: Raw;
+ readonly collectionIdent: string;
+ readonly tokenId?: any;
+ readonly originChain?: any;
+};
/**
- * Unfreeze native liquidity existing on a foreign chain(Send back Liquidity)
- *
- * @param sender Account which owns the wrapped liquidity on this chain, able to sign transactions
- * @param chain_nonce Nonce of the original chain
- * @param to Address of the receiver on the original chain
- * @param value Amount of liquidity to unfreeze
- *
- * @returns Transaction and the Identifier of this action to track the status
+ * Action to perform before transfer/unfreeze (if any)
*/
-export interface UnfreezeForeign {
- unfreezeWrapped(sender: Signer, chain_nonce: number, to: ForeignAddr, value: Balance): Promise<[Tx, EventIdent]>;
+export interface PreTransfer {
+ preTransfer(
+ sender: Signer,
+ nft: NftInfo,
+ fee: BigNumber,
+ args?: ExtraArgs
+ ): Promise;
+ preUnfreeze(
+ sender: Signer,
+ nft: NftInfo,
+ fee: BigNumber,
+ args?: ExtraArgs
+ ): Promise;
}
/**
* Transfer NFT to a foreign chain, freezing the original one
- *
+ *
* @param sender Account which owns the NFT on the native chain, able to sign transactions
* @param chain_nonce Nonce of the target chain
* @param to Address of the receiver on the foreign chain
* @param id Information required to freeze this nft
- *
+ *
* @returns Transaction and the Identifier of this action to track the status
*/
-export interface TransferNftForeign {
+export interface TransferNftForeign {
transferNftToForeign(
sender: Signer,
chain_nonce: number,
- to: ForeignAddr,
- id: NftIdent
- ): Promise<[Tx, EventIdent]>;
+ to: string,
+ id: NftInfo,
+ txFees: BigNumber,
+ mintWith: string,
+ gasLimit?: ethers.BigNumberish | undefined,
+ gasPrice?: ethers.BigNumberish | undefined
+ ): Promise;
}
/**
* Unfreeze native NFT existing on a foreign chain(Send back NFT)
* chain_nonce is automatically derived
- *
+ *
* @param sender Account which owns the wrapped NFT on this chain, able to sign transactions
* @param to Address of the receiver on the original chain
* @param id Information required to unfreeze this nft
- *
+ *
* @returns Transaction and the Identifier of this action to track the status
*/
-export interface UnfreezeForeignNft {
+export interface UnfreezeForeignNft {
unfreezeWrappedNft(
sender: Signer,
- to: ForeignAddr,
- id: NftIdent
- ): Promise<[Tx, EventIdent]>;
+ to: string,
+ id: NftInfo,
+ txFees: BigNumber,
+ nonce: string,
+ gasLimit: ethers.BigNumberish | undefined,
+ gasPrice: ethers.BigNumberish | undefined
+ ): Promise;
}
/**
* Get the balance of an address on the chain
*/
-export interface BalanceCheck {
- balance(
- address: Addr
- ): Promise;
+export interface BalanceCheck {
+ balance(address: string): Promise;
}
/**
- * Get the balance of a foreign token for an account in this chain
+ * Create a new NFT on this chain
*
- * @param address Address of the user
- * @param chain_nonce nonce of the foreign chain
+ * @param options Arguments required to mint the nft
*/
-export interface WrappedBalanceCheck {
- balanceWrapped(
- address: Addr,
- chain_nonce: number
- ): Promise;
+export interface MintNft {
+ mintNft(owner: Signer, options: Args): Promise