bridge_ui: terra2 support
Co-authored-by: Kevin Peters <kpeters@jumptrading.com>
This commit is contained in:
parent
3dc0bac63f
commit
ba42ac7e4b
|
@ -8,7 +8,7 @@
|
|||
"name": "test_ui",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "^0.3.8",
|
||||
"@certusone/wormhole-sdk": "^0.4.2",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
|
@ -23,7 +23,7 @@
|
|||
"@solana/wallet-adapter-react-ui": "^0.9.5",
|
||||
"@solana/wallet-adapter-wallets": "^0.16.1",
|
||||
"@solana/web3.js": "^1.35.1",
|
||||
"@terra-money/wallet-provider": "^3.8.0",
|
||||
"@terra-money/wallet-provider": "^3.9.4",
|
||||
"@walletconnect/web3-provider": "^1.7.8",
|
||||
"algosdk": "^1.15.0",
|
||||
"axios": "^0.21.1",
|
||||
|
@ -87,14 +87,14 @@
|
|||
},
|
||||
"../sdk/js": {
|
||||
"name": "@certusone/wormhole-sdk",
|
||||
"version": "0.3.7",
|
||||
"version": "0.3.8",
|
||||
"extraneous": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@improbable-eng/grpc-web": "^0.14.0",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
"@solana/web3.js": "^1.24.0",
|
||||
"@terra-money/terra.js": "^3.0.7",
|
||||
"@terra-money/terra.js": "^3.1.3",
|
||||
"algosdk": "^1.15.0",
|
||||
"axios": "^0.24.0",
|
||||
"bech32": "^2.0.0",
|
||||
|
@ -111,7 +111,7 @@
|
|||
"@types/node": "^16.6.1",
|
||||
"@types/react": "^17.0.19",
|
||||
"copy-dir": "^1.3.0",
|
||||
"ethers": "^5.4.4",
|
||||
"ethers": "^5.6.8",
|
||||
"jest": "^27.3.1",
|
||||
"prettier": "^2.3.2",
|
||||
"ts-jest": "^27.0.7",
|
||||
|
@ -2132,14 +2132,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@certusone/wormhole-sdk": {
|
||||
"version": "0.3.8",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.3.8.tgz",
|
||||
"integrity": "sha512-XHWKRqYo+Euj8DNWPLM3j5cXAqVkp4QtmpYqheLqO3hQLIc5MvyHZfXHxfAq0gmrdQT89xP5Dq8Q3uLGtq07QQ==",
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.4.2.tgz",
|
||||
"integrity": "sha512-2OQOq6Rb9VZ4bKT3LIQfayO5p3Z/EMrvUl58dpMv6DIJH/QbgWeCM24Of9f6nJ7Tky/UTCEJzKI2oAAbDyLN0A==",
|
||||
"dependencies": {
|
||||
"@improbable-eng/grpc-web": "^0.14.0",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
"@solana/web3.js": "^1.24.0",
|
||||
"@terra-money/terra.js": "^3.0.7",
|
||||
"@terra-money/terra.js": "^3.1.3",
|
||||
"algosdk": "^1.15.0",
|
||||
"axios": "^0.24.0",
|
||||
"bech32": "^2.0.0",
|
||||
|
@ -6771,13 +6771,25 @@
|
|||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/terra.js": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/terra.js/-/terra.js-3.0.7.tgz",
|
||||
"integrity": "sha512-moeVBWqIPZaV0HmCY127Y9H/MsuFtH1VgW0xEvDQWqu1jpKhK5CtPHMLKNje3mKSjU8A7vXZ8hlW3KobqP2poQ==",
|
||||
"node_modules/@terra-money/legacy.proto": {
|
||||
"name": "@terra-money/terra.proto",
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-0.1.7.tgz",
|
||||
"integrity": "sha512-NXD7f6pQCulvo6+mv6MAPzhOkUzRjgYVuHZE/apih+lVnPG5hDBU0rRYnOGGofwvKT5/jQoOENnFn/gioWWnyQ==",
|
||||
"dependencies": {
|
||||
"@terra-money/terra.proto": "^0.1.7",
|
||||
"axios": "^0.24.0",
|
||||
"google-protobuf": "^3.17.3",
|
||||
"long": "^4.0.0",
|
||||
"protobufjs": "~6.11.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/terra.js": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/terra.js/-/terra.js-3.1.3.tgz",
|
||||
"integrity": "sha512-80HU5WXrqf3hZTo2GRhIycH17A+SkLD6afbu8MynMDGGD/A861F3zVv6NQ/Z7PWQGHxgddZEK/A0UQ2uK/xfHg==",
|
||||
"dependencies": {
|
||||
"@terra-money/legacy.proto": "npm:@terra-money/terra.proto@^0.1.7",
|
||||
"@terra-money/terra.proto": "~2.0.0",
|
||||
"axios": "^0.26.1",
|
||||
"bech32": "^2.0.0",
|
||||
"bip32": "^2.0.6",
|
||||
"bip39": "^3.0.3",
|
||||
|
@ -6795,11 +6807,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@terra-money/terra.js/node_modules/axios": {
|
||||
"version": "0.24.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
|
||||
"integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
|
||||
"version": "0.26.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
||||
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.14.4"
|
||||
"follow-redirects": "^1.14.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/terra.js/node_modules/bech32": {
|
||||
|
@ -6808,53 +6820,49 @@
|
|||
"integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg=="
|
||||
},
|
||||
"node_modules/@terra-money/terra.proto": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-0.1.7.tgz",
|
||||
"integrity": "sha512-NXD7f6pQCulvo6+mv6MAPzhOkUzRjgYVuHZE/apih+lVnPG5hDBU0rRYnOGGofwvKT5/jQoOENnFn/gioWWnyQ==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-2.0.0.tgz",
|
||||
"integrity": "sha512-ZjyFOFUzrGn8IwzGIgr1OJFcPSsQoz/XAfoSKThJx+OjJA7CLhdcz51+5h7ehNfb+qB9wr7aNME0h24wu9D4SQ==",
|
||||
"dependencies": {
|
||||
"@improbable-eng/grpc-web": "^0.14.1",
|
||||
"google-protobuf": "^3.17.3",
|
||||
"long": "^4.0.0",
|
||||
"protobufjs": "~6.11.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/wallet-provider": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-provider/-/wallet-provider-3.8.0.tgz",
|
||||
"integrity": "sha512-QE2jFiUDMlJnBUC9kJq+djOt/5n9vhv4Ou1zF4JNJ9606DpzjDkzlwS2qH/hPqYPrAvDqdkd/KKBF6qRNwrn9A==",
|
||||
"node_modules/@terra-money/terra.proto/node_modules/@improbable-eng/grpc-web": {
|
||||
"version": "0.14.1",
|
||||
"resolved": "https://registry.npmjs.org/@improbable-eng/grpc-web/-/grpc-web-0.14.1.tgz",
|
||||
"integrity": "sha512-XaIYuunepPxoiGVLLHmlnVminUGzBTnXr8Wv7khzmLWbNw4TCwJKX09GSMJlKhu/TRk6gms0ySFxewaETSBqgw==",
|
||||
"dependencies": {
|
||||
"@terra-money/use-wallet": "^3.8.0",
|
||||
"@terra-money/wallet-controller": "^3.8.0",
|
||||
"@terra-money/web-extension-interface": "^3.8.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"browser-headers": "^0.4.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=17.0.0"
|
||||
"google-protobuf": "^3.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/wallet-provider/node_modules/@terra-money/use-wallet": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/use-wallet/-/use-wallet-3.8.0.tgz",
|
||||
"integrity": "sha512-+wVcO7AZab6MYMnz9eakPmeEDeUFwMlKw81DZ0Iej/snkSiw6hiJsJOGQGlMHVvlOZUPzF7tr1KYS3jj+gCaxQ==",
|
||||
"node_modules/@terra-money/use-wallet": {
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/use-wallet/-/use-wallet-3.9.4.tgz",
|
||||
"integrity": "sha512-4j4nUEUut5jSxZVFpIbiorvo/5IpytERZhI6/AB0I2mQ5gh8uPWeLakgTMQxlHRUPrRB+NbABbQkCinqvSiSEA==",
|
||||
"dependencies": {
|
||||
"@terra-money/wallet-types": "^3.8.0"
|
||||
"@terra-money/wallet-types": "^3.9.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@terra-money/terra.js": "^3.0.0",
|
||||
"react": ">=17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/wallet-provider/node_modules/@terra-money/wallet-controller": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-controller/-/wallet-controller-3.8.0.tgz",
|
||||
"integrity": "sha512-ofnmDN6ml94UfCIXQJID8kPskQMSI+e7greg9Fo5fNlI3hOs/XcFgIZeloW7xs5l1dbm1F5LGSszuZ2wsQPy7w==",
|
||||
"node_modules/@terra-money/wallet-controller": {
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-controller/-/wallet-controller-3.9.4.tgz",
|
||||
"integrity": "sha512-mHoIQTXYla6uDivnMQzmQUeajpJt7jbXAyj1lWoAs94xSw10QlYWTgXkrHd23rY9NkDdpFfIf7IctdsCG1XZYQ==",
|
||||
"dependencies": {
|
||||
"@terra-money/wallet-types": "^3.8.0",
|
||||
"@terra-money/web-extension-interface": "^3.8.0",
|
||||
"@terra-money/wallet-types": "^3.9.4",
|
||||
"@terra-money/web-extension-interface": "^3.9.4",
|
||||
"@walletconnect/core": "^1.6.6",
|
||||
"@walletconnect/iso-crypto": "^1.6.6",
|
||||
"@walletconnect/types": "^1.6.6",
|
||||
|
@ -6869,41 +6877,65 @@
|
|||
"ws": "^7.5.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@terra-money/terra.js": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/wallet-provider/node_modules/@terra-money/wallet-types": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-types/-/wallet-types-3.8.0.tgz",
|
||||
"integrity": "sha512-ed4AfkiPawfRVZGJW3bb3PuBUUIiNZpAmuQACjPpHTZhHw8CmIdhpMk4zfN13YWyfNpRY7XmzTTWyAyapD8jnw==",
|
||||
"node_modules/@terra-money/wallet-controller/node_modules/rxjs": {
|
||||
"version": "7.5.5",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.5.tgz",
|
||||
"integrity": "sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/wallet-provider": {
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-provider/-/wallet-provider-3.9.4.tgz",
|
||||
"integrity": "sha512-46dNmoXC/UE6rsUPeY7+4iAI5z84xIYaV32rixzvrHmeCXEqAyrKmlV/9/8zmaXPTxN44/A1FCY1ADCQfM9BLg==",
|
||||
"dependencies": {
|
||||
"@terra-money/use-wallet": "^3.9.4",
|
||||
"@terra-money/wallet-controller": "^3.9.4",
|
||||
"@terra-money/web-extension-interface": "^3.9.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/wallet-types": {
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-types/-/wallet-types-3.9.4.tgz",
|
||||
"integrity": "sha512-8CYAMh+Lgj6y8rCTAsgmRnhL+hm6cXXkgvw0ijD/A/y4PiLwllflxvQrN//brxHBboF78E9OeihWDy3kPK72wg==",
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@terra-money/terra.js": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/wallet-provider/node_modules/@terra-money/web-extension-interface": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/web-extension-interface/-/web-extension-interface-3.8.0.tgz",
|
||||
"integrity": "sha512-JgIjXnlCUJVEjSLCry+fd81OE7k0dXlNjGdWkQUSn3bbL2/ZwXMVybGEpZRYuWIW8FIaLLGZBOT/FQO37pln7Q==",
|
||||
"node_modules/@terra-money/web-extension-interface": {
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/web-extension-interface/-/web-extension-interface-3.9.4.tgz",
|
||||
"integrity": "sha512-a2XfYQ2y5UwbHSAHTJRryUrZzOtHimb1JESfUGuNMbZq8KEu6qP0wGfrbx2jte0Ql8qee9pt5Sah/85zvvAVtg==",
|
||||
"dependencies": {
|
||||
"rxjs": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@terra-money/terra.js": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@terra-money/wallet-provider/node_modules/rxjs": {
|
||||
"version": "7.5.4",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.4.tgz",
|
||||
"integrity": "sha512-h5M3Hk78r6wAheJF0a5YahB1yRQKCsZ4MsGdZ5O9ETbVtjPcScGfrMmoOq7EBsCRzd4BDkvDJ7ogP8Sz5tTFiQ==",
|
||||
"node_modules/@terra-money/web-extension-interface/node_modules/rxjs": {
|
||||
"version": "7.5.5",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.5.tgz",
|
||||
"integrity": "sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
|
@ -19558,9 +19590,9 @@
|
|||
"integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg=="
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.14.4",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz",
|
||||
"integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==",
|
||||
"version": "1.15.1",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz",
|
||||
"integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
|
@ -27416,9 +27448,9 @@
|
|||
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
|
||||
},
|
||||
"node_modules/jscrypto": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/jscrypto/-/jscrypto-1.0.2.tgz",
|
||||
"integrity": "sha512-r+oNJLGTv1nkNMBBq3c70xYrFDgJOYVgs2OHijz5Ht+0KJ0yObD0oYxC9mN72KLzVfXw+osspg6t27IZvuTUxw==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/jscrypto/-/jscrypto-1.0.3.tgz",
|
||||
"integrity": "sha512-lryZl0flhodv4SZHOqyb1bx5sKcJxj0VBo0Kzb4QMAg3L021IC9uGpl0RCZa+9KJwlRGSK2C80ITcwbe19OKLQ==",
|
||||
"bin": {
|
||||
"jscrypto": "bin/cli.js"
|
||||
}
|
||||
|
@ -46733,14 +46765,14 @@
|
|||
}
|
||||
},
|
||||
"@certusone/wormhole-sdk": {
|
||||
"version": "0.3.8",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.3.8.tgz",
|
||||
"integrity": "sha512-XHWKRqYo+Euj8DNWPLM3j5cXAqVkp4QtmpYqheLqO3hQLIc5MvyHZfXHxfAq0gmrdQT89xP5Dq8Q3uLGtq07QQ==",
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.4.2.tgz",
|
||||
"integrity": "sha512-2OQOq6Rb9VZ4bKT3LIQfayO5p3Z/EMrvUl58dpMv6DIJH/QbgWeCM24Of9f6nJ7Tky/UTCEJzKI2oAAbDyLN0A==",
|
||||
"requires": {
|
||||
"@improbable-eng/grpc-web": "^0.14.0",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
"@solana/web3.js": "^1.24.0",
|
||||
"@terra-money/terra.js": "^3.0.7",
|
||||
"@terra-money/terra.js": "^3.1.3",
|
||||
"algosdk": "^1.15.0",
|
||||
"axios": "^0.24.0",
|
||||
"bech32": "^2.0.0",
|
||||
|
@ -50305,13 +50337,24 @@
|
|||
"defer-to-connect": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"@terra-money/terra.js": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/terra.js/-/terra.js-3.0.7.tgz",
|
||||
"integrity": "sha512-moeVBWqIPZaV0HmCY127Y9H/MsuFtH1VgW0xEvDQWqu1jpKhK5CtPHMLKNje3mKSjU8A7vXZ8hlW3KobqP2poQ==",
|
||||
"@terra-money/legacy.proto": {
|
||||
"version": "npm:@terra-money/terra.proto@0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-0.1.7.tgz",
|
||||
"integrity": "sha512-NXD7f6pQCulvo6+mv6MAPzhOkUzRjgYVuHZE/apih+lVnPG5hDBU0rRYnOGGofwvKT5/jQoOENnFn/gioWWnyQ==",
|
||||
"requires": {
|
||||
"@terra-money/terra.proto": "^0.1.7",
|
||||
"axios": "^0.24.0",
|
||||
"google-protobuf": "^3.17.3",
|
||||
"long": "^4.0.0",
|
||||
"protobufjs": "~6.11.2"
|
||||
}
|
||||
},
|
||||
"@terra-money/terra.js": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/terra.js/-/terra.js-3.1.3.tgz",
|
||||
"integrity": "sha512-80HU5WXrqf3hZTo2GRhIycH17A+SkLD6afbu8MynMDGGD/A861F3zVv6NQ/Z7PWQGHxgddZEK/A0UQ2uK/xfHg==",
|
||||
"requires": {
|
||||
"@terra-money/legacy.proto": "npm:@terra-money/terra.proto@^0.1.7",
|
||||
"@terra-money/terra.proto": "~2.0.0",
|
||||
"axios": "^0.26.1",
|
||||
"bech32": "^2.0.0",
|
||||
"bip32": "^2.0.6",
|
||||
"bip39": "^3.0.3",
|
||||
|
@ -50326,11 +50369,11 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"axios": {
|
||||
"version": "0.24.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
|
||||
"integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
|
||||
"version": "0.26.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
||||
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.14.4"
|
||||
"follow-redirects": "^1.14.8"
|
||||
}
|
||||
},
|
||||
"bech32": {
|
||||
|
@ -50341,72 +50384,93 @@
|
|||
}
|
||||
},
|
||||
"@terra-money/terra.proto": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-0.1.7.tgz",
|
||||
"integrity": "sha512-NXD7f6pQCulvo6+mv6MAPzhOkUzRjgYVuHZE/apih+lVnPG5hDBU0rRYnOGGofwvKT5/jQoOENnFn/gioWWnyQ==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-2.0.0.tgz",
|
||||
"integrity": "sha512-ZjyFOFUzrGn8IwzGIgr1OJFcPSsQoz/XAfoSKThJx+OjJA7CLhdcz51+5h7ehNfb+qB9wr7aNME0h24wu9D4SQ==",
|
||||
"requires": {
|
||||
"@improbable-eng/grpc-web": "^0.14.1",
|
||||
"google-protobuf": "^3.17.3",
|
||||
"long": "^4.0.0",
|
||||
"protobufjs": "~6.11.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@improbable-eng/grpc-web": {
|
||||
"version": "0.14.1",
|
||||
"resolved": "https://registry.npmjs.org/@improbable-eng/grpc-web/-/grpc-web-0.14.1.tgz",
|
||||
"integrity": "sha512-XaIYuunepPxoiGVLLHmlnVminUGzBTnXr8Wv7khzmLWbNw4TCwJKX09GSMJlKhu/TRk6gms0ySFxewaETSBqgw==",
|
||||
"requires": {
|
||||
"browser-headers": "^0.4.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@terra-money/use-wallet": {
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/use-wallet/-/use-wallet-3.9.4.tgz",
|
||||
"integrity": "sha512-4j4nUEUut5jSxZVFpIbiorvo/5IpytERZhI6/AB0I2mQ5gh8uPWeLakgTMQxlHRUPrRB+NbABbQkCinqvSiSEA==",
|
||||
"requires": {
|
||||
"@terra-money/wallet-types": "^3.9.4"
|
||||
}
|
||||
},
|
||||
"@terra-money/wallet-controller": {
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-controller/-/wallet-controller-3.9.4.tgz",
|
||||
"integrity": "sha512-mHoIQTXYla6uDivnMQzmQUeajpJt7jbXAyj1lWoAs94xSw10QlYWTgXkrHd23rY9NkDdpFfIf7IctdsCG1XZYQ==",
|
||||
"requires": {
|
||||
"@terra-money/wallet-types": "^3.9.4",
|
||||
"@terra-money/web-extension-interface": "^3.9.4",
|
||||
"@walletconnect/core": "^1.6.6",
|
||||
"@walletconnect/iso-crypto": "^1.6.6",
|
||||
"@walletconnect/types": "^1.6.6",
|
||||
"@walletconnect/utils": "^1.6.6",
|
||||
"bowser": "^2.11.0",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"jscrypto": "^1.0.0",
|
||||
"mobile-detect": "^1.4.5",
|
||||
"qrcode": "^1.5.0",
|
||||
"rxjs": "^7.0.0",
|
||||
"secp256k1": "^4.0.0",
|
||||
"ws": "^7.5.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"rxjs": {
|
||||
"version": "7.5.5",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.5.tgz",
|
||||
"integrity": "sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==",
|
||||
"requires": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@terra-money/wallet-provider": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-provider/-/wallet-provider-3.8.0.tgz",
|
||||
"integrity": "sha512-QE2jFiUDMlJnBUC9kJq+djOt/5n9vhv4Ou1zF4JNJ9606DpzjDkzlwS2qH/hPqYPrAvDqdkd/KKBF6qRNwrn9A==",
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-provider/-/wallet-provider-3.9.4.tgz",
|
||||
"integrity": "sha512-46dNmoXC/UE6rsUPeY7+4iAI5z84xIYaV32rixzvrHmeCXEqAyrKmlV/9/8zmaXPTxN44/A1FCY1ADCQfM9BLg==",
|
||||
"requires": {
|
||||
"@terra-money/use-wallet": "^3.8.0",
|
||||
"@terra-money/wallet-controller": "^3.8.0",
|
||||
"@terra-money/web-extension-interface": "^3.8.0"
|
||||
"@terra-money/use-wallet": "^3.9.4",
|
||||
"@terra-money/wallet-controller": "^3.9.4",
|
||||
"@terra-money/web-extension-interface": "^3.9.4"
|
||||
}
|
||||
},
|
||||
"@terra-money/wallet-types": {
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-types/-/wallet-types-3.9.4.tgz",
|
||||
"integrity": "sha512-8CYAMh+Lgj6y8rCTAsgmRnhL+hm6cXXkgvw0ijD/A/y4PiLwllflxvQrN//brxHBboF78E9OeihWDy3kPK72wg==",
|
||||
"requires": {}
|
||||
},
|
||||
"@terra-money/web-extension-interface": {
|
||||
"version": "3.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/web-extension-interface/-/web-extension-interface-3.9.4.tgz",
|
||||
"integrity": "sha512-a2XfYQ2y5UwbHSAHTJRryUrZzOtHimb1JESfUGuNMbZq8KEu6qP0wGfrbx2jte0Ql8qee9pt5Sah/85zvvAVtg==",
|
||||
"requires": {
|
||||
"rxjs": "^7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@terra-money/use-wallet": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/use-wallet/-/use-wallet-3.8.0.tgz",
|
||||
"integrity": "sha512-+wVcO7AZab6MYMnz9eakPmeEDeUFwMlKw81DZ0Iej/snkSiw6hiJsJOGQGlMHVvlOZUPzF7tr1KYS3jj+gCaxQ==",
|
||||
"requires": {
|
||||
"@terra-money/wallet-types": "^3.8.0"
|
||||
}
|
||||
},
|
||||
"@terra-money/wallet-controller": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-controller/-/wallet-controller-3.8.0.tgz",
|
||||
"integrity": "sha512-ofnmDN6ml94UfCIXQJID8kPskQMSI+e7greg9Fo5fNlI3hOs/XcFgIZeloW7xs5l1dbm1F5LGSszuZ2wsQPy7w==",
|
||||
"requires": {
|
||||
"@terra-money/wallet-types": "^3.8.0",
|
||||
"@terra-money/web-extension-interface": "^3.8.0",
|
||||
"@walletconnect/core": "^1.6.6",
|
||||
"@walletconnect/iso-crypto": "^1.6.6",
|
||||
"@walletconnect/types": "^1.6.6",
|
||||
"@walletconnect/utils": "^1.6.6",
|
||||
"bowser": "^2.11.0",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"jscrypto": "^1.0.0",
|
||||
"mobile-detect": "^1.4.5",
|
||||
"qrcode": "^1.5.0",
|
||||
"rxjs": "^7.0.0",
|
||||
"secp256k1": "^4.0.0",
|
||||
"ws": "^7.5.5"
|
||||
}
|
||||
},
|
||||
"@terra-money/wallet-types": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/wallet-types/-/wallet-types-3.8.0.tgz",
|
||||
"integrity": "sha512-ed4AfkiPawfRVZGJW3bb3PuBUUIiNZpAmuQACjPpHTZhHw8CmIdhpMk4zfN13YWyfNpRY7XmzTTWyAyapD8jnw==",
|
||||
"requires": {}
|
||||
},
|
||||
"@terra-money/web-extension-interface": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@terra-money/web-extension-interface/-/web-extension-interface-3.8.0.tgz",
|
||||
"integrity": "sha512-JgIjXnlCUJVEjSLCry+fd81OE7k0dXlNjGdWkQUSn3bbL2/ZwXMVybGEpZRYuWIW8FIaLLGZBOT/FQO37pln7Q==",
|
||||
"requires": {
|
||||
"rxjs": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"rxjs": {
|
||||
"version": "7.5.4",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.4.tgz",
|
||||
"integrity": "sha512-h5M3Hk78r6wAheJF0a5YahB1yRQKCsZ4MsGdZ5O9ETbVtjPcScGfrMmoOq7EBsCRzd4BDkvDJ7ogP8Sz5tTFiQ==",
|
||||
"version": "7.5.5",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.5.tgz",
|
||||
"integrity": "sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==",
|
||||
"requires": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
|
@ -61118,9 +61182,9 @@
|
|||
"integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg=="
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.14.4",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz",
|
||||
"integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g=="
|
||||
"version": "1.15.1",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz",
|
||||
"integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA=="
|
||||
},
|
||||
"for-in": {
|
||||
"version": "1.0.2",
|
||||
|
@ -67217,9 +67281,9 @@
|
|||
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
|
||||
},
|
||||
"jscrypto": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/jscrypto/-/jscrypto-1.0.2.tgz",
|
||||
"integrity": "sha512-r+oNJLGTv1nkNMBBq3c70xYrFDgJOYVgs2OHijz5Ht+0KJ0yObD0oYxC9mN72KLzVfXw+osspg6t27IZvuTUxw=="
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/jscrypto/-/jscrypto-1.0.3.tgz",
|
||||
"integrity": "sha512-lryZl0flhodv4SZHOqyb1bx5sKcJxj0VBo0Kzb4QMAg3L021IC9uGpl0RCZa+9KJwlRGSK2C80ITcwbe19OKLQ=="
|
||||
},
|
||||
"jsdom": {
|
||||
"version": "16.7.0",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "^0.3.8",
|
||||
"@certusone/wormhole-sdk": "^0.4.2",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
|
@ -18,7 +18,7 @@
|
|||
"@solana/wallet-adapter-react-ui": "^0.9.5",
|
||||
"@solana/wallet-adapter-wallets": "^0.16.1",
|
||||
"@solana/web3.js": "^1.35.1",
|
||||
"@terra-money/wallet-provider": "^3.8.0",
|
||||
"@terra-money/wallet-provider": "^3.9.4",
|
||||
"@walletconnect/web3-provider": "^1.7.8",
|
||||
"algosdk": "^1.15.0",
|
||||
"axios": "^0.21.1",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CHAIN_ID_TERRA } from "@certusone/wormhole-sdk";
|
||||
import { isTerraChain } from "@certusone/wormhole-sdk";
|
||||
import { CircularProgress, makeStyles } from "@material-ui/core";
|
||||
import { useSelector } from "react-redux";
|
||||
import useFetchForeignAsset from "../../hooks/useFetchForeignAsset";
|
||||
|
@ -45,8 +45,8 @@ function Create() {
|
|||
return (
|
||||
<>
|
||||
<KeyAndBalance chainId={targetChain} />
|
||||
{targetChain === CHAIN_ID_TERRA && (
|
||||
<TerraFeeDenomPicker disabled={disabled} />
|
||||
{isTerraChain(targetChain) && (
|
||||
<TerraFeeDenomPicker disabled={disabled} chainId={targetChain} />
|
||||
)}
|
||||
{foreignAssetInfo.isFetching ? (
|
||||
<>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CHAIN_ID_SOLANA, CHAIN_ID_TERRA } from "@certusone/wormhole-sdk";
|
||||
import { CHAIN_ID_SOLANA, isTerraChain } from "@certusone/wormhole-sdk";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
import { Link, makeStyles } from "@material-ui/core";
|
||||
import { useMemo } from "react";
|
||||
|
@ -63,8 +63,8 @@ function Send() {
|
|||
return (
|
||||
<>
|
||||
<KeyAndBalance chainId={sourceChain} />
|
||||
{sourceChain === CHAIN_ID_TERRA && (
|
||||
<TerraFeeDenomPicker disabled={disabled} />
|
||||
{isTerraChain(sourceChain) && (
|
||||
<TerraFeeDenomPicker disabled={disabled} chainId={sourceChain} />
|
||||
)}
|
||||
<ButtonWithLoader
|
||||
disabled={!isReady || disabled}
|
||||
|
|
|
@ -34,6 +34,7 @@ function Source() {
|
|||
const handleSourceChange = useCallback(
|
||||
(event) => {
|
||||
dispatch(setSourceChain(event.target.value));
|
||||
console.log(event.target.value);
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {
|
||||
CHAIN_ID_ACALA,
|
||||
CHAIN_ID_KARURA,
|
||||
CHAIN_ID_TERRA,
|
||||
hexToNativeAssetString,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import {
|
||||
Card,
|
||||
|
@ -299,14 +299,14 @@ function FeeMethodSelector() {
|
|||
<Typography variant="body1">{"Manual Payment"}</Typography>
|
||||
<Typography variant="body2" color="textSecondary">
|
||||
{`Pay with your own ${
|
||||
targetChain === CHAIN_ID_TERRA
|
||||
isTerraChain(targetChain)
|
||||
? "funds"
|
||||
: getDefaultNativeCurrencySymbol(targetChain)
|
||||
} on ${CHAINS_BY_ID[targetChain]?.name || "target chain"}`}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
{(isEVMChain(targetChain) || targetChain === CHAIN_ID_TERRA) && (
|
||||
{(isEVMChain(targetChain) || isTerraChain(targetChain)) && (
|
||||
<GasEstimateSummary
|
||||
methodType="transfer"
|
||||
chainId={targetChain}
|
||||
|
|
|
@ -2,8 +2,8 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import AlgorandWalletKey from "./AlgorandWalletKey";
|
||||
import EthereumSignerKey from "./EthereumSignerKey";
|
||||
|
@ -17,7 +17,7 @@ function KeyAndBalance({ chainId }: { chainId: ChainId }) {
|
|||
if (chainId === CHAIN_ID_SOLANA) {
|
||||
return <SolanaWalletKey />;
|
||||
}
|
||||
if (chainId === CHAIN_ID_TERRA) {
|
||||
if (isTerraChain(chainId)) {
|
||||
return <TerraWalletKey />;
|
||||
}
|
||||
if (chainId === CHAIN_ID_ALGORAND) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ChainId, CHAIN_ID_TERRA } from "@certusone/wormhole-sdk";
|
||||
import { ChainId, isTerraChain } from "@certusone/wormhole-sdk";
|
||||
import { makeStyles, Typography } from "@material-ui/core";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
import { useSelector } from "react-redux";
|
||||
|
@ -19,24 +19,24 @@ function LowBalanceWarning({ chainId }: { chainId: ChainId }) {
|
|||
const { isReady } = useIsWalletReady(chainId);
|
||||
const transactionFeeWarning = useTransactionFees(chainId);
|
||||
const relayerSelected = !!useSelector(selectTransferUseRelayer);
|
||||
const terraChain = isTerraChain(chainId);
|
||||
|
||||
const displayWarning =
|
||||
isReady &&
|
||||
!relayerSelected &&
|
||||
(chainId === CHAIN_ID_TERRA || transactionFeeWarning.balanceString) &&
|
||||
(terraChain || transactionFeeWarning.balanceString) &&
|
||||
transactionFeeWarning.isSufficientBalance === false;
|
||||
|
||||
const warningMessage =
|
||||
chainId === CHAIN_ID_TERRA
|
||||
? "This wallet may not have sufficient funds to pay for the upcoming transaction fees."
|
||||
: `This wallet has a very low ${getDefaultNativeCurrencySymbol(
|
||||
chainId
|
||||
)} balance and may not be able to pay for the upcoming transaction fees.`;
|
||||
const warningMessage = terraChain
|
||||
? "This wallet may not have sufficient funds to pay for the upcoming transaction fees."
|
||||
: `This wallet has a very low ${getDefaultNativeCurrencySymbol(
|
||||
chainId
|
||||
)} balance and may not be able to pay for the upcoming transaction fees.`;
|
||||
|
||||
const content = (
|
||||
<Alert severity="warning" variant="outlined" className={classes.alert}>
|
||||
<Typography variant="body1">{warningMessage}</Typography>
|
||||
{chainId !== CHAIN_ID_TERRA ? (
|
||||
{!terraChain ? (
|
||||
<Typography variant="body1">
|
||||
{"Current balance: " + transactionFeeWarning.balanceString}
|
||||
</Typography>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import { CHAIN_ID_SOLANA, CHAIN_ID_TERRA } from "@certusone/wormhole-sdk";
|
||||
import {
|
||||
CHAIN_ID_SOLANA,
|
||||
isTerraChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useHandleNFTRedeem } from "../../hooks/useHandleNFTRedeem";
|
||||
import useIsWalletReady from "../../hooks/useIsWalletReady";
|
||||
|
@ -19,8 +22,8 @@ function Redeem() {
|
|||
<>
|
||||
<StepDescription>Receive the NFT on the target chain</StepDescription>
|
||||
<KeyAndBalance chainId={targetChain} />
|
||||
{targetChain === CHAIN_ID_TERRA && (
|
||||
<TerraFeeDenomPicker disabled={disabled} />
|
||||
{isTerraChain(targetChain) && (
|
||||
<TerraFeeDenomPicker disabled={disabled} chainId={targetChain} />
|
||||
)}
|
||||
{targetChain === CHAIN_ID_SOLANA && CLUSTER === "mainnet" && (
|
||||
<SolanaTPSWarning />
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import { CHAIN_ID_SOLANA, CHAIN_ID_TERRA } from "@certusone/wormhole-sdk";
|
||||
import {
|
||||
CHAIN_ID_SOLANA,
|
||||
isTerraChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useHandleNFTTransfer } from "../../hooks/useHandleNFTTransfer";
|
||||
|
@ -44,8 +47,8 @@ function Send() {
|
|||
Transfer the NFT to the Wormhole Token Bridge.
|
||||
</StepDescription>
|
||||
<KeyAndBalance chainId={sourceChain} />
|
||||
{sourceChain === CHAIN_ID_TERRA && (
|
||||
<TerraFeeDenomPicker disabled={disabled} />
|
||||
{isTerraChain(sourceChain) && (
|
||||
<TerraFeeDenomPicker disabled={disabled} chainId={sourceChain} />
|
||||
)}
|
||||
<Alert severity="info" variant="outlined">
|
||||
This will initiate the transfer on {CHAINS_BY_ID[sourceChain].name} and
|
||||
|
|
|
@ -4,7 +4,6 @@ import {
|
|||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_KARURA,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
getEmitterAddressAlgorand,
|
||||
getEmitterAddressEth,
|
||||
getEmitterAddressSolana,
|
||||
|
@ -14,12 +13,14 @@ import {
|
|||
hexToUint8Array,
|
||||
importCoreWasm,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
parseNFTPayload,
|
||||
parseSequenceFromLogAlgorand,
|
||||
parseSequenceFromLogEth,
|
||||
parseSequenceFromLogSolana,
|
||||
parseSequenceFromLogTerra,
|
||||
parseTransferPayload,
|
||||
TerraChainId,
|
||||
uint8ArrayToHex,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import {
|
||||
|
@ -67,8 +68,7 @@ import {
|
|||
SOLANA_HOST,
|
||||
SOL_NFT_BRIDGE_ADDRESS,
|
||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_HOST,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
getTerraConfig,
|
||||
WORMHOLE_RPC_HOSTS,
|
||||
} from "../utils/consts";
|
||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||
|
@ -201,19 +201,19 @@ async function solana(tx: string, enqueueSnackbar: any, nft: boolean) {
|
|||
}
|
||||
}
|
||||
|
||||
async function terra(tx: string, enqueueSnackbar: any) {
|
||||
async function terra(tx: string, enqueueSnackbar: any, chainId: TerraChainId) {
|
||||
try {
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
const lcd = new LCDClient(getTerraConfig(chainId));
|
||||
const info = await lcd.tx.txInfo(tx);
|
||||
const sequence = parseSequenceFromLogTerra(info);
|
||||
if (!sequence) {
|
||||
throw new Error("Sequence not found");
|
||||
}
|
||||
const emitterAddress = await getEmitterAddressTerra(
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS
|
||||
getTokenBridgeAddressForChain(chainId)
|
||||
);
|
||||
const { vaaBytes } = await getSignedVAAWithRetry(
|
||||
CHAIN_ID_TERRA,
|
||||
chainId,
|
||||
emitterAddress,
|
||||
sequence,
|
||||
WORMHOLE_RPC_HOSTS.length
|
||||
|
@ -467,11 +467,15 @@ export default function Recovery() {
|
|||
}
|
||||
}
|
||||
})();
|
||||
} else if (recoverySourceChain === CHAIN_ID_TERRA) {
|
||||
} else if (isTerraChain(recoverySourceChain)) {
|
||||
setRecoverySourceTxError("");
|
||||
setRecoverySourceTxIsLoading(true);
|
||||
(async () => {
|
||||
const { vaa, error } = await terra(recoverySourceTx, enqueueSnackbar);
|
||||
const { vaa, error } = await terra(
|
||||
recoverySourceTx,
|
||||
enqueueSnackbar,
|
||||
recoverySourceChain
|
||||
);
|
||||
if (!cancelled) {
|
||||
setRecoverySourceTxIsLoading(false);
|
||||
if (vaa) {
|
||||
|
|
|
@ -15,6 +15,8 @@ import {
|
|||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
CHAIN_ID_ACALA,
|
||||
isTerraChain,
|
||||
CHAIN_ID_TERRA2,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Button, makeStyles, Typography } from "@material-ui/core";
|
||||
import { Transaction } from "../store/transferSlice";
|
||||
|
@ -42,7 +44,7 @@ export default function ShowTx({
|
|||
CLUSTER === "testnet" ||
|
||||
CLUSTER === "mainnet" ||
|
||||
(CLUSTER === "devnet" &&
|
||||
(chainId === CHAIN_ID_SOLANA || chainId === CHAIN_ID_TERRA));
|
||||
(chainId === CHAIN_ID_SOLANA || isTerraChain(chainId)));
|
||||
const explorerAddress =
|
||||
chainId === CHAIN_ID_ETH
|
||||
? `https://${CLUSTER === "testnet" ? "goerli." : ""}etherscan.io/tx/${
|
||||
|
@ -107,12 +109,16 @@ export default function ShowTx({
|
|||
: ""
|
||||
}`
|
||||
: chainId === CHAIN_ID_TERRA
|
||||
? CLUSTER === "mainnet"
|
||||
? `https://finder.terra.money/columbus-5/tx/${tx?.id}`
|
||||
: undefined
|
||||
: chainId === CHAIN_ID_TERRA2
|
||||
? `https://finder.terra.money/${
|
||||
CLUSTER === "devnet"
|
||||
? "localterra"
|
||||
: CLUSTER === "testnet"
|
||||
? "bombay-12"
|
||||
: "columbus-5"
|
||||
? "pisco-1"
|
||||
: "phoenix-1"
|
||||
}/tx/${tx?.id}`
|
||||
: chainId === CHAIN_ID_ALGORAND
|
||||
? `https://${CLUSTER === "testnet" ? "testnet." : ""}algoexplorer.io/tx/${
|
||||
|
|
|
@ -16,6 +16,9 @@ import {
|
|||
CHAIN_ID_TERRA,
|
||||
isNativeDenom,
|
||||
CHAIN_ID_ACALA,
|
||||
isTerraChain,
|
||||
CHAIN_ID_TERRA2,
|
||||
TerraChainId,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Button, makeStyles, Tooltip, Typography } from "@material-ui/core";
|
||||
import { FileCopy, OpenInNew } from "@material-ui/icons";
|
||||
|
@ -87,10 +90,10 @@ export default function SmartAddress({
|
|||
isAsset?: boolean;
|
||||
}) {
|
||||
const classes = useStyles();
|
||||
const isNativeTerra = chainId === CHAIN_ID_TERRA && isNativeDenom(address);
|
||||
const isNativeTerra = isTerraChain(chainId) && isNativeDenom(address);
|
||||
const useableAddress = parsedTokenAccount?.mintKey || address || "";
|
||||
const useableSymbol = isNativeTerra
|
||||
? formatNativeDenom(address)
|
||||
? formatNativeDenom(address || "", chainId as TerraChainId)
|
||||
: parsedTokenAccount?.symbol || symbol || "";
|
||||
// const useableLogo = logo || isNativeTerra ? getNativeTerraIcon(useableSymbol) : null
|
||||
const isNative = parsedTokenAccount?.isNativeAsset || isNativeTerra || false;
|
||||
|
@ -170,12 +173,16 @@ export default function SmartAddress({
|
|||
: ""
|
||||
}`
|
||||
: chainId === CHAIN_ID_TERRA
|
||||
? CLUSTER === "mainnet"
|
||||
? `https://finder.terra.money/columbus-5/address/${useableAddress}`
|
||||
: undefined
|
||||
: chainId === CHAIN_ID_TERRA2
|
||||
? `https://finder.terra.money/${
|
||||
CLUSTER === "devnet"
|
||||
? "localterra"
|
||||
: CLUSTER === "testnet"
|
||||
? "bombay-12"
|
||||
: "columbus-5"
|
||||
? "pisco-1"
|
||||
: "phoenix-1"
|
||||
}/address/${useableAddress}`
|
||||
: chainId === CHAIN_ID_ALGORAND
|
||||
? `https://${CLUSTER === "testnet" ? "testnet." : ""}algoexplorer.io/${
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
CHAIN_ID_TERRA2,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Container, makeStyles, Paper, Typography } from "@material-ui/core";
|
||||
import { useMemo } from "react";
|
||||
|
@ -105,6 +106,12 @@ const CustodyAddresses: React.FC<any> = () => {
|
|||
tokenAddress: getTokenBridgeAddressForChain(CHAIN_ID_AURORA),
|
||||
nftAddress: getNFTBridgeAddressForChain(CHAIN_ID_AURORA),
|
||||
},
|
||||
{
|
||||
chainName: "Terra",
|
||||
chainId: CHAIN_ID_TERRA2,
|
||||
tokenAddress: getTokenBridgeAddressForChain(CHAIN_ID_TERRA2),
|
||||
nftAddress: null,
|
||||
},
|
||||
];
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import { setTerraFeeDenom } from "../store/feeSlice";
|
|||
import { selectTerraFeeDenom } from "../store/selectors";
|
||||
import useTerraNativeBalances from "../hooks/useTerraNativeBalances";
|
||||
import { formatNativeDenom, getNativeTerraIcon } from "../utils/terra";
|
||||
import { TerraChainId } from "@certusone/wormhole-sdk";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
feePickerContainer: {
|
||||
|
@ -38,12 +39,16 @@ const useStyles = makeStyles((theme) => ({
|
|||
|
||||
type TerraFeeDenomPickerProps = {
|
||||
disabled: boolean;
|
||||
chainId: TerraChainId;
|
||||
};
|
||||
|
||||
export default function TerraFeeDenomPicker(props: TerraFeeDenomPickerProps) {
|
||||
const terraFeeDenom = useSelector(selectTerraFeeDenom);
|
||||
const wallet = useConnectedWallet();
|
||||
const { balances } = useTerraNativeBalances(wallet?.walletAddress);
|
||||
const { balances } = useTerraNativeBalances(
|
||||
props.chainId,
|
||||
wallet?.walletAddress
|
||||
);
|
||||
const dispatch = useDispatch();
|
||||
const classes = useStyles();
|
||||
|
||||
|
@ -52,7 +57,7 @@ export default function TerraFeeDenomPicker(props: TerraFeeDenomPickerProps) {
|
|||
if (balances) {
|
||||
for (const [denom, amount] of Object.entries(balances)) {
|
||||
if (amount === "0") continue;
|
||||
const symbol = formatNativeDenom(denom);
|
||||
const symbol = formatNativeDenom(denom, props.chainId);
|
||||
if (symbol) {
|
||||
items.push({
|
||||
denom,
|
||||
|
@ -64,7 +69,7 @@ export default function TerraFeeDenomPicker(props: TerraFeeDenomPickerProps) {
|
|||
}
|
||||
// prevent an out-of-range value from being selected
|
||||
if (!items.find((item) => item.denom === terraFeeDenom)) {
|
||||
const symbol = formatNativeDenom(terraFeeDenom);
|
||||
const symbol = formatNativeDenom(terraFeeDenom, props.chainId);
|
||||
items.push({
|
||||
denom: terraFeeDenom,
|
||||
symbol,
|
||||
|
@ -72,7 +77,7 @@ export default function TerraFeeDenomPicker(props: TerraFeeDenomPickerProps) {
|
|||
});
|
||||
}
|
||||
return items;
|
||||
}, [balances, terraFeeDenom]);
|
||||
}, [balances, terraFeeDenom, props.chainId]);
|
||||
|
||||
return (
|
||||
<div className={classes.feePickerContainer}>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
ChainId,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
nativeToHexString,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
@ -186,7 +186,7 @@ export default function TokenOriginVerifier() {
|
|||
const [primaryLookupAsset, setPrimaryLookupAsset] = useState("");
|
||||
|
||||
const [secondaryLookupChain, setSecondaryLookupChain] =
|
||||
useState<ChainId>(CHAIN_ID_TERRA);
|
||||
useState<ChainId>(CHAIN_ID_ETH);
|
||||
|
||||
const primaryLookupChainOptions = useMemo(
|
||||
() => (isBeta ? CHAINS.filter((x) => !BETA_CHAINS.includes(x.id)) : CHAINS),
|
||||
|
@ -207,7 +207,7 @@ export default function TokenOriginVerifier() {
|
|||
setPrimaryLookupChain(e.target.value);
|
||||
if (secondaryLookupChain === e.target.value) {
|
||||
setSecondaryLookupChain(
|
||||
e.target.value === CHAIN_ID_SOLANA ? CHAIN_ID_TERRA : CHAIN_ID_SOLANA
|
||||
e.target.value === CHAIN_ID_SOLANA ? CHAIN_ID_ETH : CHAIN_ID_SOLANA
|
||||
);
|
||||
}
|
||||
setPrimaryLookupAsset("");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CHAIN_ID_ALGORAND } from "@certusone/wormhole-sdk";
|
||||
import { ChainId, CHAIN_ID_ALGORAND } from "@certusone/wormhole-sdk";
|
||||
import { formatUnits } from "@ethersproject/units";
|
||||
import { Algodv2 } from "algosdk";
|
||||
import React, { useCallback } from "react";
|
||||
|
@ -85,17 +85,20 @@ export default function AlgoTokenPicker(props: AlgoTokenPickerProps) {
|
|||
[walletAddress]
|
||||
);
|
||||
|
||||
const isSearchableAddress = useCallback((address: string) => {
|
||||
if (address.length === 0) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
parseInt(address);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}, []);
|
||||
const isSearchableAddress = useCallback(
|
||||
(address: string, chainId: ChainId) => {
|
||||
if (address.length === 0) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
parseInt(address);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const RenderComp = useCallback(
|
||||
({ account }: { account: NFTParsedTokenAccount }) => {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
import {
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { TextField, Typography } from "@material-ui/core";
|
||||
import { useCallback } from "react";
|
||||
|
@ -81,8 +81,8 @@ export const TokenSelector = (props: TokenSelectorProps) => {
|
|||
//This is only for errors so bad that we shouldn't even mount the component
|
||||
const fatalError =
|
||||
!isEVMChain(lookupChain) &&
|
||||
lookupChain !== CHAIN_ID_TERRA &&
|
||||
maps?.tokenAccounts?.error; //Terra & ETH can proceed because it has advanced mode
|
||||
!isTerraChain(lookupChain) &&
|
||||
maps?.tokenAccounts?.error; //Terra & EVM chains can proceed because they have advanced mode
|
||||
|
||||
const content = fatalError ? (
|
||||
<RefreshButtonWrapper callback={resetAccountWrapper}>
|
||||
|
@ -108,13 +108,14 @@ export const TokenSelector = (props: TokenSelectorProps) => {
|
|||
chainId={lookupChain}
|
||||
nft={nft}
|
||||
/>
|
||||
) : lookupChain === CHAIN_ID_TERRA ? (
|
||||
) : isTerraChain(lookupChain) ? (
|
||||
<TerraTokenPicker
|
||||
value={sourceParsedTokenAccount || null}
|
||||
disabled={disabled}
|
||||
onChange={handleOnChange}
|
||||
resetAccounts={maps?.resetAccounts}
|
||||
tokenAccounts={maps?.tokenAccounts}
|
||||
chainId={lookupChain}
|
||||
/>
|
||||
) : lookupChain === CHAIN_ID_ALGORAND ? (
|
||||
<AlgoTokenPicker
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CHAIN_ID_TERRA, isNativeDenom } from "@certusone/wormhole-sdk";
|
||||
import { ChainId, isNativeDenom, TerraChainId } from "@certusone/wormhole-sdk";
|
||||
import { formatUnits } from "@ethersproject/units";
|
||||
import { LCDClient } from "@terra-money/terra.js";
|
||||
import React, { useCallback, useMemo, useRef } from "react";
|
||||
|
@ -8,7 +8,7 @@ import useTerraNativeBalances from "../../hooks/useTerraNativeBalances";
|
|||
import { DataWrapper } from "../../store/helpers";
|
||||
import { NFTParsedTokenAccount } from "../../store/nftSlice";
|
||||
import { ParsedTokenAccount } from "../../store/transferSlice";
|
||||
import { SUPPORTED_TERRA_TOKENS, TERRA_HOST } from "../../utils/consts";
|
||||
import { SUPPORTED_TERRA_TOKENS, getTerraConfig } from "../../utils/consts";
|
||||
import {
|
||||
formatNativeDenom,
|
||||
getNativeTerraIcon,
|
||||
|
@ -23,15 +23,17 @@ type TerraTokenPickerProps = {
|
|||
tokenAccounts: DataWrapper<ParsedTokenAccount[]> | undefined;
|
||||
disabled: boolean;
|
||||
resetAccounts: (() => void) | undefined;
|
||||
chainId: TerraChainId;
|
||||
};
|
||||
|
||||
const returnsFalse = () => false;
|
||||
|
||||
export default function TerraTokenPicker(props: TerraTokenPickerProps) {
|
||||
const { value, onChange, disabled } = props;
|
||||
const { walletAddress } = useIsWalletReady(CHAIN_ID_TERRA);
|
||||
const { value, onChange, disabled, chainId } = props;
|
||||
const { walletAddress } = useIsWalletReady(chainId);
|
||||
const nativeRefresh = useRef<() => void>(() => {});
|
||||
const { balances, isLoading: nativeIsLoading } = useTerraNativeBalances(
|
||||
chainId,
|
||||
walletAddress,
|
||||
nativeRefresh
|
||||
);
|
||||
|
@ -76,9 +78,9 @@ export default function TerraTokenPicker(props: TerraTokenPickerProps) {
|
|||
NATIVE_TERRA_DECIMALS, //TODO actually get decimals rather than hardcode
|
||||
0, //uiAmount is unused
|
||||
formatUnits(balances[denom], NATIVE_TERRA_DECIMALS), //uiAmountString
|
||||
formatNativeDenom(denom), // symbol
|
||||
formatNativeDenom(denom, props.chainId), // symbol
|
||||
undefined, //name
|
||||
getNativeTerraIcon(formatNativeDenom(denom)), //logo
|
||||
getNativeTerraIcon(formatNativeDenom(denom, props.chainId)), //logo
|
||||
true //is native asset
|
||||
)
|
||||
)
|
||||
|
@ -92,6 +94,7 @@ export default function TerraTokenPicker(props: TerraTokenPickerProps) {
|
|||
}, [
|
||||
walletAddress,
|
||||
balances,
|
||||
props.chainId,
|
||||
// tokenMap
|
||||
]);
|
||||
|
||||
|
@ -102,7 +105,7 @@ export default function TerraTokenPicker(props: TerraTokenPickerProps) {
|
|||
if (!walletAddress) {
|
||||
return Promise.reject("Wallet not connected");
|
||||
}
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
const lcd = new LCDClient(getTerraConfig(chainId));
|
||||
return lcd.wasm
|
||||
.contractQuery(lookupAsset, {
|
||||
token_info: {},
|
||||
|
@ -135,12 +138,18 @@ export default function TerraTokenPicker(props: TerraTokenPickerProps) {
|
|||
return Promise.reject();
|
||||
});
|
||||
},
|
||||
[walletAddress]
|
||||
[walletAddress, chainId]
|
||||
);
|
||||
|
||||
const isSearchableAddress = useCallback((address: string) => {
|
||||
return isValidTerraAddress(address) && !isNativeDenom(address);
|
||||
}, []);
|
||||
const isSearchableAddress = useCallback(
|
||||
(address: string, chainId: ChainId) => {
|
||||
return (
|
||||
isValidTerraAddress(address, chainId as TerraChainId) &&
|
||||
!isNativeDenom(address)
|
||||
);
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const RenderComp = useCallback(
|
||||
({ account }: { account: NFTParsedTokenAccount }) => {
|
||||
|
@ -162,7 +171,7 @@ export default function TerraTokenPicker(props: TerraTokenPickerProps) {
|
|||
error={""}
|
||||
showLoader={isLoading}
|
||||
nft={false}
|
||||
chainId={CHAIN_ID_TERRA}
|
||||
chainId={chainId}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ export default function TokenPicker({
|
|||
account: NFTParsedTokenAccount;
|
||||
}) => JSX.Element;
|
||||
onChange: (newValue: NFTParsedTokenAccount | null) => Promise<void>;
|
||||
isValidAddress?: (address: string) => boolean;
|
||||
isValidAddress?: (address: string, chainId: ChainId) => boolean;
|
||||
getAddress?: (
|
||||
address: string,
|
||||
tokenId?: string
|
||||
|
@ -418,7 +418,7 @@ export default function TokenPicker({
|
|||
}
|
||||
setLoadingError("");
|
||||
let cancelled = false;
|
||||
if (isValidAddress(holderString)) {
|
||||
if (isValidAddress(holderString, chainId)) {
|
||||
const option = localFind(holderString, tokenIdHolderString);
|
||||
if (option) {
|
||||
handleSelectOption(option);
|
||||
|
@ -457,6 +457,7 @@ export default function TokenPicker({
|
|||
localFind,
|
||||
tokenIdHolderString,
|
||||
useTokenId,
|
||||
chainId,
|
||||
]);
|
||||
|
||||
//TODO reset button
|
||||
|
|
|
@ -12,8 +12,8 @@ import {
|
|||
CHAIN_ID_OASIS,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
WSOL_ADDRESS,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import {
|
||||
|
@ -242,8 +242,8 @@ function Redeem() {
|
|||
const nonRelayContent = (
|
||||
<>
|
||||
<KeyAndBalance chainId={targetChain} />
|
||||
{targetChain === CHAIN_ID_TERRA && (
|
||||
<TerraFeeDenomPicker disabled={disabled} />
|
||||
{isTerraChain(targetChain) && (
|
||||
<TerraFeeDenomPicker disabled={disabled} chainId={targetChain} />
|
||||
)}
|
||||
{isNativeEligible && (
|
||||
<FormControlLabel
|
||||
|
|
|
@ -35,6 +35,7 @@ export function RegisterNowButtonCore({
|
|||
originChain && hexToNativeAssetString(originAsset, originChain);
|
||||
if (originChain && originAsset && nativeAsset && canSwitch) {
|
||||
dispatch(setSourceChain(originChain));
|
||||
console.log(originChain);
|
||||
dispatch(setSourceAsset(nativeAsset));
|
||||
dispatch(setTargetChain(targetChain));
|
||||
dispatch(setStep(2));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Checkbox, FormControlLabel } from "@material-ui/core";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
|
@ -149,8 +149,8 @@ function Send() {
|
|||
Transfer the tokens to the Wormhole Token Bridge.
|
||||
</StepDescription>
|
||||
<KeyAndBalance chainId={sourceChain} />
|
||||
{sourceChain === CHAIN_ID_TERRA && (
|
||||
<TerraFeeDenomPicker disabled={disabled} />
|
||||
{isTerraChain(sourceChain) && (
|
||||
<TerraFeeDenomPicker disabled={disabled} chainId={sourceChain} />
|
||||
)}
|
||||
<Alert severity="info" variant="outlined">
|
||||
This will initiate the transfer on {CHAINS_BY_ID[sourceChain].name} and
|
||||
|
|
|
@ -125,6 +125,7 @@ function Source() {
|
|||
const handleSourceChange = useCallback(
|
||||
(event) => {
|
||||
dispatch(setSourceChain(event.target.value));
|
||||
console.log(event.target.value);
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
|
|
@ -65,6 +65,7 @@ function Transfer() {
|
|||
return;
|
||||
}
|
||||
if (sourceChain) {
|
||||
console.log(sourceChain);
|
||||
dispatch(setSourceChain(sourceChain));
|
||||
}
|
||||
if (targetChain) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// TODO: need to add select chain bar
|
||||
import { useCallback, useState } from "react";
|
||||
import { MsgExecuteContract } from "@terra-money/terra.js";
|
||||
import {
|
||||
|
@ -5,8 +6,8 @@ import {
|
|||
useConnectedWallet,
|
||||
} from "@terra-money/wallet-provider";
|
||||
import {
|
||||
getTokenBridgeAddressForChain,
|
||||
SUPPORTED_TERRA_TOKENS,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import TerraWalletKey from "./TerraWalletKey";
|
||||
import {
|
||||
|
@ -28,6 +29,7 @@ import { selectTerraFeeDenom } from "../store/selectors";
|
|||
import TerraFeeDenomPicker from "./TerraFeeDenomPicker";
|
||||
import HeaderText from "./HeaderText";
|
||||
import { COLORS } from "../muiTheme";
|
||||
import { CHAIN_ID_TERRA } from "@certusone/wormhole-sdk";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
formControl: {
|
||||
|
@ -54,7 +56,7 @@ const withdraw = async (
|
|||
) => {
|
||||
const withdraw = new MsgExecuteContract(
|
||||
wallet.walletAddress,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
getTokenBridgeAddressForChain(CHAIN_ID_TERRA),
|
||||
{
|
||||
withdraw_tokens: {
|
||||
asset: {
|
||||
|
@ -70,9 +72,10 @@ const withdraw = async (
|
|||
wallet,
|
||||
[withdraw],
|
||||
"Wormhole - Withdraw Tokens",
|
||||
[feeDenom]
|
||||
[feeDenom],
|
||||
CHAIN_ID_TERRA
|
||||
);
|
||||
await waitForTerraExecution(txResult);
|
||||
await waitForTerraExecution(txResult, CHAIN_ID_TERRA);
|
||||
};
|
||||
|
||||
export default function WithdrawTokensTerra() {
|
||||
|
@ -125,7 +128,7 @@ export default function WithdrawTokensTerra() {
|
|||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
<TerraFeeDenomPicker disabled={isLoading} />
|
||||
<TerraFeeDenomPicker disabled={isLoading} chainId={CHAIN_ID_TERRA} />
|
||||
<ButtonWithLoader
|
||||
onClick={handleClick}
|
||||
disabled={!wallet || isLoading}
|
||||
|
|
|
@ -4,19 +4,29 @@ import { CLUSTER } from "../utils/consts";
|
|||
|
||||
const mainnet: NetworkInfo = {
|
||||
name: "mainnet",
|
||||
chainID: "columbus-5",
|
||||
lcd: "https://lcd.terra.dev",
|
||||
chainID: "phoenix-1",
|
||||
lcd: "https://phoenix-lcd.terra.dev",
|
||||
walletconnectID: 1,
|
||||
};
|
||||
|
||||
const classic: NetworkInfo = {
|
||||
name: "classic",
|
||||
chainID: "columbus-5",
|
||||
lcd: "https://columbus-lcd.terra.dev",
|
||||
walletconnectID: 2,
|
||||
}
|
||||
|
||||
const testnet: NetworkInfo = {
|
||||
name: "testnet",
|
||||
chainID: "bombay-12",
|
||||
lcd: "https://bombay-lcd.terra.dev",
|
||||
chainID: "pisco-1",
|
||||
lcd: "https://pisco-lcd.terra.dev",
|
||||
walletconnectID: 0,
|
||||
};
|
||||
|
||||
const walletConnectChainIds: Record<number, NetworkInfo> = {
|
||||
0: testnet,
|
||||
1: mainnet,
|
||||
2: classic,
|
||||
};
|
||||
|
||||
export const TerraWalletProvider = ({
|
||||
|
|
|
@ -2,12 +2,12 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
getOriginalAssetAlgorand,
|
||||
getOriginalAssetCosmWasm,
|
||||
getOriginalAssetEth,
|
||||
getOriginalAssetSol,
|
||||
getOriginalAssetTerra,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
uint8ArrayToHex,
|
||||
WormholeWrappedInfo,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
@ -17,6 +17,7 @@ import {
|
|||
} from "@certusone/wormhole-sdk/lib/esm/nft_bridge";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
import { LCDClient } from "@terra-money/terra.js";
|
||||
import { Algodv2 } from "algosdk";
|
||||
import { useEffect } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useEthereumProvider } from "../contexts/EthereumProviderContext";
|
||||
|
@ -35,13 +36,12 @@ import {
|
|||
ALGORAND_HOST,
|
||||
ALGORAND_TOKEN_BRIDGE_ID,
|
||||
getNFTBridgeAddressForChain,
|
||||
getTerraConfig,
|
||||
getTokenBridgeAddressForChain,
|
||||
SOLANA_HOST,
|
||||
SOL_NFT_BRIDGE_ADDRESS,
|
||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_HOST,
|
||||
} from "../utils/consts";
|
||||
import { Algodv2 } from "algosdk";
|
||||
|
||||
export interface StateSafeWormholeWrappedInfo {
|
||||
isWrapped: boolean;
|
||||
|
@ -128,12 +128,13 @@ function useCheckIfWormholeWrapped(nft?: boolean) {
|
|||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
if (sourceChain === CHAIN_ID_TERRA && sourceAsset) {
|
||||
if (isTerraChain(sourceChain) && sourceAsset) {
|
||||
try {
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
const lcd = new LCDClient(getTerraConfig(sourceChain));
|
||||
const wrappedInfo = makeStateSafe(
|
||||
await getOriginalAssetTerra(lcd, sourceAsset)
|
||||
await getOriginalAssetCosmWasm(lcd, sourceAsset, sourceChain)
|
||||
);
|
||||
console.log(wrappedInfo);
|
||||
if (!cancelled) {
|
||||
dispatch(setSourceWormholeWrappedInfo(wrappedInfo));
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
getForeignAssetAlgorand,
|
||||
getForeignAssetEth,
|
||||
getForeignAssetSolana,
|
||||
getForeignAssetTerra,
|
||||
hexToUint8Array,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
nativeToHexString,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
|
@ -24,8 +24,7 @@ import {
|
|||
getTokenBridgeAddressForChain,
|
||||
SOLANA_HOST,
|
||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_HOST,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
getTerraConfig,
|
||||
} from "../utils/consts";
|
||||
import useIsWalletReady from "./useIsWalletReady";
|
||||
import { Algodv2 } from "algosdk";
|
||||
|
@ -115,11 +114,11 @@ function useFetchForeignAsset(
|
|||
originChain,
|
||||
hexToUint8Array(originAssetHex)
|
||||
)
|
||||
: foreignChain === CHAIN_ID_TERRA
|
||||
: isTerraChain(foreignChain)
|
||||
? () => {
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
const lcd = new LCDClient(getTerraConfig(foreignChain));
|
||||
return getForeignAssetTerra(
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
getTokenBridgeAddressForChain(foreignChain),
|
||||
lcd,
|
||||
originChain,
|
||||
hexToUint8Array(originAssetHex)
|
||||
|
|
|
@ -2,7 +2,6 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
getForeignAssetAlgorand,
|
||||
getForeignAssetEth,
|
||||
getForeignAssetSolana,
|
||||
|
@ -10,6 +9,7 @@ import {
|
|||
hexToNativeAssetString,
|
||||
hexToUint8Array,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import {
|
||||
getForeignAssetEth as getForeignAssetEthNFT,
|
||||
|
@ -51,8 +51,7 @@ import {
|
|||
SOLANA_HOST,
|
||||
SOL_NFT_BRIDGE_ADDRESS,
|
||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_HOST,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
getTerraConfig,
|
||||
} from "../utils/consts";
|
||||
|
||||
function useFetchTargetAsset(nft?: boolean) {
|
||||
|
@ -68,6 +67,7 @@ function useFetchTargetAsset(nft?: boolean) {
|
|||
const originAsset = useSelector(
|
||||
nft ? selectNFTOriginAsset : selectTransferOriginAsset
|
||||
);
|
||||
console.log(originAsset);
|
||||
const originTokenId = useSelector(selectNFTOriginTokenId);
|
||||
const tokenId = originTokenId || ""; // this should exist by this step for NFT transfers
|
||||
const targetChain = useSelector(
|
||||
|
@ -214,12 +214,12 @@ function useFetchTargetAsset(nft?: boolean) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (targetChain === CHAIN_ID_TERRA && originChain && originAsset) {
|
||||
if (isTerraChain(targetChain) && originChain && originAsset) {
|
||||
dispatch(setTargetAsset(fetchDataWrapper()));
|
||||
try {
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
const lcd = new LCDClient(getTerraConfig(targetChain));
|
||||
const asset = await getForeignAssetTerra(
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
getTokenBridgeAddressForChain(targetChain),
|
||||
lcd,
|
||||
originChain,
|
||||
hexToUint8Array(originAsset)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import {
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
getIsTransferCompletedAlgorand,
|
||||
getIsTransferCompletedEth,
|
||||
getIsTransferCompletedSolana,
|
||||
getIsTransferCompletedTerra,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
import { LCDClient } from "@terra-money/terra.js";
|
||||
|
@ -25,8 +25,8 @@ import {
|
|||
getEvmChainId,
|
||||
getTokenBridgeAddressForChain,
|
||||
SOLANA_HOST,
|
||||
TERRA_GAS_PRICES_URL,
|
||||
TERRA_HOST,
|
||||
getTerraGasPricesUrl,
|
||||
getTerraConfig,
|
||||
} from "../utils/consts";
|
||||
import useIsWalletReady from "./useIsWalletReady";
|
||||
import useTransferSignedVAA from "./useTransferSignedVAA";
|
||||
|
@ -119,16 +119,16 @@ export default function useGetIsTransferCompleted(
|
|||
setIsLoading(false);
|
||||
}
|
||||
})();
|
||||
} else if (targetChain === CHAIN_ID_TERRA) {
|
||||
} else if (isTerraChain(targetChain)) {
|
||||
setIsLoading(true);
|
||||
(async () => {
|
||||
try {
|
||||
const lcdClient = new LCDClient(TERRA_HOST);
|
||||
const lcdClient = new LCDClient(getTerraConfig(targetChain));
|
||||
transferCompleted = await getIsTransferCompletedTerra(
|
||||
getTokenBridgeAddressForChain(targetChain),
|
||||
signedVAA,
|
||||
lcdClient,
|
||||
TERRA_GAS_PRICES_URL
|
||||
getTerraGasPricesUrl(targetChain)
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
|
|
@ -15,8 +15,8 @@ import {
|
|||
CHAIN_ID_OASIS,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
TokenImplementation__factory,
|
||||
WSOL_ADDRESS,
|
||||
WSOL_DECIMALS,
|
||||
|
@ -1546,7 +1546,7 @@ function useGetAvailableTokens(nft: boolean = false) {
|
|||
},
|
||||
resetAccounts: resetSourceAccounts,
|
||||
}
|
||||
: lookupChain === CHAIN_ID_TERRA
|
||||
: isTerraChain(lookupChain)
|
||||
? {
|
||||
resetAccounts: resetSourceAccounts,
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
isNativeDenom,
|
||||
isTerraChain,
|
||||
TokenImplementation__factory,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Connection, PublicKey } from "@solana/web3.js";
|
||||
|
@ -24,7 +24,7 @@ import {
|
|||
ALGORAND_HOST,
|
||||
getEvmChainId,
|
||||
SOLANA_HOST,
|
||||
TERRA_HOST,
|
||||
getTerraConfig,
|
||||
} from "../utils/consts";
|
||||
import { NATIVE_TERRA_DECIMALS } from "../utils/terra";
|
||||
import { createParsedTokenAccount } from "./useGetSourceParsedTokenAccounts";
|
||||
|
@ -67,8 +67,8 @@ function useGetTargetParsedTokenAccounts() {
|
|||
}
|
||||
let cancelled = false;
|
||||
|
||||
if (targetChain === CHAIN_ID_TERRA && terraWallet) {
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
if (isTerraChain(targetChain) && terraWallet) {
|
||||
const lcd = new LCDClient(getTerraConfig(targetChain));
|
||||
if (isNativeDenom(targetAsset)) {
|
||||
lcd.bank
|
||||
.balance(terraWallet.walletAddress)
|
||||
|
|
|
@ -7,16 +7,17 @@ import {
|
|||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_KLAYTN,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
getEmitterAddressAlgorand,
|
||||
getEmitterAddressEth,
|
||||
getEmitterAddressSolana,
|
||||
getEmitterAddressTerra,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
parseSequenceFromLogAlgorand,
|
||||
parseSequenceFromLogEth,
|
||||
parseSequenceFromLogSolana,
|
||||
parseSequenceFromLogTerra,
|
||||
TerraChainId,
|
||||
uint8ArrayToHex,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
|
@ -57,7 +58,6 @@ import {
|
|||
SOLANA_HOST,
|
||||
SOL_BRIDGE_ADDRESS,
|
||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||
import parseError from "../utils/parseError";
|
||||
|
@ -230,19 +230,25 @@ async function terra(
|
|||
enqueueSnackbar: any,
|
||||
wallet: ConnectedWallet,
|
||||
asset: string,
|
||||
feeDenom: string
|
||||
feeDenom: string,
|
||||
chainId: TerraChainId
|
||||
) {
|
||||
dispatch(setIsSending(true));
|
||||
try {
|
||||
const tokenBridgeAddress = getTokenBridgeAddressForChain(chainId)
|
||||
const msg = await attestFromTerra(
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
tokenBridgeAddress,
|
||||
wallet.terraAddress,
|
||||
asset
|
||||
);
|
||||
const result = await postWithFees(wallet, [msg], "Create Wrapped", [
|
||||
feeDenom,
|
||||
]);
|
||||
const info = await waitForTerraExecution(result);
|
||||
const result = await postWithFees(
|
||||
wallet,
|
||||
[msg],
|
||||
"Create Wrapped",
|
||||
[feeDenom],
|
||||
chainId
|
||||
);
|
||||
const info = await waitForTerraExecution(result, chainId);
|
||||
dispatch(setAttestTx({ id: info.txhash, block: info.height }));
|
||||
enqueueSnackbar(null, {
|
||||
content: <Alert severity="success">Transaction confirmed</Alert>,
|
||||
|
@ -252,13 +258,13 @@ async function terra(
|
|||
throw new Error("Sequence not found");
|
||||
}
|
||||
const emitterAddress = await getEmitterAddressTerra(
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS
|
||||
tokenBridgeAddress,
|
||||
);
|
||||
enqueueSnackbar(null, {
|
||||
content: <Alert severity="info">Fetching VAA</Alert>,
|
||||
});
|
||||
const { vaaBytes } = await getSignedVAAWithRetry(
|
||||
CHAIN_ID_TERRA,
|
||||
chainId,
|
||||
emitterAddress,
|
||||
sequence
|
||||
);
|
||||
|
@ -295,8 +301,15 @@ export function useHandleAttest() {
|
|||
evm(dispatch, enqueueSnackbar, signer, sourceAsset, sourceChain);
|
||||
} else if (sourceChain === CHAIN_ID_SOLANA && !!solanaWallet && !!solPK) {
|
||||
solana(dispatch, enqueueSnackbar, solPK, sourceAsset, solanaWallet);
|
||||
} else if (sourceChain === CHAIN_ID_TERRA && !!terraWallet) {
|
||||
terra(dispatch, enqueueSnackbar, terraWallet, sourceAsset, terraFeeDenom);
|
||||
} else if (isTerraChain(sourceChain) && !!terraWallet) {
|
||||
terra(
|
||||
dispatch,
|
||||
enqueueSnackbar,
|
||||
terraWallet,
|
||||
sourceAsset,
|
||||
terraFeeDenom,
|
||||
sourceChain
|
||||
);
|
||||
} else if (sourceChain === CHAIN_ID_ALGORAND && algoAccounts[0]) {
|
||||
algo(dispatch, enqueueSnackbar, algoAccounts[0].address, sourceAsset);
|
||||
} else {
|
||||
|
|
|
@ -5,12 +5,13 @@ import {
|
|||
CHAIN_ID_KARURA,
|
||||
CHAIN_ID_KLAYTN,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
createWrappedOnAlgorand,
|
||||
createWrappedOnEth,
|
||||
createWrappedOnSolana,
|
||||
createWrappedOnTerra,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
TerraChainId,
|
||||
updateWrappedOnEth,
|
||||
updateWrappedOnSolana,
|
||||
updateWrappedOnTerra,
|
||||
|
@ -48,7 +49,6 @@ import {
|
|||
SOLANA_HOST,
|
||||
SOL_BRIDGE_ADDRESS,
|
||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { getKaruraGasParams } from "../utils/karura";
|
||||
import parseError from "../utils/parseError";
|
||||
|
@ -199,18 +199,20 @@ async function terra(
|
|||
wallet: ConnectedWallet,
|
||||
signedVAA: Uint8Array,
|
||||
shouldUpdate: boolean,
|
||||
feeDenom: string
|
||||
feeDenom: string,
|
||||
chainId: TerraChainId
|
||||
) {
|
||||
dispatch(setIsCreating(true));
|
||||
const tokenBridgeAddress = getTokenBridgeAddressForChain(chainId);
|
||||
try {
|
||||
const msg = shouldUpdate
|
||||
? await updateWrappedOnTerra(
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
tokenBridgeAddress,
|
||||
wallet.terraAddress,
|
||||
signedVAA
|
||||
)
|
||||
: await createWrappedOnTerra(
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
tokenBridgeAddress,
|
||||
wallet.terraAddress,
|
||||
signedVAA
|
||||
);
|
||||
|
@ -218,7 +220,8 @@ async function terra(
|
|||
wallet,
|
||||
[msg],
|
||||
"Wormhole - Create Wrapped",
|
||||
[feeDenom]
|
||||
[feeDenom],
|
||||
chainId
|
||||
);
|
||||
dispatch(
|
||||
setCreateTx({ id: result.result.txhash, block: result.result.height })
|
||||
|
@ -270,14 +273,15 @@ export function useHandleCreateWrapped(shouldUpdate: boolean) {
|
|||
signedVAA,
|
||||
shouldUpdate
|
||||
);
|
||||
} else if (targetChain === CHAIN_ID_TERRA && !!terraWallet && !!signedVAA) {
|
||||
} else if (isTerraChain(targetChain) && !!terraWallet && !!signedVAA) {
|
||||
terra(
|
||||
dispatch,
|
||||
enqueueSnackbar,
|
||||
terraWallet,
|
||||
signedVAA,
|
||||
shouldUpdate,
|
||||
terraFeeDenom
|
||||
terraFeeDenom,
|
||||
targetChain
|
||||
);
|
||||
} else if (
|
||||
targetChain === CHAIN_ID_ALGORAND &&
|
||||
|
|
|
@ -3,14 +3,15 @@ import {
|
|||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_KLAYTN,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
redeemAndUnwrapOnSolana,
|
||||
redeemOnAlgorand,
|
||||
redeemOnEth,
|
||||
redeemOnEthNative,
|
||||
redeemOnSolana,
|
||||
redeemOnTerra,
|
||||
TerraChainId,
|
||||
uint8ArrayToHex,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
|
@ -46,7 +47,6 @@ import {
|
|||
SOLANA_HOST,
|
||||
SOL_BRIDGE_ADDRESS,
|
||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import parseError from "../utils/parseError";
|
||||
import { postVaaWithRetry } from "../utils/postVaa";
|
||||
|
@ -192,12 +192,13 @@ async function terra(
|
|||
enqueueSnackbar: any,
|
||||
wallet: ConnectedWallet,
|
||||
signedVAA: Uint8Array,
|
||||
feeDenom: string
|
||||
feeDenom: string,
|
||||
chainId: TerraChainId
|
||||
) {
|
||||
dispatch(setIsRedeeming(true));
|
||||
try {
|
||||
const msg = await redeemOnTerra(
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
getTokenBridgeAddressForChain(chainId),
|
||||
wallet.terraAddress,
|
||||
signedVAA
|
||||
);
|
||||
|
@ -205,7 +206,8 @@ async function terra(
|
|||
wallet,
|
||||
[msg],
|
||||
"Wormhole - Complete Transfer",
|
||||
[feeDenom]
|
||||
[feeDenom],
|
||||
chainId
|
||||
);
|
||||
dispatch(
|
||||
setRedeemTx({ id: result.result.txhash, block: result.result.height })
|
||||
|
@ -250,8 +252,15 @@ export function useHandleRedeem() {
|
|||
signedVAA,
|
||||
false
|
||||
);
|
||||
} else if (targetChain === CHAIN_ID_TERRA && !!terraWallet && signedVAA) {
|
||||
terra(dispatch, enqueueSnackbar, terraWallet, signedVAA, terraFeeDenom);
|
||||
} else if (isTerraChain(targetChain) && !!terraWallet && signedVAA) {
|
||||
terra(
|
||||
dispatch,
|
||||
enqueueSnackbar,
|
||||
terraWallet,
|
||||
signedVAA,
|
||||
terraFeeDenom,
|
||||
targetChain
|
||||
);
|
||||
} else if (
|
||||
targetChain === CHAIN_ID_ALGORAND &&
|
||||
algoAccounts[0] &&
|
||||
|
@ -290,8 +299,15 @@ export function useHandleRedeem() {
|
|||
signedVAA,
|
||||
true
|
||||
);
|
||||
} else if (targetChain === CHAIN_ID_TERRA && !!terraWallet && signedVAA) {
|
||||
terra(dispatch, enqueueSnackbar, terraWallet, signedVAA, terraFeeDenom); //TODO isNative = true
|
||||
} else if (isTerraChain(targetChain) && !!terraWallet && signedVAA) {
|
||||
terra(
|
||||
dispatch,
|
||||
enqueueSnackbar,
|
||||
terraWallet,
|
||||
signedVAA,
|
||||
terraFeeDenom,
|
||||
targetChain
|
||||
); //TODO isNative = true
|
||||
} else if (
|
||||
targetChain === CHAIN_ID_ALGORAND &&
|
||||
algoAccounts[0] &&
|
||||
|
|
|
@ -3,17 +3,18 @@ import {
|
|||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_KLAYTN,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
getEmitterAddressAlgorand,
|
||||
getEmitterAddressEth,
|
||||
getEmitterAddressSolana,
|
||||
getEmitterAddressTerra,
|
||||
hexToUint8Array,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
parseSequenceFromLogAlgorand,
|
||||
parseSequenceFromLogEth,
|
||||
parseSequenceFromLogSolana,
|
||||
parseSequenceFromLogTerra,
|
||||
TerraChainId,
|
||||
transferFromAlgorand,
|
||||
transferFromEth,
|
||||
transferFromEthNative,
|
||||
|
@ -67,7 +68,6 @@ import {
|
|||
SOLANA_HOST,
|
||||
SOL_BRIDGE_ADDRESS,
|
||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||
import parseError from "../utils/parseError";
|
||||
|
@ -323,6 +323,7 @@ async function terra(
|
|||
targetChain: ChainId,
|
||||
targetAddress: Uint8Array,
|
||||
feeDenom: string,
|
||||
chainId: TerraChainId,
|
||||
relayerFee?: string
|
||||
) {
|
||||
dispatch(setIsSending(true));
|
||||
|
@ -330,9 +331,10 @@ async function terra(
|
|||
const baseAmountParsed = parseUnits(amount, decimals);
|
||||
const feeParsed = parseUnits(relayerFee || "0", decimals);
|
||||
const transferAmountParsed = baseAmountParsed.add(feeParsed);
|
||||
const tokenBridgeAddress = getTokenBridgeAddressForChain(chainId);
|
||||
const msgs = await transferFromTerra(
|
||||
wallet.terraAddress,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
tokenBridgeAddress,
|
||||
asset,
|
||||
transferAmountParsed.toString(),
|
||||
targetChain,
|
||||
|
@ -344,10 +346,11 @@ async function terra(
|
|||
wallet,
|
||||
msgs,
|
||||
"Wormhole - Initiate Transfer",
|
||||
[feeDenom]
|
||||
[feeDenom],
|
||||
chainId
|
||||
);
|
||||
|
||||
const info = await waitForTerraExecution(result);
|
||||
const info = await waitForTerraExecution(result, chainId);
|
||||
dispatch(setTransferTx({ id: info.txhash, block: info.height }));
|
||||
enqueueSnackbar(null, {
|
||||
content: <Alert severity="success">Transaction confirmed</Alert>,
|
||||
|
@ -356,14 +359,12 @@ async function terra(
|
|||
if (!sequence) {
|
||||
throw new Error("Sequence not found");
|
||||
}
|
||||
const emitterAddress = await getEmitterAddressTerra(
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS
|
||||
);
|
||||
const emitterAddress = await getEmitterAddressTerra(tokenBridgeAddress);
|
||||
enqueueSnackbar(null, {
|
||||
content: <Alert severity="info">Fetching VAA</Alert>,
|
||||
});
|
||||
const { vaaBytes } = await getSignedVAAWithRetry(
|
||||
CHAIN_ID_TERRA,
|
||||
chainId,
|
||||
emitterAddress,
|
||||
sequence
|
||||
);
|
||||
|
@ -458,7 +459,7 @@ export function useHandleTransfer() {
|
|||
relayerFee
|
||||
);
|
||||
} else if (
|
||||
sourceChain === CHAIN_ID_TERRA &&
|
||||
isTerraChain(sourceChain) &&
|
||||
!!terraWallet &&
|
||||
!!sourceAsset &&
|
||||
decimals !== undefined &&
|
||||
|
@ -474,6 +475,7 @@ export function useHandleTransfer() {
|
|||
targetChain,
|
||||
targetAddress,
|
||||
terraFeeDenom,
|
||||
sourceChain,
|
||||
relayerFee
|
||||
);
|
||||
} else if (
|
||||
|
|
|
@ -2,8 +2,8 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { hexlify, hexStripZeros } from "@ethersproject/bytes";
|
||||
import { useConnectedWallet } from "@terra-money/wallet-provider";
|
||||
|
@ -98,11 +98,7 @@ function useIsWalletReady(
|
|||
}, [provider, correctEvmNetwork, chainId, connectType, disconnect]);
|
||||
|
||||
return useMemo(() => {
|
||||
if (
|
||||
chainId === CHAIN_ID_TERRA &&
|
||||
hasTerraWallet &&
|
||||
terraWallet?.walletAddress
|
||||
) {
|
||||
if (isTerraChain(chainId) && hasTerraWallet && terraWallet?.walletAddress) {
|
||||
// TODO: terraWallet does not update on wallet changes
|
||||
return createWalletStatus(
|
||||
true,
|
||||
|
|
|
@ -2,8 +2,10 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
CHAIN_ID_TERRA2,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
TerraChainId,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { TokenInfo } from "@solana/spl-token-registry";
|
||||
import { useMemo } from "react";
|
||||
|
@ -60,7 +62,8 @@ const constructSolanaMetadata = (
|
|||
const constructTerraMetadata = (
|
||||
addresses: string[],
|
||||
tokenMap: DataWrapper<TerraTokenMap>,
|
||||
terraMetadata: DataWrapper<Map<string, TerraMetadata>>
|
||||
terraMetadata: DataWrapper<Map<string, TerraMetadata>>,
|
||||
chainId: TerraChainId
|
||||
) => {
|
||||
const isFetching = tokenMap.isFetching || terraMetadata.isFetching;
|
||||
const error = tokenMap.error || terraMetadata.error;
|
||||
|
@ -68,7 +71,10 @@ const constructTerraMetadata = (
|
|||
const data = new Map<string, GenericMetadata>();
|
||||
addresses.forEach((address) => {
|
||||
const metadata = terraMetadata.data?.get(address);
|
||||
const tokenInfo = tokenMap.data?.mainnet[address];
|
||||
const tokenInfo =
|
||||
chainId === CHAIN_ID_TERRA2
|
||||
? tokenMap.data?.mainnet[address]
|
||||
: tokenMap.data?.classic[address];
|
||||
const obj = {
|
||||
symbol: tokenInfo?.symbol || metadata?.symbol || undefined,
|
||||
logo: tokenInfo?.icon || metadata?.logo || undefined,
|
||||
|
@ -144,14 +150,14 @@ export default function useMetadata(
|
|||
chainId: ChainId,
|
||||
addresses: string[]
|
||||
): DataWrapper<Map<string, GenericMetadata>> {
|
||||
const terraTokenMap = useTerraTokenMap(chainId === CHAIN_ID_TERRA);
|
||||
const terraTokenMap = useTerraTokenMap(isTerraChain(chainId));
|
||||
const solanaTokenMap = useSolanaTokenMap();
|
||||
|
||||
const solanaAddresses = useMemo(() => {
|
||||
return chainId === CHAIN_ID_SOLANA ? addresses : [];
|
||||
}, [chainId, addresses]);
|
||||
const terraAddresses = useMemo(() => {
|
||||
return chainId === CHAIN_ID_TERRA ? addresses : [];
|
||||
return isTerraChain(chainId) ? addresses : [];
|
||||
}, [chainId, addresses]);
|
||||
const ethereumAddresses = useMemo(() => {
|
||||
return isEVMChain(chainId) ? addresses : [];
|
||||
|
@ -161,7 +167,10 @@ export default function useMetadata(
|
|||
}, [chainId, addresses]);
|
||||
|
||||
const metaplexData = useMetaplexData(solanaAddresses);
|
||||
const terraMetadata = useTerraMetadata(terraAddresses);
|
||||
const terraMetadata = useTerraMetadata(
|
||||
terraAddresses,
|
||||
chainId as TerraChainId
|
||||
);
|
||||
const ethMetadata = useEvmMetadata(ethereumAddresses, chainId);
|
||||
const algoMetadata = useAlgoMetadata(algoAddresses);
|
||||
|
||||
|
@ -171,8 +180,13 @@ export default function useMetadata(
|
|||
? constructSolanaMetadata(solanaAddresses, solanaTokenMap, metaplexData)
|
||||
: isEVMChain(chainId)
|
||||
? constructEthMetadata(ethereumAddresses, ethMetadata)
|
||||
: chainId === CHAIN_ID_TERRA
|
||||
? constructTerraMetadata(terraAddresses, terraTokenMap, terraMetadata)
|
||||
: isTerraChain(chainId)
|
||||
? constructTerraMetadata(
|
||||
terraAddresses,
|
||||
terraTokenMap,
|
||||
terraMetadata,
|
||||
chainId
|
||||
)
|
||||
: chainId === CHAIN_ID_ALGORAND
|
||||
? constructAlgoMetadata(algoAddresses, algoMetadata)
|
||||
: getEmptyDataWrapper(),
|
||||
|
|
|
@ -2,13 +2,13 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
getOriginalAssetAlgorand,
|
||||
getOriginalAssetCosmWasm,
|
||||
getOriginalAssetEth,
|
||||
getOriginalAssetSol,
|
||||
getOriginalAssetTerra,
|
||||
hexToNativeAssetString,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
uint8ArrayToHex,
|
||||
uint8ArrayToNative,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
@ -32,12 +32,12 @@ import {
|
|||
ALGORAND_HOST,
|
||||
ALGORAND_TOKEN_BRIDGE_ID,
|
||||
getNFTBridgeAddressForChain,
|
||||
getTerraConfig,
|
||||
getTokenBridgeAddressForChain,
|
||||
SOLANA_HOST,
|
||||
SOLANA_SYSTEM_PROGRAM_ADDRESS,
|
||||
SOL_NFT_BRIDGE_ADDRESS,
|
||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_HOST,
|
||||
} from "../utils/consts";
|
||||
import useIsWalletReady from "./useIsWalletReady";
|
||||
|
||||
|
@ -68,9 +68,13 @@ export async function getOriginalAssetToken(
|
|||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
foreignNativeStringAddress
|
||||
);
|
||||
} else if (foreignChain === CHAIN_ID_TERRA) {
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
promise = await getOriginalAssetTerra(lcd, foreignNativeStringAddress);
|
||||
} else if (isTerraChain(foreignChain)) {
|
||||
const lcd = new LCDClient(getTerraConfig(foreignChain));
|
||||
promise = await getOriginalAssetCosmWasm(
|
||||
lcd,
|
||||
foreignNativeStringAddress,
|
||||
foreignChain
|
||||
);
|
||||
} else if (foreignChain === CHAIN_ID_ALGORAND) {
|
||||
const algodClient = new Algodv2(
|
||||
ALGORAND_HOST.algodToken,
|
||||
|
@ -224,6 +228,7 @@ function useOriginalAsset(
|
|||
if (!cancelled) {
|
||||
setIsLoading(false);
|
||||
setArgs();
|
||||
console.log("setting", result.assetAddress);
|
||||
setOriginAddress(
|
||||
hexToNativeAssetString(
|
||||
uint8ArrayToHex(result.assetAddress),
|
||||
|
|
|
@ -2,8 +2,8 @@ import {
|
|||
canonicalAddress,
|
||||
CHAIN_ID_ALGORAND,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
uint8ArrayToHex,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { arrayify, zeroPad } from "@ethersproject/bytes";
|
||||
|
@ -99,7 +99,7 @@ function useSyncTargetAddress(shouldFire: boolean, nft?: boolean) {
|
|||
}
|
||||
})();
|
||||
} else if (
|
||||
targetChain === CHAIN_ID_TERRA &&
|
||||
isTerraChain(targetChain) &&
|
||||
terraWallet &&
|
||||
terraWallet.walletAddress
|
||||
) {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { TerraChainId } from "@certusone/wormhole-sdk";
|
||||
import { LCDClient } from "@terra-money/terra.js";
|
||||
import { useLayoutEffect, useMemo, useState } from "react";
|
||||
import { DataWrapper } from "../store/helpers";
|
||||
import { TERRA_HOST } from "../utils/consts";
|
||||
import { getTerraConfig } from "../utils/consts";
|
||||
|
||||
export type TerraMetadata = {
|
||||
symbol?: string;
|
||||
|
@ -24,8 +25,8 @@ const fetchSingleMetadata = async (address: string, lcd: LCDClient) =>
|
|||
} as TerraMetadata)
|
||||
);
|
||||
|
||||
const fetchTerraMetadata = async (addresses: string[]) => {
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
const fetchTerraMetadata = async (addresses: string[], chainId: TerraChainId) => {
|
||||
const lcd = new LCDClient(getTerraConfig(chainId));
|
||||
const promises: Promise<TerraMetadata>[] = [];
|
||||
addresses.forEach((address) => {
|
||||
promises.push(fetchSingleMetadata(address, lcd));
|
||||
|
@ -40,7 +41,8 @@ const fetchTerraMetadata = async (addresses: string[]) => {
|
|||
};
|
||||
|
||||
const useTerraMetadata = (
|
||||
addresses: string[]
|
||||
addresses: string[],
|
||||
chainId: TerraChainId
|
||||
): DataWrapper<Map<string, TerraMetadata>> => {
|
||||
const [isFetching, setIsFetching] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
|
@ -52,7 +54,7 @@ const useTerraMetadata = (
|
|||
setIsFetching(true);
|
||||
setError("");
|
||||
setData(null);
|
||||
fetchTerraMetadata(addresses).then(
|
||||
fetchTerraMetadata(addresses, chainId).then(
|
||||
(results) => {
|
||||
if (!cancelled) {
|
||||
setData(results);
|
||||
|
@ -70,7 +72,7 @@ const useTerraMetadata = (
|
|||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [addresses]);
|
||||
}, [addresses, chainId]);
|
||||
|
||||
return useMemo(
|
||||
() => ({
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import { TerraChainId } from "@certusone/wormhole-sdk";
|
||||
import { LCDClient } from "@terra-money/terra.js";
|
||||
import { MutableRefObject, useEffect, useMemo, useState } from "react";
|
||||
import { TERRA_HOST } from "../utils/consts";
|
||||
import { getTerraConfig } from "../utils/consts";
|
||||
|
||||
export interface TerraNativeBalances {
|
||||
[index: string]: string;
|
||||
}
|
||||
|
||||
export default function useTerraNativeBalances(
|
||||
chainId: TerraChainId,
|
||||
walletAddress?: string,
|
||||
refreshRef?: MutableRefObject<() => void>
|
||||
) {
|
||||
|
@ -25,7 +27,8 @@ export default function useTerraNativeBalances(
|
|||
if (walletAddress) {
|
||||
setIsLoading(true);
|
||||
setBalances(undefined);
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
const lcd = new LCDClient(getTerraConfig(chainId));
|
||||
console.log(lcd);
|
||||
lcd.bank
|
||||
.balance(walletAddress)
|
||||
.then(([coins]) => {
|
||||
|
@ -49,7 +52,7 @@ export default function useTerraNativeBalances(
|
|||
setIsLoading(false);
|
||||
setBalances(undefined);
|
||||
}
|
||||
}, [walletAddress, refresh]);
|
||||
}, [walletAddress, refresh, chainId]);
|
||||
const value = useMemo(() => ({ isLoading, balances }), [isLoading, balances]);
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@ export type TerraTokenMap = {
|
|||
mainnet: {
|
||||
[address: string]: TerraTokenMetadata;
|
||||
};
|
||||
classic: {
|
||||
[address: string]: TerraTokenMetadata;
|
||||
}
|
||||
};
|
||||
|
||||
const useTerraTokenMap = (shouldFire: boolean): DataWrapper<TerraTokenMap> => {
|
||||
|
|
|
@ -3,6 +3,8 @@ import {
|
|||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
TerraChainId,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Provider } from "@ethersproject/abstract-provider";
|
||||
import { formatUnits } from "@ethersproject/units";
|
||||
|
@ -14,7 +16,7 @@ import { useEthereumProvider } from "../contexts/EthereumProviderContext";
|
|||
import {
|
||||
getDefaultNativeCurrencySymbol,
|
||||
SOLANA_HOST,
|
||||
TERRA_HOST,
|
||||
getTerraConfig,
|
||||
} from "../utils/consts";
|
||||
import { getMultipleAccountsRPC } from "../utils/solana";
|
||||
import { NATIVE_TERRA_DECIMALS } from "../utils/terra";
|
||||
|
@ -104,10 +106,14 @@ const getBalanceEvm = async (walletAddress: string, provider: Provider) => {
|
|||
return provider.getBalance(walletAddress).then((result) => result.toBigInt());
|
||||
};
|
||||
|
||||
const getBalancesTerra = async (walletAddress: string) => {
|
||||
const getBalancesTerra = async (
|
||||
walletAddress: string,
|
||||
chainId: TerraChainId
|
||||
) => {
|
||||
// TODO: need to change for terra2?
|
||||
const TARGET_DENOMS = ["uluna", "uusd"];
|
||||
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
const lcd = new LCDClient(getTerraConfig(chainId));
|
||||
return lcd.bank
|
||||
.balance(walletAddress)
|
||||
.then(([coins]) => {
|
||||
|
@ -139,8 +145,8 @@ const toBalanceString = (balance: bigint | undefined, chainId: ChainId) => {
|
|||
if (isEVMChain(chainId)) {
|
||||
return formatUnits(balance, 18); //wei decimals
|
||||
} else if (chainId === CHAIN_ID_SOLANA) {
|
||||
return formatUnits(balance, 9); //lamports to sol decmals
|
||||
} else if (chainId === CHAIN_ID_TERRA) {
|
||||
return formatUnits(balance, 9); //lamports to sol decimals
|
||||
} else if (isTerraChain(chainId)) {
|
||||
return formatUnits(balance, NATIVE_TERRA_DECIMALS);
|
||||
}
|
||||
};
|
||||
|
@ -190,9 +196,9 @@ export default function useTransactionFees(chainId: ChainId) {
|
|||
}
|
||||
);
|
||||
}
|
||||
} else if (chainId === CHAIN_ID_TERRA && isReady && walletAddress) {
|
||||
} else if (isTerraChain(chainId) && isReady && walletAddress) {
|
||||
loadStart();
|
||||
getBalancesTerra(walletAddress).then(
|
||||
getBalancesTerra(walletAddress, chainId).then(
|
||||
(results) => {
|
||||
const adjustedResults = results.map(({ denom, balance }) => {
|
||||
return {
|
||||
|
@ -214,10 +220,9 @@ export default function useTransactionFees(chainId: ChainId) {
|
|||
|
||||
const results = useMemo(() => {
|
||||
return {
|
||||
isSufficientBalance:
|
||||
chainId === CHAIN_ID_TERRA
|
||||
? isSufficientBalanceTerra(terraBalances)
|
||||
: isSufficientBalance(chainId, balance),
|
||||
isSufficientBalance: isTerraChain(chainId)
|
||||
? isSufficientBalanceTerra(terraBalances)
|
||||
: isSufficientBalance(chainId, balance),
|
||||
balance,
|
||||
balanceString: toBalanceString(balance, chainId),
|
||||
isLoading,
|
||||
|
@ -362,6 +367,7 @@ export async function getGasEstimates(
|
|||
return output;
|
||||
}
|
||||
|
||||
// TODO: terra 2 support
|
||||
function TerraGasEstimateSummary({ methodType }: { methodType: MethodType }) {
|
||||
if (methodType === "transfer") {
|
||||
const lowEstimate = formatUnits(
|
||||
|
@ -410,7 +416,7 @@ export function GasEstimateSummary({
|
|||
priceQuote={priceQuote}
|
||||
/>
|
||||
);
|
||||
} else if (chainId === CHAIN_ID_TERRA) {
|
||||
} else if (chainId === CHAIN_ID_TERRA) { // TODO: terra2 support
|
||||
return <TerraGasEstimateSummary methodType={methodType} />;
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 52 49"><defs><linearGradient id="ebbb6cda-0389-45d8-bb1c-376d5bf36abc" x1="35.55" y1="48.97" x2="35.55" y2="24.51" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#4366c2"/><stop offset="0.15" stop-color="#3458b8"/><stop offset="0.4" stop-color="#2348ac"/><stop offset="0.67" stop-color="#193fa5"/><stop offset="1" stop-color="#163ca3"/></linearGradient><linearGradient id="f31efcdf-db45-41d1-9fdf-f0c98c440807" x1="28.73" y1="22.86" x2="28.73" y2="0" xlink:href="#ebbb6cda-0389-45d8-bb1c-376d5bf36abc"/><linearGradient id="fccc71bd-5025-4d54-b43c-83ee4283abe6" x1="2.68" y1="8.02" x2="19.28" y2="8.02" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#58c66b"/><stop offset="1" stop-color="#5491f6"/></linearGradient><linearGradient id="f353812a-3fef-4520-a39f-fc15f94407a0" x1="0" y1="32.68" x2="16.02" y2="32.68" xlink:href="#fccc71bd-5025-4d54-b43c-83ee4283abe6"/><linearGradient id="ae916250-479e-4f6a-ba90-eed93ba23120" x1="14.03" y1="20.12" x2="52" y2="20.12" xlink:href="#fccc71bd-5025-4d54-b43c-83ee4283abe6"/><linearGradient id="abdf6be7-d18d-4907-97fe-9b3e82537090" x1="33.83" y1="43.42" x2="48.69" y2="43.42" xlink:href="#fccc71bd-5025-4d54-b43c-83ee4283abe6"/></defs><g id="ae6f7ef0-565d-4a22-8f2c-325befffa09b" data-name="Layer 2"><g id="bcd3e4b3-41de-4e5f-b039-dc1868c624a4" data-name="Layer 6"><path d="M22.36,39.82c1.43,5.28,6.54,9.31,9.12,9.15.09,0,9.79-1.82,15.1-10.71,4.13-6.92,2.73-13.6-2.89-13.75-2,.15-24,5.25-21.33,15.31" fill="url(#ebbb6cda-0389-45d8-bb1c-376d5bf36abc)"/><path d="M43.16,5.9h0a24.63,24.63,0,0,0-26-3.76,14.3,14.3,0,0,0-1.57.77c-.34.18-.69.37-1,.57l.09,0A11.17,11.17,0,0,0,12.05,6C5,15.33,28.7,22.15,41.39,22.17,47.23,26.37,48.87,10.35,43.16,5.9Z" fill="url(#f31efcdf-db45-41d1-9fdf-f0c98c440807)"/><path d="M18.6,6.09C15.34,11,4.48,14.46,2.69,13.92v0l.22-.45A26.58,26.58,0,0,1,5,10,26.57,26.57,0,0,1,10.65,4.4,23.91,23.91,0,0,1,12.72,3a7.6,7.6,0,0,1,3.59-1c4.84.09,2.31,4,2.29,4" fill="url(#fccc71bd-5025-4d54-b43c-83ee4283abe6)"/><path d="M15.92,40.79c.24,1.54,0,7.63-.32,8.15-.27,0-.83.05-2.47-.87a24,24,0,0,1-2.48-1.62,26,26,0,0,1-3-2.6,25.13,25.13,0,0,1-2.6-3,25.44,25.44,0,0,1-3.69-7.15,25.27,25.27,0,0,1-1-4,26.42,26.42,0,0,1,0-8.45,25.81,25.81,0,0,1,1-4q.12-.39.27-.78h0c1.87,2.5,4,4.76,5.89,7.28s4.17,6.32,4.66,7.16c3,5.19,3.54,8.4,3.77,9.94" fill="url(#f353812a-3fef-4520-a39f-fc15f94407a0)"/><path d="M52,25.43A26.06,26.06,0,0,1,50.19,35c-3.06,3.29-23.71-4.82-23.91-4.91-2.83-1.24-11.42-5-12.2-10.94C13,10.62,30.23,4.68,37.82,4.45c.91,0,3.68,0,5.29,1.36A26,26,0,0,1,52,25.43" fill="url(#ae916250-479e-4f6a-ba90-eed93ba23120)"/><path d="M38,48.53c-2.25,1.06-4.73.29-4.08-1.91,1.23-4.21,12-8.54,14.41-8.77.29,0,.42.17.29.4A26.34,26.34,0,0,1,38,48.53" fill="url(#abdf6be7-d18d-4907-97fe-9b3e82537090)"/></g></g></svg>
|
After Width: | Height: | Size: 2.8 KiB |
|
@ -16,8 +16,11 @@ import {
|
|||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
CHAIN_ID_TERRA2,
|
||||
CONTRACTS,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
TerraChainId,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { clusterApiUrl } from "@solana/web3.js";
|
||||
import { getAddress } from "ethers/lib/utils";
|
||||
|
@ -37,6 +40,7 @@ import oasisIcon from "../icons/oasis-network-rose-logo.svg";
|
|||
import polygonIcon from "../icons/polygon.svg";
|
||||
import solanaIcon from "../icons/solana.svg";
|
||||
import terraIcon from "../icons/terra.svg";
|
||||
import terra2Icon from "../icons/terra2.svg";
|
||||
|
||||
export type Cluster = "devnet" | "testnet" | "mainnet";
|
||||
export const CLUSTER: Cluster =
|
||||
|
@ -201,6 +205,11 @@ export const CHAINS: ChainInfo[] =
|
|||
name: "Terra Classic",
|
||||
logo: terraIcon,
|
||||
},
|
||||
{
|
||||
id: CHAIN_ID_TERRA2,
|
||||
name: "Terra",
|
||||
logo: terra2Icon,
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
|
@ -228,6 +237,11 @@ export const CHAINS: ChainInfo[] =
|
|||
name: "Terra Classic",
|
||||
logo: terraIcon,
|
||||
},
|
||||
{
|
||||
id: CHAIN_ID_TERRA2,
|
||||
name: "Terra",
|
||||
logo: terra2Icon,
|
||||
},
|
||||
];
|
||||
export const BETA_CHAINS: ChainId[] =
|
||||
CLUSTER === "mainnet" ? [CHAIN_ID_ACALA, CHAIN_ID_KLAYTN] : [];
|
||||
|
@ -264,6 +278,8 @@ export const getDefaultNativeCurrencySymbol = (chainId: ChainId) =>
|
|||
? "BNB"
|
||||
: chainId === CHAIN_ID_TERRA
|
||||
? "LUNC"
|
||||
: chainId === CHAIN_ID_TERRA2
|
||||
? "LUNA"
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? "MATIC"
|
||||
: chainId === CHAIN_ID_AVAX
|
||||
|
@ -323,7 +339,7 @@ export const getExplorerName = (chainId: ChainId) =>
|
|||
? "Etherscan"
|
||||
: chainId === CHAIN_ID_BSC
|
||||
? "BscScan"
|
||||
: chainId === CHAIN_ID_TERRA
|
||||
: isTerraChain(chainId)
|
||||
? "Finder"
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? "Polygonscan"
|
||||
|
@ -417,24 +433,39 @@ export const SOLANA_HOST = process.env.REACT_APP_SOLANA_API_URL
|
|||
? clusterApiUrl("devnet")
|
||||
: "http://localhost:8899";
|
||||
|
||||
export const TERRA_HOST =
|
||||
CLUSTER === "mainnet"
|
||||
export const getTerraConfig = (chainId: TerraChainId) => {
|
||||
const isClassic = chainId === CHAIN_ID_TERRA;
|
||||
return CLUSTER === "mainnet"
|
||||
? {
|
||||
URL: "https://lcd.terra.dev",
|
||||
chainID: "columbus-5",
|
||||
URL:
|
||||
chainId === CHAIN_ID_TERRA2
|
||||
? "https://phoenix-lcd.terra.dev"
|
||||
: "https://columbus-lcd.terra.dev",
|
||||
chainID: chainId === CHAIN_ID_TERRA2 ? "phoenix-1" : "columbus-5",
|
||||
name: "mainnet",
|
||||
isClassic,
|
||||
}
|
||||
: CLUSTER === "testnet"
|
||||
? {
|
||||
URL: "https://bombay-lcd.terra.dev",
|
||||
chainID: "bombay-12",
|
||||
URL:
|
||||
chainId === CHAIN_ID_TERRA2
|
||||
? "https://pisco-lcd.terra.dev"
|
||||
: "https://bombay-lcd.terra.dev",
|
||||
chainID: chainId === CHAIN_ID_TERRA2 ? "pisco-1" : "bombay-12",
|
||||
name: "testnet",
|
||||
isClassic,
|
||||
}
|
||||
: {
|
||||
URL: "http://localhost:1317",
|
||||
chainID: "columbus-5",
|
||||
URL:
|
||||
chainId === CHAIN_ID_TERRA2
|
||||
? "http://localhost:1318"
|
||||
: "http://localhost:1317",
|
||||
chainID: chainId === CHAIN_ID_TERRA2 ? "phoenix-1" : "columbus-5",
|
||||
name: "localterra",
|
||||
isClassic,
|
||||
};
|
||||
};
|
||||
|
||||
export const ALGORAND_HOST =
|
||||
CLUSTER === "mainnet"
|
||||
? {
|
||||
|
@ -776,6 +807,18 @@ export const TERRA_TOKEN_BRIDGE_ADDRESS =
|
|||
: CLUSTER === "testnet"
|
||||
? "terra1pseddrv0yfsn76u4zxrjmtf45kdlmalswdv39a"
|
||||
: "terra10pyejy66429refv3g35g2t7am0was7ya7kz2a4";
|
||||
export const TERRA2_BRIDGE_ADDRESS =
|
||||
CLUSTER === "mainnet"
|
||||
? ""
|
||||
: CLUSTER === "testnet"
|
||||
? ""
|
||||
: "terra14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9ssrc8au";
|
||||
export const TERRA2_TOKEN_BRIDGE_ADDRESS =
|
||||
CLUSTER === "mainnet"
|
||||
? ""
|
||||
: CLUSTER === "testnet"
|
||||
? ""
|
||||
: "terra1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrquka9l6";
|
||||
export const ALGORAND_BRIDGE_ID = BigInt(
|
||||
CLUSTER === "mainnet" ? "0" : CLUSTER === "testnet" ? "86525623" : "4"
|
||||
);
|
||||
|
@ -794,6 +837,8 @@ export const getBridgeAddressForChain = (chainId: ChainId) =>
|
|||
? BSC_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_TERRA
|
||||
? TERRA_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_TERRA2
|
||||
? TERRA2_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? POLYGON_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
|
@ -856,6 +901,8 @@ export const getTokenBridgeAddressForChain = (chainId: ChainId) =>
|
|||
? BSC_TOKEN_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_TERRA
|
||||
? TERRA_TOKEN_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_TERRA2
|
||||
? TERRA2_TOKEN_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? POLYGON_TOKEN_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
|
@ -1324,13 +1371,20 @@ export const getMigrationAssetMap = (chainId: ChainId) => {
|
|||
export const SUPPORTED_TERRA_TOKENS = ["uluna", "uusd"];
|
||||
export const TERRA_DEFAULT_FEE_DENOM = SUPPORTED_TERRA_TOKENS[0];
|
||||
|
||||
export const TERRA_FCD_BASE =
|
||||
export const getTerraFCDBaseUrl = (chainId: TerraChainId) =>
|
||||
CLUSTER === "mainnet"
|
||||
? "https://fcd.terra.dev"
|
||||
? chainId === CHAIN_ID_TERRA2
|
||||
? "https://phoenix-fcd.terra.dev"
|
||||
: "https://columbus-fcd.terra.dev"
|
||||
: CLUSTER === "testnet"
|
||||
? "https://bombay-fcd.terra.dev"
|
||||
? chainId === CHAIN_ID_TERRA2
|
||||
? "https://pisco-fcd.terra.dev"
|
||||
: "https://bombay-fcd.terra.dev"
|
||||
: chainId === CHAIN_ID_TERRA2
|
||||
? "http://localhost:3061"
|
||||
: "http://localhost:3060";
|
||||
export const TERRA_GAS_PRICES_URL = `${TERRA_FCD_BASE}/v1/txs/gas_prices`;
|
||||
export const getTerraGasPricesUrl = (chainId: TerraChainId) =>
|
||||
`${getTerraFCDBaseUrl(chainId)}/v1/txs/gas_prices`;
|
||||
|
||||
export const TOTAL_TRANSACTIONS_WORMHOLE = `https://europe-west3-wormhole-315720.cloudfunctions.net/mainnet-totals?groupBy=address`;
|
||||
|
||||
|
@ -1415,7 +1469,7 @@ export const logoOverrides = new Map<string, string>([
|
|||
export const getHowToAddTokensToWalletUrl = (chainId: ChainId) => {
|
||||
if (isEVMChain(chainId)) {
|
||||
return "https://docs.wormholenetwork.com/wormhole/video-tutorial-how-to-manually-add-tokens-to-your-wallet#1.-metamask-ethereum-polygon-and-bsc";
|
||||
} else if (chainId === CHAIN_ID_TERRA) {
|
||||
} else if (isTerraChain(chainId)) {
|
||||
return "https://docs.wormholenetwork.com/wormhole/video-tutorial-how-to-manually-add-tokens-to-your-wallet#2.-terra-station";
|
||||
}
|
||||
return "";
|
||||
|
@ -1424,7 +1478,7 @@ export const getHowToAddTokensToWalletUrl = (chainId: ChainId) => {
|
|||
export const getHowToAddToTokenListUrl = (chainId: ChainId) => {
|
||||
if (chainId === CHAIN_ID_SOLANA) {
|
||||
return "https://github.com/solana-labs/token-list";
|
||||
} else if (chainId === CHAIN_ID_TERRA) {
|
||||
} else if (isTerraChain(chainId)) {
|
||||
return "https://github.com/terra-money/assets";
|
||||
}
|
||||
return "";
|
||||
|
|
|
@ -1,29 +1,42 @@
|
|||
import {
|
||||
canonicalAddress,
|
||||
CHAIN_ID_TERRA2,
|
||||
isNativeDenom,
|
||||
isNativeTerra,
|
||||
TerraChainId,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { formatUnits } from "@ethersproject/units";
|
||||
import { LCDClient, isTxError } from "@terra-money/terra.js";
|
||||
import { ConnectedWallet, TxResult } from "@terra-money/wallet-provider";
|
||||
import axios from "axios";
|
||||
// import { TerraTokenMetadata } from "../hooks/useTerraTokenMap";
|
||||
import { TERRA_GAS_PRICES_URL, TERRA_HOST } from "./consts";
|
||||
import { getTerraGasPricesUrl, getTerraConfig } from "./consts";
|
||||
|
||||
export const NATIVE_TERRA_DECIMALS = 6;
|
||||
export const LUNA_CLASSIC_SYMBOL = "LUNC"
|
||||
export const LUNA_SYMBOL = "LUNA";
|
||||
export const LUNA_CLASSIC_SYMBOL = "LUNC";
|
||||
|
||||
export const getNativeTerraIcon = (symbol = "") =>
|
||||
`https://assets.terra.money/icon/60/${
|
||||
symbol === LUNA_CLASSIC_SYMBOL ? "Luna" : symbol.slice(0, symbol.length - 1)
|
||||
}.png`;
|
||||
export const getNativeTerraIcon = (symbol: string) =>
|
||||
symbol === LUNA_SYMBOL
|
||||
? `https://assets.terra.money/icon/svg/LUNA.png`
|
||||
: symbol === LUNA_CLASSIC_SYMBOL
|
||||
? `https://assets.terra.money/icon/svg/LUNC.svg`
|
||||
: `https://assets.terra.money/icon/60/${symbol.slice(
|
||||
0,
|
||||
symbol.length - 1
|
||||
)}.png`;
|
||||
|
||||
// inspired by https://github.com/terra-money/station/blob/dca7de43958ce075c6e46605622203b9859b0e14/src/lib/utils/format.ts#L38
|
||||
export const formatNativeDenom = (denom = ""): string => {
|
||||
export const formatNativeDenom = (
|
||||
denom: string,
|
||||
chainId: TerraChainId
|
||||
): string => {
|
||||
console.log(denom, chainId);
|
||||
const unit = denom.slice(1).toUpperCase();
|
||||
const isValidTerra = isNativeTerra(denom);
|
||||
return denom === "uluna"
|
||||
? LUNA_CLASSIC_SYMBOL
|
||||
? chainId === CHAIN_ID_TERRA2
|
||||
? LUNA_SYMBOL
|
||||
: LUNA_CLASSIC_SYMBOL
|
||||
: isValidTerra
|
||||
? unit.slice(0, 2) + "TC"
|
||||
: "";
|
||||
|
@ -32,8 +45,11 @@ export const formatNativeDenom = (denom = ""): string => {
|
|||
export const formatTerraNativeBalance = (balance = ""): string =>
|
||||
formatUnits(balance, 6);
|
||||
|
||||
export async function waitForTerraExecution(transaction: TxResult) {
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
export async function waitForTerraExecution(
|
||||
transaction: TxResult,
|
||||
chainId: TerraChainId
|
||||
) {
|
||||
const lcd = new LCDClient(getTerraConfig(chainId));
|
||||
let info;
|
||||
while (!info) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
|
@ -51,15 +67,16 @@ export async function waitForTerraExecution(transaction: TxResult) {
|
|||
return info;
|
||||
}
|
||||
|
||||
export const isValidTerraAddress = (address: string) => {
|
||||
export const isValidTerraAddress = (address: string, chainId: TerraChainId) => {
|
||||
if (isNativeDenom(address)) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
const startsWithTerra = address && address.startsWith("terra");
|
||||
const isParseable = canonicalAddress(address);
|
||||
const isLength20 = isParseable.length === 20;
|
||||
return !!(startsWithTerra && isParseable && isLength20);
|
||||
const isLengthOk =
|
||||
isParseable.length === (chainId === CHAIN_ID_TERRA2 ? 32 : 20);
|
||||
return !!(startsWithTerra && isParseable && isLengthOk);
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
|
@ -69,14 +86,14 @@ export async function postWithFees(
|
|||
wallet: ConnectedWallet,
|
||||
msgs: any[],
|
||||
memo: string,
|
||||
feeDenoms: string[]
|
||||
feeDenoms: string[],
|
||||
chainId: TerraChainId
|
||||
) {
|
||||
// don't try/catch, let errors propagate
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
//let gasPrices = await lcd.config.gasPrices //Unsure if the values returned from this are hardcoded or not.
|
||||
const lcd = new LCDClient(getTerraConfig(chainId));
|
||||
//Thus, we are going to pull it directly from the current FCD.
|
||||
const gasPrices = await axios
|
||||
.get(TERRA_GAS_PRICES_URL)
|
||||
.get(getTerraGasPricesUrl(chainId))
|
||||
.then((result) => result.data);
|
||||
|
||||
const account = await lcd.auth.accountInfo(wallet.walletAddress);
|
||||
|
@ -102,6 +119,8 @@ export async function postWithFees(
|
|||
feeDenoms,
|
||||
gasPrices,
|
||||
fee: feeEstimate,
|
||||
// @ts-ignore, https://github.com/terra-money/terra.js/pull/295 (adding isClassic property)
|
||||
isClassic: lcd.config.isClassic,
|
||||
});
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue