diff --git a/.env b/.env deleted file mode 100644 index de4a787..0000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -NEXT_PUBLIC_MIXPANEL_TOKEN=acbafd21a85654933cbb0332c5a6f4f8 \ No newline at end of file diff --git a/.env.mainnet b/.env.mainnet new file mode 100644 index 0000000..e114b71 --- /dev/null +++ b/.env.mainnet @@ -0,0 +1,2 @@ +NEXT_PUBLIC_MIXPANEL_TOKEN=acbafd21a85654933cbb0332c5a6f4f8 +NEXT_PUBLIC_ENV=mainnet \ No newline at end of file diff --git a/.env.staging b/.env.staging new file mode 100644 index 0000000..ce280f8 --- /dev/null +++ b/.env.staging @@ -0,0 +1,2 @@ +NEXT_PUBLIC_MIXPANEL_TOKEN='' +NEXT_PUBLIC_ENV='staging diff --git a/.firebase/hosting.b3V0.cache b/.firebase/hosting.b3V0.cache index a9d0101..7bb0fdc 100644 --- a/.firebase/hosting.b3V0.cache +++ b/.firebase/hosting.b3V0.cache @@ -1,72 +1,75 @@ -index.txt,1721095227245,cb643953319a70da914dc2544fb7130e70b48cbcd8c2e2e553f20e53c83c8db6 -manifest.json,1721095226414,da4686bdc9d4cb95d20e4aaae5e4f42a6b93e0b1822f2c53051e315082174ff7 -next.svg,1721095226414,7b16665552cb47db34db342505d6d340caaf5813ca2cba1df3536ed67ea33f64 -vercel.svg,1721095226414,ddb9254655f2b7733e1193fb66cb4beb95c29ad752d7adbc1765026e124c88c5 -404.html,1721095226672,463395b55ccf2cbf10269352947e8bc0840e7374f686b9616d7234e73c54a479 -favicon.ico,1721095227242,8b9c4dce3353938d2027ab21f0489807587db05d65ef390a6947d32312e501a0 -_next/static/chunks/414-4c9c1149028c11dc.js,1721095226342,9264fbf9abdaa05569ac4ebefdc634e9310ed0b485e968d6eb51b2008d48b1c1 -_next/static/chunks/5ebe7343-caf47bdfaad09e53.js,1721095226358,d604e3d94ebcb03c4be8c85808548c9b9be6f7ae073aed867df87a36ad1a81ba -_next/static/chunks/73051b74-57b8e75d8c835101.js,1721095226380,b98e7a0a1aabab4937b93ddee11f8e107d39c924f2ea7d924b6d7e9be80f956b -_next/static/chunks/a789148f-da16a14970d9289f.js,1721095226382,98fbc97242a43b2e9feadd63e52e89816bcd36629dd72a3139140bae33bfde1a -_next/static/chunks/webpack-477ab686726e0719.js,1721095226394,deb855cedcb6fcf702c0d922c3471c3e298cda5c64ee182eae4ff45c57721b76 -_next/static/chunks/main-app-8d0803cc903eaf67.js,1721095226394,faaaa1facc808ad6fe3f630425dc54966ce963f97928aedd692aea1e70ce58b0 -_next/static/chunks/pages/_app-037b5d058bd9a820.js,1721095226410,06e750a0ef670f4de0c1bd480b5011b19558d8742f9b03ec7109bdceae9c7931 -_next/static/chunks/app/layout-053045a2a10a42e0.js,1721095226410,26fd03ed4ec61de8d1cbc8d9e125e29c91cdd9e1efc7d8dfb49663c038671527 -_next/static/chunks/app/page-321edac3875a8d9a.js,1721095226410,ac8d57d06b615139094c1197214b90a683558a73eb4bea8ad6e75d56a9719489 -_next/static/chunks/app/_not-found/page-db398e8f370a6a8a.js,1721095226411,1171f0e15906679f83ff16a00aebf616427794097d3bcdd959a98e3dee9c920d -_next/static/chunks/pages/_error-6ae619510b1539d6.js,1721095226411,e73729a247fbd5cf1acddc0c6f67271a511c97ca0b0068e42447d5f5e996ecf7 -_next/static/css/728e911c774fb330.css,1721095226332,476a417e76b4176343fa0827c476a96c3271978b74f71ed4cd8752c0f9f1353d -_next/static/css/bd178e3e1681a88b.css,1721095226333,07265208435c02c2d010d3254da3c8e9f94621f97f5de95f989481da246342de -_next/static/media/09b62d668edb05d1-s.woff2,1721095226395,0d8d858fc39ace004d9718f4b2cc3cc5ba1b51ce80283319e5840359ba8a095e -_next/static/media/08404bcfb1dae67a-s.woff2,1721095226395,c001cee57902015c0205bcb5fdb67c6d6c8521e2314b7151f587b60c096f762a -_next/static/media/10446295ae7f2657-s.p.woff2,1721095226396,9e392e2c201242111c40f44fd3cf98f9f886f0a48aa67729433b5348a46c081a -_next/static/css/130db2bf77dc9517.css,1721095226335,2268ae22418e82f1572fa51b1174f62f7134760074b385486b7d437b73cf482a -_next/static/media/28cea0425961ab58-s.woff2,1721095226396,4951ba771fda774b8ddf0e6de43e4d52d48dd21f43f31e127b784d9b32f697c5 -_next/static/media/4184cf5f191b83db-s.woff2,1721095226396,42cc1534616d0d7475d5dd69f80e235dc7bb01906e964859d6cd5f02a5df4a0d -_next/static/media/0148c4ca3456ea72-s.woff2,1721095226395,59a0565b210eef8ed29034d845b2ee1ba5cd59866474b3aa01f7db8d95a28f36 -index.html,1721095227242,e7e960d599b15ba372587c816e66409732806b4f962c19bdbc5fb0a92807b9b2 -_next/static/chunks/34318fad-6940cb9b00d9ec04.js,1721095226344,e4bd873c3e839214528f30cd45a7b94691472e6770b574cc445fe97e57903433 -_next/static/chunks/7de54f2b-f38dd21f308f095a.js,1721095226383,bbeea5f0f6405173d7cb47f92949abee4984e292a0347702c00de445bebf5364 -_next/static/chunks/77693919-cebae1edd1c23380.js,1721095226382,2ae6430ecd6ab2a3ab9c5dc51db5ae88293d755262d7c554907b8c384988bea5 -_next/static/chunks/bf66a46c-bffbcf136d36d450.js,1721095226387,d6ae37cfe006914e1ff646d74c1b211c972a49f4a897b0ce5ff1022a432ceb96 -_next/static/chunks/b24dba43-c1828973140465ca.js,1721095226386,10dc3fd04d30bc6846bcac3d50360134978087bf41815359c71cd742b2c19b2b -_next/static/chunks/fa5018ec-78e9fe2c4b84a7c6.js,1721095226389,5bbef06bb945ca21f3128885818ec6cfb95688ca7ddaf6e9116cb8d52c1e894d -_next/static/chunks/23-5ed42ec1a7af11d9.js,1721095226340,3b025f9ec1e1eb7c9e6e339b5e48fa9fb101e6a9a7d6575c8ca42f51371a881a -_next/static/chunks/e37a0b60-10ce622d242abd89.js,1721095226389,3aeede3359b5f9e65f35be68b45af612afef2de74c97bed36b797caa779cd89c -_next/static/chunks/e2b8353a-ec8c70c57efea465.js,1721095226388,a4b4595b6bc5e3e4a4d1761fcc7e2e07d13da9b8938f7ca4c60a70d0c2b97427 -_next/static/chunks/main-1df147dd59cf3b2d.js,1721095226391,62a303d8b4d1f4aca939a3c00f4b58313e8d8085bf62a67baa1f354fa5ebf51c -_next/static/chunks/polyfills-78c92fac7aa8fdd8.js,1721095226395,a5b39edcc77b6069d442b5dbeb8091cf27ac47ac7a1a99cfc325213bdaae2fb5 -_next/static/chunks/6ae44921-aa5a078730e4277a.js,1721095226382,0567967ca925ed2b7285d5f449c366d6530b5dc9e280002f3f049b3bd2f4f380 -_next/static/chunks/b60e3787-fc4eacbbb568cf06.js,1721095226385,aadf4477c67ed9d8eaa8fda2667d5cdf5f1c3611673842b9fe027ab8be1ceb98 -_next/static/media/60d74363e715829c-s.woff2,1721095226407,125670e96a055c483cd8ae99d2b7d9f42ee553980e503bebd246216700be0c2e -_next/static/media/67aea609c6135b3b-s.woff2,1721095226407,2b8cec2c1a1e7d525507ae409149838de23ef17791a5975ef17823acdd3b8292 -_next/static/media/791334aa8b2b679f-s.woff2,1721095226407,e3e0d9de68c137a784d6440591387a740bc61822f1c611cc6b752262af3c5b5f -_next/static/media/a2411df190893074-s.woff2,1721095226407,3889e1b1022f895d26f5a66307727d3a540a1baee80e4ab7a915996591f53279 -_next/static/media/6be22a85bef54f08-s.p.woff2,1721095226407,5c5d946ba95a9bf1245c9b029d8c0246c2f51810ff9af5500a1df4eefb231152 -_next/static/media/afba6ba6bf9157e8-s.woff2,1721095226407,9af676b26e2a20d39cca0eb8d744a73ce1ad21990a6b0f7142b178fb9bce41de -_next/static/media/9491f41002d34397-s.woff2,1721095226407,d03e57c0c741d253c56c8725e61e5fa46c63c862e48566443b3e81a5024cc4bc -_next/static/media/b4c759cba7a5f011-s.p.woff2,1721095226407,661284d73c9022c4572c75deb77a107f9028b1845f180c531ee761b2e15286a4 -_next/static/media/b6ecfd81ed9f83c9-s.woff2,1721095226408,a691b485e42759b1ac5c35fbb3d925ee91225675207daf33b8d83055fc87da7b -_next/static/media/bc381c5935034aa5-s.p.woff2,1721095226408,e1d80d0e85378fe151d9ea1fd59d4e0a68e1e49145f5beaafedd5e142a92c8ae -_next/static/media/be843c5b0882ad66-s.woff2,1721095226408,b8b72e338dd44b2202c32a3430e723e143e52945161b7fefb7fd80d44cd33717 -_next/static/media/d1f5f89450ecd78c-s.woff2,1721095226408,a23b70b8e1feb6ebcf7dd7e4d70b794013a517d34ba841e47dd3cdb25f7132ed -_next/static/media/de555e6bc944c11a-s.woff2,1721095226409,ba546fa6db5a3a4e952bda42f35cc18d83503369ff0d1a7a3564a79c7182429e -_next/static/media/eb37c9fe4776ea97-s.woff2,1721095226409,484b94a74f8c8c86204df2709680c545d5c9b2e7e6b07721c84bc1aa1f9f1d53 -_next/static/media/ebcf93a611f94ec0-s.woff2,1721095226409,63f304c1c7de937c992e410e3220d2d1e5c4d790046f87d2c73bfdf8ee742a33 -_next/static/media/ec50b434b597bc61-s.woff2,1721095226409,73bf33b4e0ed3afeb2024b3f0d38f31947d217a4615aa8d5737eb0755b00203d -_next/static/media/f565fad065ab4cf3-s.woff2,1721095226409,ce303c34757353648d0525e26ba4ae502e80adb0cf3343a51bad77f50631699e -_next/static/chunks/framework-00a8ba1a63cfdc9e.js,1721095226391,c2012692d29b99c17d95c52f9e0f321c0aa21c7e8bc5db5fae470ad7eda00549 -_next/static/media/ic_loading.e4395145.png,1721095226409,9b7256e6b358a939bb64061d797bfd3ed14246fcd171c849371fa2fbfa473e40 -_next/static/s7DHp2QM_i5fs2dar1yVg/_buildManifest.js,1721095226334,0474c56df53665d9f0c84e3ed67dea5b38f6e7ff31a982c3bbb5904e4771ee4b -_next/static/s7DHp2QM_i5fs2dar1yVg/_ssgManifest.js,1721095226333,02dbc1aeab6ef0a6ff2ff9a1643158cf9bb38929945eaa343a3627dee9ba6778 -_next/static/media/f9946f06d70a1b5b-s.woff2,1721095226409,fc86829e9a454dcde0481c74ed6c9b9d1a61798b59a0e0700fe510f9b5a38b41 -_next/static/chunks/fd9d1056-0f4f3ee949eb019b.js,1721095226391,25f5dce45252959ff01f83f2f702c7bc14ffac84dcf3e1efbb080e0a12474250 -_next/static/chunks/aaea2bcf-1841944f7315cd08.js,1721095226385,2b8f2d05d3fcc95b1cb7c43fc61140ec315d06a348514421fe90dad86b71e43c -_next/static/chunks/503-8500bc30d9730125.js,1721095226358,c372315565326304dc53f5dba0af025d7bafa6cf10ca1b344bea47c6a52f9a50 -_next/static/chunks/577-185540999740af23.js,1721095226376,2c0b96278296f30c651a806452cce92dd6ce41a96324674efb663e5e65e1b14b -_next/static/chunks/233658ae-8362a295114141c4.js,1721095226341,3fc2fc86d8f9b2488d21ecd9b7ba838e14e7d03046378081d7e67b97aff4f133 -_next/static/chunks/550ed063-14c8c0f849c3e9d8.js,1721095226376,0b6ef7fee4339790ece8adb95b60568e391c6e98ae69967a4a9b508cb4c21c2a -_next/static/chunks/209590b8-f6fe88c51d1ecbc2.js,1721095226343,7fcf6a574d723c7a5718a0052c2673684b8efd7cd34ef843b45328942a581f3d -_next/static/chunks/68b159eb-33fdf129f033d3d9.js,1721095226378,77e9651b5caed2b9e62c9991cffd497709794a7c5f497d78ce9bac028e42449f -_next/static/media/swapBg.ed3d662e.png,1721095226413,69b7d486b8a29fc10f6a29b199b974f28d1d7e6cbe52ee07c7ad19507427d154 -_next/static/chunks/335-c80513fd255f31b5.js,1721095226398,ecd844a0a72ecac3bd6b08d12e76aa047f95bfd72c5b84f57b07081d58f22a7e +404.html,1725527141231,915c93fe33030b59a8f26fa0325adc29893b36206975de2485bb144cdc19fe70 +manifest.json,1725527141118,9832df71323c11f1c3abfe2c63ee1b9206b6260b5dd5fa7ff5d18bc63f43cda2 +next.svg,1725527141118,7b16665552cb47db34db342505d6d340caaf5813ca2cba1df3536ed67ea33f64 +vercel.svg,1725527141118,ddb9254655f2b7733e1193fb66cb4beb95c29ad752d7adbc1765026e124c88c5 +index.txt,1725527141792,9609cc3670cca286b9ee0872116bbdbea3246221b044852ad6b36b4bf7eadf6e +index.html,1725527141790,d54e027c696d565ee296713f700d2550458e00ce2a0c3ca2314e38b8499f2ecb +favicon.png,1725527141119,cadc40eb2ffd087e8afb0559a43adf416ce669d3062ac7d138154869ee8d24ba +_next/static/chunks/5ebe7343-caf47bdfaad09e53.js,1725527141101,d604e3d94ebcb03c4be8c85808548c9b9be6f7ae073aed867df87a36ad1a81ba +_next/static/chunks/73051b74-57b8e75d8c835101.js,1725527141104,b98e7a0a1aabab4937b93ddee11f8e107d39c924f2ea7d924b6d7e9be80f956b +_next/static/chunks/a789148f-da16a14970d9289f.js,1725527141105,98fbc97242a43b2e9feadd63e52e89816bcd36629dd72a3139140bae33bfde1a +_next/static/chunks/main-app-8d0803cc903eaf67.js,1725527141109,faaaa1facc808ad6fe3f630425dc54966ce963f97928aedd692aea1e70ce58b0 +_next/static/chunks/webpack-d80e8b63f8c048e7.js,1725527141109,a35d457578da47e55c5b767e2a4b6391e33f4444db0488368dd5bb8acbab55c7 +_next/static/chunks/app/not-found-b138f2aa7719a744.js,1725527141113,aa1e61f163f19ffc8936936b0f042d1292cba6f98e0095a43463d479d4b6c511 +_next/static/chunks/app/layout-e7301afbb4e907f5.js,1725527141113,2acb8e093304b5d84ea929e9f7430ffe292bae13300b99e2e87b182bb684b573 +_next/static/chunks/app/_not-found/page-eadc29731652ae7d.js,1725527141114,37b5aa9754ce86c8c1f6eb411cbe59abfe53502aa00806b983eb0d0ee455023f +_next/static/chunks/pages/_app-037b5d058bd9a820.js,1725527141114,06e750a0ef670f4de0c1bd480b5011b19558d8742f9b03ec7109bdceae9c7931 +_next/static/chunks/pages/_error-6ae619510b1539d6.js,1725527141114,e73729a247fbd5cf1acddc0c6f67271a511c97ca0b0068e42447d5f5e996ecf7 +_next/static/css/130db2bf77dc9517.css,1725527141109,2268ae22418e82f1572fa51b1174f62f7134760074b385486b7d437b73cf482a +_next/static/media/0148c4ca3456ea72-s.woff2,1725527141110,59a0565b210eef8ed29034d845b2ee1ba5cd59866474b3aa01f7db8d95a28f36 +_next/static/css/728e911c774fb330.css,1725527141110,476a417e76b4176343fa0827c476a96c3271978b74f71ed4cd8752c0f9f1353d +_next/static/chunks/app/page-4eb17137c55d155f.js,1725527141114,94412e6aeb3864583b6122112baa5b38534d2b9172e7c93ae93a02aea5132ee9 +_next/static/css/27da6408606c9307.css,1725527141110,e40a444ebe7dc9a3d718e89873e00ecb71e63d4741eead4d63c916267972f883 +_next/static/media/09b62d668edb05d1-s.woff2,1725527141111,0d8d858fc39ace004d9718f4b2cc3cc5ba1b51ce80283319e5840359ba8a095e +_next/static/media/08404bcfb1dae67a-s.woff2,1725527141111,c001cee57902015c0205bcb5fdb67c6d6c8521e2314b7151f587b60c096f762a +_next/static/chunks/34318fad-6940cb9b00d9ec04.js,1725527141100,e4bd873c3e839214528f30cd45a7b94691472e6770b574cc445fe97e57903433 +_next/static/chunks/7de54f2b-f38dd21f308f095a.js,1725527141105,bbeea5f0f6405173d7cb47f92949abee4984e292a0347702c00de445bebf5364 +_next/static/chunks/77693919-cebae1edd1c23380.js,1725527141105,2ae6430ecd6ab2a3ab9c5dc51db5ae88293d755262d7c554907b8c384988bea5 +_next/static/chunks/b24dba43-c1828973140465ca.js,1725527141107,10dc3fd04d30bc6846bcac3d50360134978087bf41815359c71cd742b2c19b2b +_next/static/chunks/bf66a46c-bffbcf136d36d450.js,1725527141108,d6ae37cfe006914e1ff646d74c1b211c972a49f4a897b0ce5ff1022a432ceb96 +_next/static/chunks/fa5018ec-78e9fe2c4b84a7c6.js,1725527141109,5bbef06bb945ca21f3128885818ec6cfb95688ca7ddaf6e9116cb8d52c1e894d +_next/static/chunks/23-5ed42ec1a7af11d9.js,1725527141100,3b025f9ec1e1eb7c9e6e339b5e48fa9fb101e6a9a7d6575c8ca42f51371a881a +_next/static/chunks/a342680c-c51d498601fd96ae.js,1725527141105,fa575ae22fe7740993694c0eb66e3e18d9da5c85e98a101d49b44b9d55cf6da5 +_next/static/chunks/e37a0b60-10ce622d242abd89.js,1725527141108,3aeede3359b5f9e65f35be68b45af612afef2de74c97bed36b797caa779cd89c +_next/static/chunks/main-1e120df7c6cf74dd.js,1725527141109,830e12ceae56d3cc631b7e051a72ac5088317e635e3e70b1d80958a9094f1499 +_next/static/chunks/e2b8353a-ec8c70c57efea465.js,1725527141108,a4b4595b6bc5e3e4a4d1761fcc7e2e07d13da9b8938f7ca4c60a70d0c2b97427 +_next/static/chunks/polyfills-78c92fac7aa8fdd8.js,1725527141110,a5b39edcc77b6069d442b5dbeb8091cf27ac47ac7a1a99cfc325213bdaae2fb5 +_next/static/chunks/6ae44921-aa5a078730e4277a.js,1725527141104,0567967ca925ed2b7285d5f449c366d6530b5dc9e280002f3f049b3bd2f4f380 +_next/static/chunks/b60e3787-fc4eacbbb568cf06.js,1725527141107,aadf4477c67ed9d8eaa8fda2667d5cdf5f1c3611673842b9fe027ab8be1ceb98 +_next/static/media/10446295ae7f2657-s.p.woff2,1725527141111,9e392e2c201242111c40f44fd3cf98f9f886f0a48aa67729433b5348a46c081a +_next/static/media/28cea0425961ab58-s.woff2,1725527141111,4951ba771fda774b8ddf0e6de43e4d52d48dd21f43f31e127b784d9b32f697c5 +_next/static/media/4184cf5f191b83db-s.woff2,1725527141111,42cc1534616d0d7475d5dd69f80e235dc7bb01906e964859d6cd5f02a5df4a0d +_next/static/media/60d74363e715829c-s.woff2,1725527141111,125670e96a055c483cd8ae99d2b7d9f42ee553980e503bebd246216700be0c2e +_next/static/media/6be22a85bef54f08-s.p.woff2,1725527141111,5c5d946ba95a9bf1245c9b029d8c0246c2f51810ff9af5500a1df4eefb231152 +_next/static/media/67aea609c6135b3b-s.woff2,1725527141111,2b8cec2c1a1e7d525507ae409149838de23ef17791a5975ef17823acdd3b8292 +_next/static/media/791334aa8b2b679f-s.woff2,1725527141111,e3e0d9de68c137a784d6440591387a740bc61822f1c611cc6b752262af3c5b5f +_next/static/media/9491f41002d34397-s.woff2,1725527141111,d03e57c0c741d253c56c8725e61e5fa46c63c862e48566443b3e81a5024cc4bc +_next/static/media/a2411df190893074-s.woff2,1725527141111,3889e1b1022f895d26f5a66307727d3a540a1baee80e4ab7a915996591f53279 +_next/static/media/afba6ba6bf9157e8-s.woff2,1725527141112,9af676b26e2a20d39cca0eb8d744a73ce1ad21990a6b0f7142b178fb9bce41de +_next/static/media/b4c759cba7a5f011-s.p.woff2,1725527141112,661284d73c9022c4572c75deb77a107f9028b1845f180c531ee761b2e15286a4 +_next/static/media/b6ecfd81ed9f83c9-s.woff2,1725527141112,a691b485e42759b1ac5c35fbb3d925ee91225675207daf33b8d83055fc87da7b +_next/static/media/bc381c5935034aa5-s.p.woff2,1725527141112,e1d80d0e85378fe151d9ea1fd59d4e0a68e1e49145f5beaafedd5e142a92c8ae +_next/static/media/be843c5b0882ad66-s.woff2,1725527141112,b8b72e338dd44b2202c32a3430e723e143e52945161b7fefb7fd80d44cd33717 +_next/static/media/d1f5f89450ecd78c-s.woff2,1725527141112,a23b70b8e1feb6ebcf7dd7e4d70b794013a517d34ba841e47dd3cdb25f7132ed +_next/static/media/de555e6bc944c11a-s.woff2,1725527141112,ba546fa6db5a3a4e952bda42f35cc18d83503369ff0d1a7a3564a79c7182429e +_next/static/media/ebcf93a611f94ec0-s.woff2,1725527141112,63f304c1c7de937c992e410e3220d2d1e5c4d790046f87d2c73bfdf8ee742a33 +_next/static/media/eb37c9fe4776ea97-s.woff2,1725527141112,484b94a74f8c8c86204df2709680c545d5c9b2e7e6b07721c84bc1aa1f9f1d53 +_next/static/media/ec50b434b597bc61-s.woff2,1725527141112,73bf33b4e0ed3afeb2024b3f0d38f31947d217a4615aa8d5737eb0755b00203d +_next/static/media/f565fad065ab4cf3-s.woff2,1725527141113,ce303c34757353648d0525e26ba4ae502e80adb0cf3343a51bad77f50631699e +_next/static/media/f9946f06d70a1b5b-s.woff2,1725527141113,fc86829e9a454dcde0481c74ed6c9b9d1a61798b59a0e0700fe510f9b5a38b41 +_next/static/media/ic_loading.e4395145.png,1725527141113,9b7256e6b358a939bb64061d797bfd3ed14246fcd171c849371fa2fbfa473e40 +_next/static/plBm2u4tQSAMlAlDqoqbw/_buildManifest.js,1725527141110,0474c56df53665d9f0c84e3ed67dea5b38f6e7ff31a982c3bbb5904e4771ee4b +_next/static/plBm2u4tQSAMlAlDqoqbw/_ssgManifest.js,1725527141110,02dbc1aeab6ef0a6ff2ff9a1643158cf9bb38929945eaa343a3627dee9ba6778 +_next/static/chunks/framework-00a8ba1a63cfdc9e.js,1725527141109,c2012692d29b99c17d95c52f9e0f321c0aa21c7e8bc5db5fae470ad7eda00549 +_next/static/chunks/fd9d1056-0f4f3ee949eb019b.js,1725527141109,25f5dce45252959ff01f83f2f702c7bc14ffac84dcf3e1efbb080e0a12474250 +_next/static/chunks/6809c4f0-214060138ce09633.js,1725527141103,af3edf8b7fc76841edb7cee56881f8bf9466cf2d09c29549ab3db7e11160ac36 +_next/static/chunks/aaea2bcf-1841944f7315cd08.js,1725527141107,2b8f2d05d3fcc95b1cb7c43fc61140ec315d06a348514421fe90dad86b71e43c +_next/static/chunks/206-5ac84613b09e1327.js,1725527141100,a35d3b0b9dd4f1a29721d46ea35fdae10950d4ed7027f8a706d76bc10ac6c2b3 +_next/static/chunks/52-44307ff5dec2db6e.js,1725527141102,4b9e73e76e873f1b2262750b67348fe640eefbd274227eb9eb459d6dd9368bfa +_next/static/chunks/550ed063-8e791bead8b89fc5.js,1725527141104,4cc8a629c160014fc45aa1dbf2b84f4e6c025e102fd107011a60ff18e23e2643 +_next/static/chunks/95-b26a16dff4c4ba30.js,1725527141106,dd9908eb9fc0beff0383cf2fc6171d254fe806be4ddff378aef34a8c9096e5a4 +_next/static/chunks/233658ae-8362a295114141c4.js,1725527141101,3fc2fc86d8f9b2488d21ecd9b7ba838e14e7d03046378081d7e67b97aff4f133 +_next/static/chunks/209590b8-f6fe88c51d1ecbc2.js,1725527141101,7fcf6a574d723c7a5718a0052c2673684b8efd7cd34ef843b45328942a581f3d +_next/static/chunks/68b159eb-33fdf129f033d3d9.js,1725527141106,77e9651b5caed2b9e62c9991cffd497709794a7c5f497d78ce9bac028e42449f +_next/static/media/swapBg.ed3d662e.png,1725527141115,69b7d486b8a29fc10f6a29b199b974f28d1d7e6cbe52ee07c7ad19507427d154 +_next/static/chunks/602-4cfd0f17456e7074.js,1725527141116,251869a28b044bc9c45eba269b9f3e3440278fb79028892d6397ec135aa47d40 diff --git a/.firebaserc b/.firebaserc index 4f4a066..2f2a85f 100644 --- a/.firebaserc +++ b/.firebaserc @@ -7,6 +7,9 @@ "hosting": { "ton-bridge": [ "ton-bridge" + ], + "ton-bridge-staging": [ + "ton-bridge-staging" ] } } diff --git a/.github/workflows/firebase-staging.yml b/.github/workflows/firebase-staging.yml new file mode 100644 index 0000000..35ce943 --- /dev/null +++ b/.github/workflows/firebase-staging.yml @@ -0,0 +1,21 @@ +name: Deploy to Firebase Hosting + +on: + push: + branches: [staging] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + dispatch: + runs-on: ubuntu-latest + + steps: + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.PAT }} + repository: oraichain/infra + event-type: firebase + client-payload: '{"ref": "${{ github.ref }}", "repo": "${{ github.repository }}", "node_version": "18", "target": "ton-bridge-staging", "env_file": ".env.staging"}' \ No newline at end of file diff --git a/assets/icons/token.tsx b/assets/icons/token.tsx index 7efe241..61a852a 100644 --- a/assets/icons/token.tsx +++ b/assets/icons/token.tsx @@ -206,7 +206,7 @@ export const OsmosisIcon = () => { { { { { { { { { { gradientUnits="userSpaceOnUse" gradientTransform="translate(35.1108 8.08429) scale(11.3069 11.3069)" > - - - + + + { gradientUnits="userSpaceOnUse" gradientTransform="translate(28.8204 12.9078) scale(27.6639)" > - - - + + + { y2="8.69271" gradientUnits="userSpaceOnUse" > - - - + + + { y2="23.7823" gradientUnits="userSpaceOnUse" > - - - - + + + + { y2="29.2401" gradientUnits="userSpaceOnUse" > - - + + { y2="37.5339" gradientUnits="userSpaceOnUse" > - - - - + + + + { y2="29.2401" gradientUnits="userSpaceOnUse" > - - + + { y2="23.773" gradientUnits="userSpaceOnUse" > - - + + { y2="12.5119" gradientUnits="userSpaceOnUse" > - - - - + + + + { y2="32.5193" gradientUnits="userSpaceOnUse" > - - - - + + + + { y2="32.1609" gradientUnits="userSpaceOnUse" > - - - - + + + + { y2="33.971" gradientUnits="userSpaceOnUse" > - - - - + + + + { y2="33.5911" gradientUnits="userSpaceOnUse" > - - - - + + + + { y2="31.8186" gradientUnits="userSpaceOnUse" > - - - - + + + + { y2="28.9604" gradientUnits="userSpaceOnUse" > - - - - + + + + diff --git a/components/layout/connectButton/index.tsx b/components/layout/connectButton/index.tsx index fcf9b4f..c0a7e9b 100644 --- a/components/layout/connectButton/index.tsx +++ b/components/layout/connectButton/index.tsx @@ -33,6 +33,7 @@ import classNames from "classnames"; import { FC, useCallback, useEffect, useRef, useState } from "react"; import ConnectedInfo from "../connectedInfo"; import styles from "./index.module.scss"; +import { Environment } from "@/constants/ton"; export type ConnectStatus = | "init" @@ -84,8 +85,8 @@ const ConnectButton: FC<{ fullWidth?: boolean }> = ({ fullWidth }) => { window.Keplr = new Keplr(walletType); setStorageKey("typeWallet", walletType); - await initClient(); - const oraiAddr = await window.Keplr.getKeplrAddr(); + await initClient(process.env.NEXT_PUBLIC_ENV as Environment); + const oraiAddr = await window.Keplr.getKeplrAddr("Oraichain"); handleSetOraiAddress({ oraiAddress: oraiAddr }); handleSetOraiWallet({ oraiWallet: walletType }); setStep(2); diff --git a/components/page/bridge/components/inputBridge/index.tsx b/components/page/bridge/components/inputBridge/index.tsx index 8bdbc7d..1efba06 100644 --- a/components/page/bridge/components/inputBridge/index.tsx +++ b/components/page/bridge/components/inputBridge/index.tsx @@ -5,7 +5,7 @@ import { ArrowDownIcon } from "@/assets/icons/arrow"; import { SelectOptionIcon } from "@/assets/icons/network"; import SelectCommon from "@/components/commons/select"; import { AMOUNT_BALANCE_ENTRIES_UNIVERSAL_SWAP } from "@/constants/config"; -import { TonNetwork } from "@/constants/ton"; +import { Environment } from "@/constants/ton"; import { OraichainTokenList, OsmosisTokenList, @@ -37,7 +37,7 @@ const InputBridge: FC<{ onChangeAmount?: (amount: number | undefined) => void; amount: number; token: any; - tonNetwork: TonNetwork; + tonNetwork: Environment; setToken: Dispatch; txtSearch: string; setTxtSearch: Dispatch>; @@ -99,7 +99,7 @@ const InputBridge: FC<{ } if (networkFrom === NetworkList["osmosis-1"].id) - networkList = OsmosisTokenList; + networkList = OsmosisTokenList(tonNetwork); return (
{ - console.log({ eerererere: e }); - setToken(e); setOpen(false); }} diff --git a/components/page/bridge/hooks/useGetFee.ts b/components/page/bridge/hooks/useGetFee.ts index 350a39f..e41d4bc 100644 --- a/components/page/bridge/hooks/useGetFee.ts +++ b/components/page/bridge/hooks/useGetFee.ts @@ -1,8 +1,8 @@ -import { TonNetwork } from "@/constants/ton"; -import { network } from "@/constants/networks"; +import { Environment } from "@/constants/ton"; +import { getNetworkConfig } from "@/constants/networks"; import { TokenType, TonTokenList } from "@/constants/tokens"; import { useAuthOraiAddress } from "@/stores/authentication/selector"; -import { BigDecimal, toDisplay } from "@oraichain/oraidex-common"; +import { BigDecimal } from "@oraichain/oraidex-common"; import { TonbridgeBridgeClient } from "@oraichain/tonbridge-contracts-sdk"; import { useEffect, useState } from "react"; @@ -10,12 +10,13 @@ const useGetFee = ({ token }: { token: TokenType }) => { const oraiAddress = useAuthOraiAddress(); const [bridgeFee, setBridgeFee] = useState(0); const [tokenFee, setTokenFee] = useState(0); + const network = getNetworkConfig(Environment.Mainnet); useEffect(() => { (async () => { try { if (token) { - const tokenInTon = TonTokenList(TonNetwork.Mainnet).find( + const tokenInTon = TonTokenList(Environment.Mainnet).find( (tk) => tk.coingeckoId === token.coingeckoId ); if (!tokenInTon) { @@ -56,7 +57,7 @@ const useGetFee = ({ token }: { token: TokenType }) => { useEffect(() => { (async () => { if (token) { - const tokenInTon = TonTokenList(TonNetwork.Mainnet).find( + const tokenInTon = TonTokenList(Environment.Mainnet).find( (tk) => tk.coingeckoId === token.coingeckoId ); if (!tokenInTon) { diff --git a/components/page/bridge/hooks/useGetStateData.ts b/components/page/bridge/hooks/useGetStateData.ts index c68c0a8..1a016e6 100644 --- a/components/page/bridge/hooks/useGetStateData.ts +++ b/components/page/bridge/hooks/useGetStateData.ts @@ -1,9 +1,12 @@ -import { network } from "@/constants/networks"; +import { getNetworkConfig } from "@/constants/networks"; import { TokenType } from "@/constants/tokens"; +import { Environment } from "@/constants/ton"; import { useAuthOraiAddress } from "@/stores/authentication/selector"; import { TonbridgeBridgeClient } from "@oraichain/tonbridge-contracts-sdk"; import { useEffect, useState } from "react"; +const env = process.env.NEXT_PUBLIC_ENV as Environment; + const useGetStateData = () => { const oraiAddress = useAuthOraiAddress(); const [balances, setBalances] = useState([]); @@ -12,7 +15,7 @@ const useGetStateData = () => { const tonBridgeClient = new TonbridgeBridgeClient( window.client, oraiAddress, - network.CW_TON_BRIDGE + getNetworkConfig(env).CW_TON_BRIDGE ); const config = await tonBridgeClient.channelStateData(); diff --git a/components/page/bridge/index.tsx b/components/page/bridge/index.tsx index fca7f82..c52b8f8 100644 --- a/components/page/bridge/index.tsx +++ b/components/page/bridge/index.tsx @@ -1,18 +1,17 @@ "use client"; - import { SearchIcon, SwapIcon, WarningIcon } from "@/assets/icons/action"; import { TonNetworkICon } from "@/assets/icons/network"; import { OraiIcon, OsmosisIcon } from "@/assets/icons/token"; import Loader from "@/components/commons/loader/Loader"; import ConnectButton from "@/components/layout/connectButton"; import { TON_SCAN } from "@/constants/config"; -import { TonNetwork } from "@/constants/ton"; +import { Environment } from "@/constants/ton"; import { CW_TON_BRIDGE, TON_ZERO_ADDRESS, TonInteractionContract, } from "@/constants/contract"; -import { network } from "@/constants/networks"; +import { getNetworkConfig } from "@/constants/networks"; import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx"; import { OraichainTokenList, @@ -39,16 +38,19 @@ import { calculateTimeoutTimestamp, getCosmosGasPrice, } from "@oraichain/oraidex-common"; -import { BridgeAdapter, JettonMinter } from "@oraichain/ton-bridge-contracts"; +import { + BridgeAdapter, + JettonMinter, + JettonWallet, +} from "@oraichain/ton-bridge-contracts"; import { TonbridgeBridgeClient } from "@oraichain/tonbridge-contracts-sdk"; import { getHttpEndpoint } from "@orbs-network/ton-access"; -import { Address, Cell, Dictionary, beginCell, toNano } from "@ton/core"; +import { Address, Cell, beginCell, toNano } from "@ton/core"; import { TonClient } from "@ton/ton"; import { Base64 } from "@tonconnect/protocol"; import { useEffect, useState } from "react"; import styles from "./index.module.scss"; import InputBridge, { NetworkType } from "./components/inputBridge"; -import { JettonWallet } from "@oraichain/ton-bridge-contracts"; import { fromBech32 } from "@cosmjs/encoding"; import useGetFee from "./hooks/useGetFee"; import { @@ -83,14 +85,13 @@ import { getCosmWasmClient } from "@/libs/cosmjs"; import { GasPrice } from "@cosmjs/stargate"; import { getAddressCosmos } from "./helper"; import { ArrowDownIcon } from "@/assets/icons/arrow"; -import PowerByOBridge from "./components/PowerByOBridge"; const Bridge = () => { const oraiAddress = useAuthOraiAddress(); const tonAddress = useAuthTonAddress(); const [tonConnectUI] = useTonConnectUI(); const [txtSearch, setTxtSearch] = useState(); - const tonNetwork = TonNetwork.Mainnet; + const tonNetwork = process.env.NEXT_PUBLIC_ENV as Environment; const { loadToken } = useLoadToken(); const { loadAllBalanceTonToken } = useLoadTonBalance({ @@ -101,7 +102,6 @@ const Bridge = () => { const amounts = useAmountsCache(); const amountsTon = useTonAmountsCache(); const { balances: sentBalance, getChanelStateData } = useGetStateData(); - const [loading, setLoading] = useState(false); const [amount, setAmount] = useState(null); const [token, setToken] = useState(null); @@ -110,6 +110,8 @@ const Bridge = () => { const [tokenInfo, setTokenInfo] = useState({ jettonWalletAddress: null, }); + const [bridgeJettonWallets, setBridgeJettonWallets] = useState(); + const [deductNativeAmount, setDeductNativeAmount] = useState(0n); const { data: prices } = useCoinGeckoPrices(); @@ -121,6 +123,8 @@ const Bridge = () => { if (toNetwork.id === NetworkList["osmosis-1"].id) destinationAddress = getAddressCosmos(oraiAddress); + const network = getNetworkConfig(tonNetwork); + const { bridgeFee, tokenFee } = useGetFee({ token, }); @@ -130,6 +134,40 @@ const Bridge = () => { setToNetwork, }); + useEffect(() => { + try { + (async () => { + const values = TonTokenList(tonNetwork).values(); + const endpoint = await getHttpEndpoint(); + const client = new TonClient({ + endpoint, + }); + const bridgeAdapter = TonInteractionContract[tonNetwork].bridgeAdapter; + const jettonWallet = await Promise.all( + [...values].map((value) => { + if (value.contractAddress === TON_ZERO_ADDRESS) + return Address.parse(TON_ZERO_ADDRESS); + const jettonMinter = client.open( + JettonMinter.createFromAddress( + Address.parse(value.contractAddress) + ) + ); + return jettonMinter.getWalletAddress(Address.parse(bridgeAdapter)); + }) + ); + const allJettonWallet = jettonWallet.reduce((acc, cur, idx) => { + acc.push(cur.toString()); + return acc; + }, [] as string[]); + console.log({ allJettonWallet }); + console.log({ bridgeAdapter }); + setBridgeJettonWallets(allJettonWallet); + })(); + } catch (error) { + console.log("error :>>", error); + } + }, []); + useEffect(() => { if ( toNetwork.id == NetworkList.oraichain.id && @@ -163,11 +201,16 @@ const Bridge = () => { const jettonMinter = JettonMinter.createFromAddress( Address.parse(token.contractAddress) ); - const jettonMinterContract = client.open(jettonMinter); - const jettonWalletAddress = await jettonMinterContract.getWalletAddress( - Address.parse(tonAddress) - ); + const jettonMinterContract = client.open(jettonMinter); + const [jettonWalletAddress, bridgeJettonWalletAddress] = + await Promise.all([ + jettonMinterContract.getWalletAddress(Address.parse(tonAddress)), + jettonMinterContract.getWalletAddress( + Address.parse(TonInteractionContract[tonNetwork].bridgeAdapter) + ), + ]); + console.log({ bridgeJettonWalletAddress }); setTokenInfo({ jettonWalletAddress, }); @@ -185,8 +228,7 @@ const Bridge = () => { const client = new TonClient({ endpoint, }); - const bridgeAdapter = - TonInteractionContract[TonNetwork.Mainnet].bridgeAdapter; + const bridgeAdapter = TonInteractionContract[tonNetwork].bridgeAdapter; if (token.contractAddress === TON_ZERO_ADDRESS) { const balance = await client.getBalance(Address.parse(bridgeAdapter)); @@ -206,7 +248,7 @@ const Bridge = () => { const jettonWallet = JettonWallet.createFromAddress(jettonWalletAddress); const jettonWalletContract = client.open(jettonWallet); const balance = await jettonWalletContract.getBalance(); - + console.log({ bridgeAdapter, jettonMinter, jettonWallet, balance }); return { balance: balance.amount, }; @@ -313,7 +355,9 @@ const Bridge = () => { if (!token || !amount) throw "Not valid!"; - validatePrice(token, amount); + if (tonNetwork == "mainnet") { + validatePrice(token, amount); + } setLoading(true); @@ -469,19 +513,6 @@ const Bridge = () => { if (!token || !amount) throw "Not valid!"; - // get the decentralized RPC endpoint - // const endpoint = await getHttpEndpoint(); - // const client = new TonClient({ - // endpoint, - // }); - - // const isActiveDestinationAddress = await client.isContractDeployed( - // Address.parse(destinationAddress) - // ); - // if (!isActiveDestinationAddress) { - // throw "Destination address has to be an active address!"; - // } - setLoading(true); const isFromOsmosisToOraichain = fromNetwork.id === NetworkList["osmosis-1"].id && @@ -524,7 +555,7 @@ const Bridge = () => { undefined, undefined, { - contractAddress: CW_TON_BRIDGE, + contractAddress: network.CW_TON_BRIDGE, msg: toBinary({ bridge_to_ton: { to: tonAddress, @@ -607,22 +638,23 @@ const Bridge = () => { } return; } + if (tonNetwork == "mainnet") { + validatePrice(token, amount); + } - validatePrice(token, amount); - - const tokenInTon = TonTokenList(TonNetwork.Mainnet).find( + const tokenInTon = TonTokenList(tonNetwork).find( + (tk) => tk.coingeckoId === token.coingeckoId + ); + const index = TonTokenList(tonNetwork).findIndex( (tk) => tk.coingeckoId === token.coingeckoId ); + const bridgeJettonWallet = bridgeJettonWallets[index]; + const balanceMax = (sentBalance || []).find( - (b) => b.native.denom === tokenInTon.contractAddress + (b) => b.native.denom === bridgeJettonWallet )?.native.amount; - // const balanceMax = await checkBalanceBridgeByNetwork( - // NetworkList.oraichain.id, - // tokenInTon - // ); - const displayBalance = toDisplay( balanceMax, tokenInTon?.decimal || CW20_DECIMALS @@ -642,11 +674,10 @@ const Bridge = () => { let tx; const timeout = Math.floor(new Date().getTime() / 1000) + 3600; + const msg = { // crcSrc: ARG_BRIDGE_TO_TON.CRC_SRC, - denom: TonTokenList(tonNetwork).find( - (tk) => tk.coingeckoId === token.coingeckoId - ).contractAddress, + denom: bridgeJettonWallet, timeout, to: tonAddress, }; @@ -734,7 +765,7 @@ const Bridge = () => { } // const isMaintained = fromNetwork.id === NetworkList.oraichain.id; - const isMaintained = true; + const isMaintained = false; return (
diff --git a/constants/chainInfo.ts b/constants/chainInfo.ts index 0a6306c..680fdb0 100644 --- a/constants/chainInfo.ts +++ b/constants/chainInfo.ts @@ -154,6 +154,16 @@ export const oraichainNetwork: CustomChainInfo = { coinDecimals: 6, Icon: UsdtIcon, }, + { + coinDenom: "jUSDT", + coinGeckoId: "bridged-tether-ton-bridge", + coinMinimalDenom: "jusdt", + type: "cw20", + contractAddress: USDT_CONTRACT, + bridgeTo: ["0x38", "0x2b6653dc", "0x01"], + coinDecimals: 6, + Icon: UsdtIcon, + }, { coinDenom: "USDC", coinGeckoId: "usd-coin", diff --git a/constants/contract.ts b/constants/contract.ts index 65776ac..cef3b9e 100644 --- a/constants/contract.ts +++ b/constants/contract.ts @@ -1,32 +1,59 @@ -import { TonNetwork } from "./ton"; +import { Environment } from "./ton"; + +export const TON_ZERO_ADDRESS = + "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c"; export const TonInteractionContract = { - [TonNetwork.Mainnet]: { + [Environment.Mainnet]: { lightClient: "EQDzy_POlimFDyzrHd3OQsb9sZCngyG3O7Za4GRFzM-rrO93", whitelist: "EQATDM6mfPZjPDMD9TVa6D9dlbmAKY5w6xOJiTXJ9Nqj_dsu", bridgeAdapter: "EQC-aFP0rJXwTgKZQJPbPfTSpBFc8wxOgKHWD9cPvOl_DnaY", }, - [TonNetwork.Testnet]: { + [Environment.Staging]: { + lightClient: "EQDzy_POlimFDyzrHd3OQsb9sZCngyG3O7Za4GRFzM-rrO93", + whitelist: "EQAbJI3NZKGcVu-ec_z_LcmXca9ZOtzkgCW5H9glnWBDpaFg", + bridgeAdapter: "EQA3ISho4fpW3wmCkKEwsyXulIw7vLf-2jxso40ul3QQJ_O7", + }, + [Environment.Testnet]: { lightClient: "", whitelist: "EQD2xPIqdeggqtP3q852Y-7yD-RRHi12Zy7M4iUx4-7q0E1", bridgeAdapter: "EQDZfQX89gMo3HAiW1tSK9visb2gouUvDCt6PODo3qkXKeox", }, }; -export const TON_ZERO_ADDRESS = - "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c"; - export const TonTokensContract = { - [TonNetwork.Mainnet]: { + [Environment.Mainnet]: { usdt: "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs", + // jUSDT: "EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA", ton: TON_ZERO_ADDRESS, }, - [TonNetwork.Testnet]: { + [Environment.Staging]: { + usdt: "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs", + jUSDT: "EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA", + ton: TON_ZERO_ADDRESS, + }, + [Environment.Testnet]: { usdt: "EQA5FnPP13uZPJQq7aj6UHLEukJJZSZW053cU1Wu6R6BpYYB", + jUSDT: "EQA5FnPP13uZPJQq7aj6UHLEukJJZSZW053cU1Wu6R6BpYYB", ton: TON_ZERO_ADDRESS, }, }; +export const CwInteractionContract = { + [Environment.Mainnet]: { + cosmwasmBridge: + "orai159l8l9c5ckhqpuwdfgs9p4v599nqt3cjlfahalmtrhfuncnec2ms5mz60e", + tokenFactory: + "orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9", + }, + [Environment.Staging]: { + cosmwasmBridge: + "orai16e976su89dygmapmepqerktwj3zvx5znahnj0zpgwj2scef2sjask4vm58", + tokenFactory: + "orai17hyr3eg92fv34fdnkend48scu32hn26gqxw3hnwkfy904lk9r09qqzty42", + }, +}; + export const CW_TON_BRIDGE = "orai159l8l9c5ckhqpuwdfgs9p4v599nqt3cjlfahalmtrhfuncnec2ms5mz60e"; export const TOKEN_FACTORY = diff --git a/constants/networks.ts b/constants/networks.ts index 36e2e32..fabbb18 100644 --- a/constants/networks.ts +++ b/constants/networks.ts @@ -4,18 +4,21 @@ import { ROUTER_V2_CONTRACT, } from "@oraichain/oraidex-common"; import { oraichainNetwork } from "./chainInfo"; -import { CW_TON_BRIDGE, TOKEN_FACTORY } from "./contract"; +import { CwInteractionContract } from "./contract"; +import { Environment } from "./ton"; -export const network = { - ...oraichainNetwork, - prefix: oraichainNetwork.bech32Config.bech32PrefixAccAddr, - denom: "orai", - coinType: oraichainNetwork.bip44.coinType, - fee: { gasPrice: "0.00506", amount: "1518", gas: "2000000" }, // 0.000500 ORAI - explorer: "https://scan.orai.io", - router: ROUTER_V2_CONTRACT, - oracle: ORACLE_CONTRACT, - multicall: MULTICALL_CONTRACT, - CW_TON_BRIDGE: CW_TON_BRIDGE, - TOKEN_FACTORY: TOKEN_FACTORY, +export const getNetworkConfig = (env: Environment) => { + return { + ...oraichainNetwork, + prefix: oraichainNetwork.bech32Config.bech32PrefixAccAddr, + denom: "orai", + coinType: oraichainNetwork.bip44.coinType, + fee: { gasPrice: "0.00506", amount: "1518", gas: "2000000" }, // 0.000500 ORAI + explorer: "https://scan.orai.io", + router: ROUTER_V2_CONTRACT, + oracle: ORACLE_CONTRACT, + multicall: MULTICALL_CONTRACT, + CW_TON_BRIDGE: CwInteractionContract[env].cosmwasmBridge, + TOKEN_FACTORY: CwInteractionContract[env].tokenFactory, + }; }; diff --git a/constants/tokens.ts b/constants/tokens.ts index 5ec819e..81c0c59 100644 --- a/constants/tokens.ts +++ b/constants/tokens.ts @@ -1,10 +1,11 @@ -import { TonNetwork } from "./ton"; +import { Environment } from "./ton"; import { TonTokensContract } from "./contract"; import { UsdtIcon, TetherIcon } from "@/assets/icons/token"; import { USDT_CONTRACT } from "@oraichain/oraidex-common"; import { TonNetworkICon } from "@/assets/icons/network"; export type TokenType = { + chainId?: string; name: string; symbol: string; Icon: () => JSX.Element; @@ -18,6 +19,7 @@ export const TON_DENOM = `factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6 export const OraichainTokenList: TokenType[] = [ { + chainId: "Oraichain", name: "Tether", symbol: "USDT", Icon: UsdtIcon, @@ -26,7 +28,18 @@ export const OraichainTokenList: TokenType[] = [ coingeckoId: "tether", decimal: 6, }, + // { + // chainId: "Oraichain", + // name: "Tether", + // symbol: "jUSDT", + // Icon: UsdtIcon, + // contractAddress: USDT_CONTRACT, + // denom: "jusdt", + // coingeckoId: "bridged-tether-ton-bridge", + // decimal: 6, + // }, { + chainId: "Oraichain", name: "Ton", symbol: "TON", Icon: TonNetworkICon, @@ -37,20 +50,29 @@ export const OraichainTokenList: TokenType[] = [ }, ]; -export const OsmosisTokenList: TokenType[] = [ +export const OsmosisTokenDenom = { + [Environment.Mainnet]: { + ton: "ibc/905889A7F0B94F1CE1506D9BADF13AE9141E4CBDBCD565E1DFC7AE418B3E3E98", + }, + [Environment.Staging]: { + ton: "ibc/64BF62F8C7C0B1AADBCFBCB45E778DA144E86804420AC5AD4F29D141A14A031B", + }, +}; + +export const OsmosisTokenList = (network: Environment): TokenType[] => [ { + chainId: "osmosis-1", name: "Ton", symbol: "TON", Icon: TonNetworkICon, contractAddress: null, - denom: - "ibc/905889A7F0B94F1CE1506D9BADF13AE9141E4CBDBCD565E1DFC7AE418B3E3E98", + denom: OsmosisTokenDenom[network].ton, coingeckoId: "the-open-network", decimal: 9, }, ]; -export const TonTokenList = (network: TonNetwork): TokenType[] => [ +export const TonTokenList = (network: Environment): TokenType[] => [ { name: "Tether", symbol: "USDT", @@ -60,6 +82,15 @@ export const TonTokenList = (network: TonNetwork): TokenType[] => [ coingeckoId: "tether", decimal: 6, }, + // { + // name: "Jetton USDT", + // symbol: "jUSDT", + // Icon: TetherIcon, + // contractAddress: TonTokensContract[network].jUSDT, + // denom: "ton20_usdt", + // coingeckoId: "bridged-tether-ton-bridge", + // decimal: 6, + // }, { name: "Ton", symbol: "TON", diff --git a/constants/ton.ts b/constants/ton.ts index a4fa5b7..286f037 100644 --- a/constants/ton.ts +++ b/constants/ton.ts @@ -1,4 +1,5 @@ -export enum TonNetwork { +export enum Environment { Mainnet = "mainnet", Testnet = "testnet", + Staging = "staging", } diff --git a/contexts/app-provider.tsx b/contexts/app-provider.tsx index bddd867..f9e072a 100644 --- a/contexts/app-provider.tsx +++ b/contexts/app-provider.tsx @@ -1,7 +1,7 @@ "use client"; -import { TonNetwork } from "@/constants/ton"; -import { network } from "@/constants/networks"; +import { Environment } from "@/constants/ton"; +import { getNetworkConfig } from "@/constants/networks"; import { useLoadToken, useLoadTonBalance } from "@/hooks/useLoadToken"; import { getCosmWasmClient } from "@/libs/cosmjs"; import Keplr from "@/libs/keplr"; @@ -25,6 +25,8 @@ import React, { useEffect } from "react"; import { TToastType, displayToast } from "./toasts/Toast"; import { getAddressCosmos } from "@/components/page/bridge/helper"; +const env = process.env.NEXT_PUBLIC_ENV as Environment; +const network = getNetworkConfig(env); if (typeof window !== "undefined") { polyfill(); @@ -53,7 +55,7 @@ export const AppProvider = (props: React.PropsWithChildren<{}>) => { const { loadToken } = useLoadToken(); const { loadAllBalanceTonToken } = useLoadTonBalance({ tonAddress, - tonNetwork: TonNetwork.Mainnet, + tonNetwork: Environment.Mainnet, }); const keplrHandler = async () => { @@ -69,7 +71,7 @@ export const AppProvider = (props: React.PropsWithChildren<{}>) => { } if (oraiWallet || mobileMode) { - oraiAddress = await window.Keplr.getKeplrAddr(); + oraiAddress = await window.Keplr.getKeplrAddr("Oraichain"); if (oraiAddress) { handleSetOraiAddress({ oraiAddress }); @@ -100,6 +102,7 @@ export const AppProvider = (props: React.PropsWithChildren<{}>) => { useEffect(() => { if (oraiAddress) { const cosmosAddress = getAddressCosmos(oraiAddress); + console.log("first", cosmosAddress); loadToken({ oraiAddress, cosmosAddress, @@ -111,6 +114,7 @@ export const AppProvider = (props: React.PropsWithChildren<{}>) => { (async () => { if (walletType && typeof window !== "undefined") { const cosmWasmClient = await getCosmWasmClient({ + env: process.env.NEXT_PUBLIC_ENV as Environment, chainId: network.chainId, }); if (cosmWasmClient && cosmWasmClient.client) { diff --git a/contexts/ton-provider.tsx b/contexts/ton-provider.tsx index 205f398..b4f7526 100644 --- a/contexts/ton-provider.tsx +++ b/contexts/ton-provider.tsx @@ -1,6 +1,6 @@ "use client"; -import { TonNetwork } from "@/constants/ton"; +import { Environment } from "@/constants/ton"; import { MANIFEST_URL } from "@/constants/config"; import { useLoadTonBalance } from "@/hooks/useLoadToken"; import { useAuthTonAddress } from "@/stores/authentication/selector"; @@ -12,7 +12,7 @@ export const TonProvider = (props: React.PropsWithChildren<{}>) => { const { loadAllBalanceTonToken } = useLoadTonBalance({ tonAddress, - tonNetwork: TonNetwork.Mainnet, + tonNetwork: Environment.Mainnet, }); const [isMounted, setIsMounted] = useState(false); diff --git a/firebase.json b/firebase.json index a7c59b8..b1e80b4 100644 --- a/firebase.json +++ b/firebase.json @@ -43,6 +43,50 @@ "destination": "/index.html" } ] + }, + { + "target": "ton-bridge-staging", + "public": "out", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "headers": [ + { + "source": "**/*.@(jpg|jpeg|gif|png|svg|webp)", + "headers": [ + { + "key": "Cache-Control", + "value": "max-age=604800" // Cache images for 7 days + } + ] + }, + { + "source": "**/*.@(css|js)", + "headers": [ + { + "key": "Cache-Control", + "value": "max-age=604800" // Cache CSS and JS files for 7 days + } + ] + }, + { + "source": "/index.html", + "headers": [ + { + "key": "Cache-Control", + "value": "no-cache, no-store, must-revalidate" // Do not cache the main HTML file + } + ] + } + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] } ] } \ No newline at end of file diff --git a/helper/index.tsx b/helper/index.tsx index 517f219..298a077 100644 --- a/helper/index.tsx +++ b/helper/index.tsx @@ -1,4 +1,4 @@ -import { network } from "@/constants/networks"; +import { getNetworkConfig } from "@/constants/networks"; import { BSC_SCAN, BigDecimal, @@ -34,6 +34,7 @@ import { OraiWallet, TonWallet, } from "@/stores/authentication/useAuthenticationStore"; +import { Environment } from "@/constants/ton"; export interface Tokens { denom?: string; @@ -132,14 +133,19 @@ export const getTransactionUrl = ( case "kawaii_6886-1": return `${KWT_SCAN}/tx/${transactionHash}`; case "Oraichain": - return `${network.explorer}/txs/${transactionHash}`; + return `${ + getNetworkConfig(process.env.NEXT_PUBLIC_ENV as Environment) + .explorer + }/txs/${transactionHash}`; } return null; } }; export const getAccountUrl = (account: string) => { - return `${network.explorer}/account/${account}`; + return `${ + getNetworkConfig(process.env.NEXT_PUBLIC_ENV as Environment).explorer + }/account/${account}`; }; export const getNetworkGasPrice = async (chainId): Promise => { diff --git a/hooks/useLoadToken.ts b/hooks/useLoadToken.ts index 9dc93e2..1be0a5c 100644 --- a/hooks/useLoadToken.ts +++ b/hooks/useLoadToken.ts @@ -6,10 +6,14 @@ import { tokenMap, } from "@/constants/bridgeTokens"; import { chainInfos } from "@/constants/chainInfo"; -import { TonNetwork } from "@/constants/ton"; +import { Environment } from "@/constants/ton"; import { TON_ZERO_ADDRESS, TonTokensContract } from "@/constants/contract"; -import { network } from "@/constants/networks"; -import { TonTokenList } from "@/constants/tokens"; +import { getNetworkConfig } from "@/constants/networks"; +import { + OsmosisTokenDenom, + OsmosisTokenList, + TonTokenList, +} from "@/constants/tokens"; import { genAddressCosmos, handleCheckWallet } from "@/helper"; import { useAmountsCache, useTokenActions } from "@/stores/token/selector"; import { fromBinary, toBinary } from "@cosmjs/cosmwasm-stargate"; @@ -17,13 +21,13 @@ import { StargateClient } from "@cosmjs/stargate"; import { MulticallQueryClient } from "@oraichain/common-contracts-sdk"; import { OraiswapTokenTypes } from "@oraichain/oraidex-contracts-sdk"; import { useEffect } from "react"; - -import { CW20_DECIMALS, toDisplay } from "@oraichain/oraidex-common"; +import { toDisplay } from "@oraichain/oraidex-common"; import { JettonMinter, JettonWallet } from "@oraichain/ton-bridge-contracts"; import { getHttpEndpoint } from "@orbs-network/ton-access"; import { Address } from "@ton/core"; import { TonClient } from "@ton/ton"; +const env = process.env.NEXT_PUBLIC_ENV as Environment; async function loadNativeBalance( dispatch: (amount: AmountDetails) => void, address: string, @@ -37,51 +41,30 @@ async function loadNativeBalance( let amountDetails: AmountDetails = {}; // reset native balances - [...cosmosTokens] + [...cosmosTokens, ...OsmosisTokenList(env)] .filter((t) => t.chainId === tokenInfo.chainId && !t.contractAddress) .forEach((t) => { amountDetails[t.denom] = "0"; }); const tokensAmount = amountAll - .filter((coin) => tokenMap[coin.denom]) + .filter( + (coin) => + tokenMap[coin.denom] || + [...Object.values(OsmosisTokenDenom[Environment.Staging])].includes( + coin.denom + ) + ) .map((coin) => [coin.denom, coin.amount]); Object.assign(amountDetails, Object.fromEntries(tokensAmount)); dispatch(amountDetails); } catch (ex) { - console.trace("errror"); + console.trace("error"); console.log(ex); } } -const timer = {}; - -async function loadTokensCosmos( - dispatch: (amount: AmountDetails) => void, - kwtAddress: string, - oraiAddress: string -) { - if (!kwtAddress && !oraiAddress) return; - await handleCheckWallet(); - const cosmosInfos = chainInfos.filter( - (chainInfo) => - (chainInfo.networkType === "cosmos" || - chainInfo.bip44.coinType === 118) && - // TODO: ignore oraibtc - chainInfo.chainId !== ("oraibtc-mainnet-1" as string) - ); - for (const chainInfo of cosmosInfos) { - const { cosmosAddress } = genAddressCosmos( - chainInfo, - kwtAddress, - oraiAddress - ); - if (!cosmosAddress) continue; - loadNativeBalance(dispatch, cosmosAddress, chainInfo); - } -} - async function loadCw20Balance( dispatch: (amount: AmountDetails) => void, address: string @@ -95,7 +78,10 @@ async function loadCw20Balance( balance: { address }, }); - const multicall = new MulticallQueryClient(window.client, network.multicall); + const multicall = new MulticallQueryClient( + window.client, + getNetworkConfig(env).multicall + ); const res = await multicall.aggregate({ queries: cw20Tokens.map((t) => ({ @@ -150,7 +136,10 @@ async function loadCw20BalanceWithSpecificTokens( balance: { address }, }); - const multicall = new MulticallQueryClient(window.client, network.multicall); + const multicall = new MulticallQueryClient( + window.client, + getNetworkConfig(env).multicall + ); const res = await multicall.aggregate({ queries: cw20Tokens.map((t) => ({ @@ -177,25 +166,12 @@ async function loadCw20BalanceWithSpecificTokens( return amountDetails; } -// async function loadNativeBtcBalance(address: string, chain: CustomChainInfo) { -// const data = await getUtxos(address, chain.rest); -// const total = reduce( -// data, -// function (sum, n) { -// return sum + n.value; -// }, -// 0 -// ); - -// return total; -// } - export const useLoadTonBalance = ({ tonAddress, - tonNetwork = TonNetwork.Mainnet, + tonNetwork = Environment.Mainnet, }: { tonAddress: string; - tonNetwork?: TonNetwork; + tonNetwork?: Environment; // address: string }) => { const { handleSetTonAmountsCache } = useTokenActions(); @@ -332,7 +308,7 @@ export const useLoadTonBalance = ({ const loadTonBalance = ( dispatch: (amount: AmountDetails) => void, address: string, - tonNetwork: TonNetwork = TonNetwork.Mainnet + tonNetwork: Environment = Environment.Mainnet ) => { return {}; }; @@ -340,8 +316,6 @@ const loadTonBalance = ( export const useLoadToken = () => { const amounts = useAmountsCache(); const { handleSetAmountsCache, handleSetTonAmountsCache } = useTokenActions(); - // const oraiAddress = useAuthOraiAddress(); - // const tonAddress = useAuthTonAddress(); const loadToken = ({ oraiAddress, @@ -355,7 +329,10 @@ export const useLoadToken = () => { loadNativeBalance( (amounts) => handleSetAmountsCache(amounts), oraiAddress, - { chainId: network.chainId, rpc: network.rpc } + { + chainId: getNetworkConfig(env).chainId, + rpc: getNetworkConfig(env).rpc, + } ); loadCw20Balance((amounts) => handleSetAmountsCache(amounts), oraiAddress); } @@ -366,6 +343,8 @@ export const useLoadToken = () => { ); for (const chainInfo of cosmosInfos) { + console.log("chainInfo", chainInfo); + loadNativeBalance( (amounts) => handleSetAmountsCache(amounts), cosmosAddress, @@ -373,13 +352,6 @@ export const useLoadToken = () => { ); } } - - // if (tonAddress) { - // loadTonBalance( - // (amounts) => handleSetTonAmountsCache(amounts), - // oraiAddress - // ); - // } }; return { diff --git a/libs/bitcoin.ts b/libs/bitcoin.ts index 9110177..f5c832c 100644 --- a/libs/bitcoin.ts +++ b/libs/bitcoin.ts @@ -1,6 +1,6 @@ import { Key } from "@keplr-wallet/types"; -import { network } from "@/constants/networks"; +import { getNetworkConfig } from "@/constants/networks"; import { bitcoinChainId } from "@/helper/constants"; export type BitcoinMode = "core" | "extension" | "mobile-web" | "walletconnect"; // import { CosmosChainId, BitcoinWallet } from '@oraichain/oraidex-common'; @@ -25,9 +25,9 @@ export interface IBitcoin { export default class Bitcoin { constructor() {} disconnect() {} - async getBitcoinKey(chainId?: string): Promise { + async getBitcoinKey(chainId: string = "Oraichain"): Promise { try { - chainId = chainId ?? network.chainId; + chainId = chainId; if (!chainId) return undefined; if (!window.owallet) { diff --git a/libs/cosmjs.ts b/libs/cosmjs.ts index d650c7d..45b969b 100644 --- a/libs/cosmjs.ts +++ b/libs/cosmjs.ts @@ -4,31 +4,41 @@ import { OfflineSigner } from "@cosmjs/proto-signing"; import { Coin, GasPrice } from "@cosmjs/stargate"; import { Tendermint37Client } from "@cosmjs/tendermint-rpc"; import { Stargate } from "@injectivelabs/sdk-ts"; -import { network } from "@/constants/networks"; +import { getNetworkConfig } from "@/constants/networks"; import { MetamaskOfflineSigner } from "./eip191"; import { getWalletByNetworkCosmosFromStorage } from "@/helper"; +import { Environment } from "@/constants/ton"; export type clientType = "cosmwasm" | "injective"; const collectWallet = async (chainId: string) => { const keplr = await window.Keplr.getKeplr(); if (keplr) return await keplr.getOfflineSignerAuto(chainId); if (window.ethereum) - return await MetamaskOfflineSigner.connect(window.ethereum, network.denom); + return await MetamaskOfflineSigner.connect(window.ethereum, "orai"); throw new Error( "You have to install Cosmos wallet first if you do not use a mnemonic to sign transactions" ); }; const getCosmWasmClient = async ( - config: { signer?: OfflineSigner; chainId?: string; rpc?: string }, + config: { + signer?: OfflineSigner; + chainId?: string; + rpc?: string; + env?: Environment; + }, options?: cosmwasm.SigningCosmWasmClientOptions ) => { try { - const { chainId, rpc, signer } = config; + const { chainId, rpc, signer, env } = config; + if (!rpc && !env) { + throw new Error("Rpc or env must be provided"); + } const wallet = signer ?? (await collectWallet(chainId)); const defaultAddress = (await wallet.getAccounts())[0]; + const tmClient = await Tendermint37Client.connect( - rpc ?? (network.rpc as string) + rpc ?? getNetworkConfig(env).rpc ); const client = await cosmwasm.SigningCosmWasmClient.createWithSigner( tmClient, @@ -36,7 +46,9 @@ const getCosmWasmClient = async ( options ? { ...options, broadcastPollIntervalMs: 600 } : { - gasPrice: GasPrice.fromString(network.fee.gasPrice + network.denom), + gasPrice: GasPrice.fromString( + getNetworkConfig(env).fee.gasPrice + getNetworkConfig(env).denom + ), broadcastPollIntervalMs: 600, } ); @@ -84,7 +96,7 @@ class CosmJs { const walletType = this.getWalletByFromStorage(); const keplr = await window.Keplr.getKeplr(); if (keplr || (walletType && walletType === "eip191")) { - await window.Keplr.suggestChain(network.chainId); + await window.Keplr.suggestChain("Oraichain"); const result = await window.client.execute( data.walletAddr, data.address, @@ -115,7 +127,7 @@ class CosmJs { const walletType = this.getWalletByFromStorage(); const keplr = await window.Keplr.getKeplr(); if (keplr || (walletType && walletType === "eip191")) { - await window.Keplr.suggestChain(network.chainId); + await window.Keplr.suggestChain("Oraichain"); const result = await window.client.executeMultiple( data.walletAddr, data.msgs, diff --git a/libs/eip191.ts b/libs/eip191.ts index 9669e65..d90161e 100644 --- a/libs/eip191.ts +++ b/libs/eip191.ts @@ -79,20 +79,15 @@ export class MetamaskOfflineSigner implements OfflineAminoSigner { try { const result = localStorage.getItem(EIP_EIP_STORAGE_KEY_ACC); const parsedResult = JSON.parse(result); - return ( - { - ...parsedResult, - accounts: [ - { - ...parsedResult.accounts[0], - pubkey: this.stringToUint8Array(parsedResult.accounts[0].pubkey), - }, - ], - } ?? { - accounts: [], - cosmosToEvm: {}, - } - ); + return { + ...parsedResult, + accounts: [ + { + ...parsedResult.accounts[0], + pubkey: this.stringToUint8Array(parsedResult.accounts[0].pubkey), + }, + ], + }; } catch (error) { console.log("error getAccountFromStorage: ", error); return { accounts: [], cosmosToEvm: {} }; diff --git a/libs/keplr.ts b/libs/keplr.ts index 7f4252c..592567c 100644 --- a/libs/keplr.ts +++ b/libs/keplr.ts @@ -15,7 +15,7 @@ import { import { isMobile } from "@walletconnect/browser-utils"; // import { displayToast, TToastType } from 'components/Toasts/Toast'; import { chainInfos, OraiBTCBridgeNetwork } from "@/constants/chainInfo"; -import { network } from "@/constants/networks"; +import { getNetworkConfig } from "@/constants/networks"; import { getAddress, getAddressByEIP191 } from "@/helper"; import { EIP_EIP_STORAGE_KEY_ACC, MetamaskOfflineSigner } from "./eip191"; import { displayToast, TToastType } from "@/contexts/toasts/Toast"; @@ -25,10 +25,7 @@ export default class Keplr extends CosmosWallet { const keplr = await this.getKeplr(); if (keplr) return await keplr.getOfflineSignerAuto(chainId); if (window.ethereum) - return await MetamaskOfflineSigner.connect( - window.ethereum, - network.denom - ); + return await MetamaskOfflineSigner.connect(window.ethereum, "orai"); throw new Error( "You have to install Cosmos wallet first if you do not use a mnemonic to sign transactions" ); @@ -142,9 +139,9 @@ export default class Keplr extends CosmosWallet { }); } - async getKeplrKey(chainId?: string): Promise { + async getKeplrKey(chainId: string): Promise { try { - chainId = chainId ?? network.chainId; + chainId = chainId; if (!chainId) return undefined; const keplr = await this.getKeplr(); @@ -159,9 +156,11 @@ export default class Keplr extends CosmosWallet { } } - async getKeplrAddr(chainId?: NetworkChainId): Promise { + async getKeplrAddr( + chainId: NetworkChainId = "Oraichain" + ): Promise { // not support network.chainId (Oraichain) - chainId = chainId ?? network.chainId; + chainId = chainId; try { if (this.typeWallet === ("eip191" as any)) { // TODO: cache if type wallet is eip191 ( metamask cosmos ) diff --git a/libs/nomic/models/nomic-client/nomic-client.ts b/libs/nomic/models/nomic-client/nomic-client.ts index c3b272d..89f300f 100644 --- a/libs/nomic/models/nomic-client/nomic-client.ts +++ b/libs/nomic/models/nomic-client/nomic-client.ts @@ -68,7 +68,7 @@ export class NomicClient implements NomicClientInterface { // @ts-ignore-check await window.Keplr.suggestChain(Config.chainId); const sender = await window.Keplr.getKeplrAddr(Config.chainId as any); - const receiver = await window.Keplr.getKeplrAddr(); + const receiver = await window.Keplr.getKeplrAddr("Oraichain"); if (!sender || !receiver) { return; } diff --git a/libs/utils.ts b/libs/utils.ts index 1d9c651..26a524c 100644 --- a/libs/utils.ts +++ b/libs/utils.ts @@ -1,10 +1,10 @@ import { cosmosTokens, tokenMap } from "@/constants/bridgeTokens"; import { chainInfos } from "@/constants/chainInfo"; -import { network } from "@/constants/networks"; +import { getNetworkConfig } from "@/constants/networks"; +import { Environment } from "@/constants/ton"; import { CoinGeckoPrices } from "@/hooks/useCoingecko"; import { getCosmWasmClient } from "@/libs/cosmjs"; import { - COSMOS_CHAIN_ID_COMMON, NetworkChainId, TokenItemType, getSubAmountDetails, @@ -254,14 +254,18 @@ export const initEthereum = async () => { } }; -export const initClient = async () => { +export const initClient = async (env: Environment = Environment.Mainnet) => { try { - // suggest our chain - const arrChainIds = [network.chainId] as NetworkChainId[]; + const chainId = getNetworkConfig(env).chainId; + console.log({ chainId }); + const arrChainIds = [chainId] as NetworkChainId[]; for (const chainId of arrChainIds) { await window.Keplr.suggestChain(chainId); } - const { client } = await getCosmWasmClient({ chainId: network.chainId }); + const { client } = await getCosmWasmClient({ + chainId: chainId, + env, + }); window.client = client; } catch (ex) { console.log({ errorInitClient: ex });