From 2ae86600cb29f89b94f44358d4db4bb2db0c65dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?jeesun=20=EC=A7=80=EC=84=A0?= Date: Wed, 13 Nov 2024 10:15:54 -0800 Subject: [PATCH] update the sdk and use 'stellar-xdr-json' (#1154) --- package.json | 4 ++-- src/helpers/StellarXdr.ts | 8 ++++---- src/hooks/useIsXdrInit.ts | 2 +- yarn.lock | 36 ++++++++++++++++++------------------ 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 8b7389cd..bca5dac2 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "@ledgerhq/hw-app-str": "^7.0.4", "@ledgerhq/hw-transport-webusb": "^6.29.4", "@stellar/design-system": "^2.0.0-beta.17", - "@stellar/stellar-sdk": "^13.0.0-beta.1", - "@stellar/stellar-xdr-json-web": "^0.0.2", + "@stellar/stellar-sdk": "^13.0.0-rc.1", + "@stellar/stellar-xdr-json": "^22.0.0-rc.1", "@tanstack/react-query": "^5.59.0", "@tanstack/react-query-devtools": "^5.59.0", "@trezor/connect-plugin-stellar": "^9.0.3", diff --git a/src/helpers/StellarXdr.ts b/src/helpers/StellarXdr.ts index fd92f8bc..c8dc0f70 100644 --- a/src/helpers/StellarXdr.ts +++ b/src/helpers/StellarXdr.ts @@ -1,4 +1,4 @@ -import wasm, { decode, encode, guess } from "@stellar/stellar-xdr-json-web"; +import init, { decode, encode, guess } from "@stellar/stellar-xdr-json"; // A wrapper for the Stellar XDR JSON declare global { @@ -7,11 +7,11 @@ declare global { } } -const init = async () => { +const initialize = async () => { if (!window.__STELLAR_XDR_INIT__) { - await wasm(); + await init(); window.__STELLAR_XDR_INIT__ = true; } }; -export { init, decode, encode, guess }; +export { initialize, decode, encode, guess }; diff --git a/src/hooks/useIsXdrInit.ts b/src/hooks/useIsXdrInit.ts index 8bb63754..679084f5 100644 --- a/src/hooks/useIsXdrInit.ts +++ b/src/hooks/useIsXdrInit.ts @@ -7,7 +7,7 @@ export const useIsXdrInit = () => { useEffect(() => { // Stellar XDR init const init = async () => { - await StellarXdr.init(); + await StellarXdr.initialize(); setIsReady(true); }; diff --git a/yarn.lock b/yarn.lock index 84859d9d..f07c3d2d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1122,10 +1122,10 @@ resolved "https://registry.yarnpkg.com/@stellar/js-xdr/-/js-xdr-3.1.2.tgz#db7611135cf21e989602fd72f513c3bed621bc74" integrity sha512-VVolPL5goVEIsvuGqDc5uiKxV03lzfWdvYg1KikvwheDmTBO68CKDji3bAZ/kppZrx5iTA8z3Ld5yuytcvhvOQ== -"@stellar/stellar-base@13.0.0-beta.1": - version "13.0.0-beta.1" - resolved "https://registry.yarnpkg.com/@stellar/stellar-base/-/stellar-base-13.0.0-beta.1.tgz#e703865c835106bd04b8a9f1e106ed65f6e249f4" - integrity sha512-S5c2FyKwUOc28/3sDoOfPIcdzcbUyfiYRmcUlscZrEX/VVzV12216XRkdWy2MYa8KQNK60MpR7wrGp2MamvVGg== +"@stellar/stellar-base@^13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@stellar/stellar-base/-/stellar-base-13.0.0.tgz#cbe5877600ec1aff9822ab671230a60fd026ad8d" + integrity sha512-zS/F1P2MfvgoIlUxOM3PMAEm76qoP5N7HYiww6y6EMP+j3brVFTnTIlJuYdnRdVaPXC/Z4BpojG3bVyhs32Tiw== dependencies: "@stellar/js-xdr" "^3.1.2" base32.js "^0.1.0" @@ -1134,14 +1134,14 @@ sha.js "^2.3.6" tweetnacl "^1.0.3" optionalDependencies: - sodium-native "^4.1.1" + sodium-native "^4.3.0" -"@stellar/stellar-sdk@^13.0.0-beta.1": - version "13.0.0-beta.1" - resolved "https://registry.yarnpkg.com/@stellar/stellar-sdk/-/stellar-sdk-13.0.0-beta.1.tgz#9a995575b806bea3a383b2d9fe4b1fde065caeb4" - integrity sha512-yJN2HzibhZFJsdLRU83bkUwb9dq1sZRRiQptTJyunVv0hQsF+tTldrP3hHst3LROv/2GWTn20tmAqnp0hkzOhg== +"@stellar/stellar-sdk@^13.0.0-rc.1": + version "13.0.0-rc.1" + resolved "https://registry.yarnpkg.com/@stellar/stellar-sdk/-/stellar-sdk-13.0.0-rc.1.tgz#1caa1a63c63b91c83a8e52b6f3eb30363888d5af" + integrity sha512-a173pQPCuS8/xVET/euwp8UWEFsE68KGF21Xcq46TluDGIq0fKVmJ6mw1LAS2uEOE757rrY24KNGAux4FXR64g== dependencies: - "@stellar/stellar-base" "13.0.0-beta.1" + "@stellar/stellar-base" "^13.0.0" axios "^1.7.7" bignumber.js "^9.1.2" eventsource "^2.0.2" @@ -1150,10 +1150,10 @@ toml "^3.0.0" urijs "^1.19.1" -"@stellar/stellar-xdr-json-web@^0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@stellar/stellar-xdr-json-web/-/stellar-xdr-json-web-0.0.2.tgz#e4a954efb3c67ff875cf92e503b7c80efba5eea6" - integrity sha512-hBZgdTHG9FZhonYZApHapdi8gUhyD7fybgxqhz9tu2UY4iy7AMZgVwlX8Qmpoo8Xr9ap3PxAUZtlwfLg6oUT2w== +"@stellar/stellar-xdr-json@^22.0.0-rc.1": + version "22.0.0-rc.1" + resolved "https://registry.yarnpkg.com/@stellar/stellar-xdr-json/-/stellar-xdr-json-22.0.0-rc.1.tgz#5690afb7776accdb51f82a6358ff80950a6137c1" + integrity sha512-BEVt2F2hmEuBctueFhFTyTh1GPxOZe4wtqhPhiSgc0y5iJb7+iy+ZMABBSQ6+xOx4edbiqR9O8wGHWosAuq4Ew== "@stellar/tsconfig@^1.0.2": version "1.0.2" @@ -5421,10 +5421,10 @@ socks@^2.6.1: ip-address "^9.0.5" smart-buffer "^4.2.0" -sodium-native@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/sodium-native/-/sodium-native-4.1.1.tgz#109bc924dd55c13db87c6dd30da047487595723c" - integrity sha512-LXkAfRd4FHtkQS4X6g+nRcVaN7mWVNepV06phIsC6+IZFvGh1voW5TNQiQp2twVaMf05gZqQjuS+uWLM6gHhNQ== +sodium-native@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/sodium-native/-/sodium-native-4.3.0.tgz#cc76b70824b0e131cbdc5f56d5369eaa89e1ad72" + integrity sha512-OcMgoS0NJx+4yVUlhvL9uZsVZfmyHZ2RpSXkiIoOHMglqvJDeGwn1rUigPrvcNTq3m9hPXtt6syxQbF3vvwmRQ== dependencies: node-gyp-build "^4.8.0"