thirdweb 5.96.8 → 5.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bridge/Buy.js +55 -3
- package/dist/cjs/bridge/Buy.js.map +1 -1
- package/dist/cjs/bridge/Chains.js +65 -0
- package/dist/cjs/bridge/Chains.js.map +1 -0
- package/dist/cjs/bridge/Routes.js +20 -1
- package/dist/cjs/bridge/Routes.js.map +1 -1
- package/dist/cjs/bridge/Sell.js +55 -3
- package/dist/cjs/bridge/Sell.js.map +1 -1
- package/dist/cjs/bridge/index.js +3 -1
- package/dist/cjs/bridge/index.js.map +1 -1
- package/dist/cjs/bridge/types/Chain.js +3 -0
- package/dist/cjs/bridge/types/Chain.js.map +1 -0
- package/dist/cjs/pay/buyWithCrypto/getHistory.js +1 -0
- package/dist/cjs/pay/buyWithCrypto/getHistory.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getQuote.js +1 -0
- package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getStatus.js +1 -0
- package/dist/cjs/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js +1 -0
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getHistory.js +1 -0
- package/dist/cjs/pay/buyWithFiat/getHistory.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getPostOnRampQuote.js +1 -0
- package/dist/cjs/pay/buyWithFiat/getPostOnRampQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getStatus.js +1 -0
- package/dist/cjs/pay/buyWithFiat/getStatus.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/isSwapRequiredPostOnramp.js +1 -0
- package/dist/cjs/pay/buyWithFiat/isSwapRequiredPostOnramp.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithCryptoHistory.js +1 -0
- package/dist/cjs/react/core/hooks/pay/useBuyWithCryptoHistory.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithCryptoQuote.js +1 -0
- package/dist/cjs/react/core/hooks/pay/useBuyWithCryptoQuote.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithCryptoStatus.js +1 -0
- package/dist/cjs/react/core/hooks/pay/useBuyWithCryptoStatus.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatHistory.js +1 -0
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatHistory.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatQuote.js +1 -0
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatQuote.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatStatus.js +1 -0
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatStatus.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/connection/autoConnect.js.map +1 -1
- package/dist/cjs/wallets/connection/autoConnectCore.js +18 -2
- package/dist/cjs/wallets/connection/autoConnectCore.js.map +1 -1
- package/dist/esm/bridge/Buy.js +55 -3
- package/dist/esm/bridge/Buy.js.map +1 -1
- package/dist/esm/bridge/Chains.js +62 -0
- package/dist/esm/bridge/Chains.js.map +1 -0
- package/dist/esm/bridge/Routes.js +20 -1
- package/dist/esm/bridge/Routes.js.map +1 -1
- package/dist/esm/bridge/Sell.js +55 -3
- package/dist/esm/bridge/Sell.js.map +1 -1
- package/dist/esm/bridge/index.js +1 -0
- package/dist/esm/bridge/index.js.map +1 -1
- package/dist/esm/bridge/types/Chain.js +2 -0
- package/dist/esm/bridge/types/Chain.js.map +1 -0
- package/dist/esm/pay/buyWithCrypto/getHistory.js +1 -0
- package/dist/esm/pay/buyWithCrypto/getHistory.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getQuote.js +1 -0
- package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getStatus.js +1 -0
- package/dist/esm/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getTransfer.js +1 -0
- package/dist/esm/pay/buyWithCrypto/getTransfer.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getHistory.js +1 -0
- package/dist/esm/pay/buyWithFiat/getHistory.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getPostOnRampQuote.js +1 -0
- package/dist/esm/pay/buyWithFiat/getPostOnRampQuote.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getStatus.js +1 -0
- package/dist/esm/pay/buyWithFiat/getStatus.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/isSwapRequiredPostOnramp.js +1 -0
- package/dist/esm/pay/buyWithFiat/isSwapRequiredPostOnramp.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithCryptoHistory.js +1 -0
- package/dist/esm/react/core/hooks/pay/useBuyWithCryptoHistory.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithCryptoQuote.js +1 -0
- package/dist/esm/react/core/hooks/pay/useBuyWithCryptoQuote.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithCryptoStatus.js +1 -0
- package/dist/esm/react/core/hooks/pay/useBuyWithCryptoStatus.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatHistory.js +1 -0
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatHistory.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatQuote.js +1 -0
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatQuote.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatStatus.js +1 -0
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatStatus.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/connection/autoConnect.js.map +1 -1
- package/dist/esm/wallets/connection/autoConnectCore.js +17 -1
- package/dist/esm/wallets/connection/autoConnectCore.js.map +1 -1
- package/dist/types/bridge/Buy.d.ts +49 -0
- package/dist/types/bridge/Buy.d.ts.map +1 -1
- package/dist/types/bridge/Chains.d.ts +57 -0
- package/dist/types/bridge/Chains.d.ts.map +1 -0
- package/dist/types/bridge/Routes.d.ts +17 -0
- package/dist/types/bridge/Routes.d.ts.map +1 -1
- package/dist/types/bridge/Sell.d.ts +49 -0
- package/dist/types/bridge/Sell.d.ts.map +1 -1
- package/dist/types/bridge/index.d.ts +2 -0
- package/dist/types/bridge/index.d.ts.map +1 -1
- package/dist/types/bridge/types/Chain.d.ts +36 -0
- package/dist/types/bridge/types/Chain.d.ts.map +1 -0
- package/dist/types/pay/buyWithCrypto/getHistory.d.ts +1 -0
- package/dist/types/pay/buyWithCrypto/getHistory.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts +1 -0
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts +1 -0
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts +1 -0
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getHistory.d.ts +2 -0
- package/dist/types/pay/buyWithFiat/getHistory.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getPostOnRampQuote.d.ts +1 -0
- package/dist/types/pay/buyWithFiat/getPostOnRampQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getQuote.d.ts +2 -0
- package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getStatus.d.ts +2 -0
- package/dist/types/pay/buyWithFiat/getStatus.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/isSwapRequiredPostOnramp.d.ts +1 -0
- package/dist/types/pay/buyWithFiat/isSwapRequiredPostOnramp.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithCryptoHistory.d.ts +1 -0
- package/dist/types/react/core/hooks/pay/useBuyWithCryptoHistory.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithCryptoQuote.d.ts +1 -0
- package/dist/types/react/core/hooks/pay/useBuyWithCryptoQuote.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithCryptoStatus.d.ts +1 -0
- package/dist/types/react/core/hooks/pay/useBuyWithCryptoStatus.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithFiatHistory.d.ts +1 -0
- package/dist/types/react/core/hooks/pay/useBuyWithFiatHistory.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithFiatQuote.d.ts +1 -0
- package/dist/types/react/core/hooks/pay/useBuyWithFiatQuote.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithFiatStatus.d.ts +1 -0
- package/dist/types/react/core/hooks/pay/useBuyWithFiatStatus.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/connection/autoConnect.d.ts +6 -0
- package/dist/types/wallets/connection/autoConnect.d.ts.map +1 -1
- package/dist/types/wallets/connection/autoConnectCore.d.ts +13 -5
- package/dist/types/wallets/connection/autoConnectCore.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bridge/Buy.test.ts +36 -0
- package/src/bridge/Buy.ts +57 -1
- package/src/bridge/Chains.test.ts +28 -0
- package/src/bridge/Chains.ts +75 -0
- package/src/bridge/Routes.ts +21 -0
- package/src/bridge/Sell.test.ts +36 -0
- package/src/bridge/Sell.ts +57 -1
- package/src/bridge/index.ts +2 -0
- package/src/bridge/types/Chain.ts +40 -0
- package/src/pay/buyWithCrypto/getHistory.ts +1 -0
- package/src/pay/buyWithCrypto/getQuote.ts +1 -0
- package/src/pay/buyWithCrypto/getStatus.ts +1 -0
- package/src/pay/buyWithCrypto/getTransfer.ts +1 -0
- package/src/pay/buyWithFiat/getHistory.ts +2 -0
- package/src/pay/buyWithFiat/getPostOnRampQuote.ts +1 -0
- package/src/pay/buyWithFiat/getQuote.ts +2 -0
- package/src/pay/buyWithFiat/getStatus.ts +2 -0
- package/src/pay/buyWithFiat/isSwapRequiredPostOnramp.ts +1 -0
- package/src/react/core/hooks/pay/useBuyWithCryptoHistory.ts +1 -0
- package/src/react/core/hooks/pay/useBuyWithCryptoQuote.ts +1 -0
- package/src/react/core/hooks/pay/useBuyWithCryptoStatus.ts +1 -0
- package/src/react/core/hooks/pay/useBuyWithFiatHistory.ts +1 -0
- package/src/react/core/hooks/pay/useBuyWithFiatQuote.ts +1 -0
- package/src/react/core/hooks/pay/useBuyWithFiatStatus.ts +1 -0
- package/src/version.ts +1 -1
- package/src/wallets/connection/autoConnect.ts +6 -0
- package/src/wallets/connection/autoConnectCore.test.ts +13 -0
- package/src/wallets/connection/autoConnectCore.ts +40 -13
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useBuyWithCryptoQuote.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/pay/useBuyWithCryptoQuote.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"useBuyWithCryptoQuote.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/pay/useBuyWithCryptoQuote.ts"],"names":[],"mappings":";;AA4EA,sDAkBC;AA9FD,uDAI+B;AAC/B,2EAImD;AAUnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,SAAgB,qBAAqB,CACnC,MAAoC,EACpC,WAA4C;IAE5C,OAAO,IAAA,sBAAQ,EAAC;QACd,GAAG,WAAW;QACd,QAAQ,EAAE,CAAC,oBAAoB,EAAE,MAAM,CAAC;QACxC,eAAe,EAAE,MAAM;QACvB,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC9C,CAAC;YAED,OAAO,IAAA,mCAAqB,EAAC,MAAM,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;AACL,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useBuyWithCryptoStatus.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/pay/useBuyWithCryptoStatus.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"useBuyWithCryptoStatus.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/pay/useBuyWithCryptoStatus.ts"],"names":[],"mappings":";;AAyDA,wDAoBC;AA7ED,uDAAiD;AACjD,6EAIoD;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,SAAgB,sBAAsB,CAAC,MAAiC;IACtE,OAAO,IAAA,sBAAQ,EAA6B;QAC1C,QAAQ,EAAE,CAAC,wBAAwB,EAAE,MAAM,EAAE,eAAe,CAAU;QACtE,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;YAC/B,CAAC;YACD,OAAO,IAAA,qCAAsB,EAAC,MAAM,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,MAAM,GAAI,KAAK,CAAC,KAAK,CAAC,IAA4B,EAAE,MAAM,CAAC;YACjE,IAAI,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAClD,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,2BAA2B,EAAE,IAAI;QACjC,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;AACL,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useBuyWithFiatHistory.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/pay/useBuyWithFiatHistory.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"useBuyWithFiatHistory.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/pay/useBuyWithFiatHistory.ts"],"names":[],"mappings":";;AAuCA,sDAeC;AAtDD,uDAI+B;AAC/B,6EAImD;AAUnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,qBAAqB,CACnC,MAAiC,EACjC,WAA4C;IAE5C,OAAO,IAAA,sBAAQ,EAAC;QACd,GAAG,WAAW;QACd,QAAQ,EAAE,CAAC,oBAAoB,EAAE,MAAM,CAAC;QACxC,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;YACzC,CAAC;YACD,OAAO,IAAA,qCAAqB,EAAC,MAAM,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,EAAE,CAAC,CAAC,MAAM;KAClB,CAAC,CAAC;AACL,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useBuyWithFiatQuote.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/pay/useBuyWithFiatQuote.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"useBuyWithFiatQuote.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/pay/useBuyWithFiatQuote.ts"],"names":[],"mappings":";;AAiEA,kDAgBC;AAjFD,uDAI+B;AAC/B,yEAIiD;AAUjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,SAAgB,mBAAmB,CACjC,MAAkC,EAClC,YAA2C;IAE3C,OAAO,IAAA,sBAAQ,EAAC;QACd,GAAG,YAAY;QACf,QAAQ,EAAE,CAAC,qBAAqB,EAAE,MAAM,CAAC;QACzC,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACxC,CAAC;YACD,OAAO,IAAA,iCAAmB,EAAC,MAAM,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;AACL,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useBuyWithFiatStatus.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/pay/useBuyWithFiatStatus.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"useBuyWithFiatStatus.js","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/pay/useBuyWithFiatStatus.ts"],"names":[],"mappings":";;AAqCA,oDAiCC;AAtED,uDAAsE;AACtE,2EAIkD;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAgB,oBAAoB,CAClC,MAA+D;IAE/D,OAAO,IAAA,sBAAQ,EAAC;QACd,QAAQ,EAAE,CAAC,sBAAsB,EAAE,MAAM,CAAC;QAC1C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACxC,CAAC;YACD,OAAO,IAAA,mCAAoB,EAAC,MAAM,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,EAAE,CAAC,CAAC,MAAM;QACjB,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAyB,CAAC;YACnD,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC;YAC5B,IACE,MAAM,KAAK,yBAAyB;gBACpC,MAAM,KAAK,gBAAgB;gBAC3B,MAAM,KAAK,uBAAuB;gBAClC,gFAAgF;gBAChF,CAAC,MAAM,KAAK,4BAA4B;oBACtC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO;oBAC/D,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,EAAE;wBAC5C,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,EACvD,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,2BAA2B,EAAE,IAAI;QACjC,KAAK,EAAE,IAAI;QACX,GAAG,MAAM,EAAE,YAAY;KACxB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/cjs/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"autoConnect.js","sourceRoot":"","sources":["../../../../src/wallets/connection/autoConnect.ts"],"names":[],"mappings":";;AA+BA,
|
1
|
+
{"version":3,"file":"autoConnect.js","sourceRoot":"","sources":["../../../../src/wallets/connection/autoConnect.ts"],"names":[],"mappings":";;AA+BA,kCAiCC;AAhED,qEAAoE;AACpE,0DAAmD;AACnD,4DAAyD;AACzD,2DAAuE;AAEvE,kDAA8D;AAC9D,6DAAuD;AAGvD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,KAAK,UAAU,WAAW,CAC/B,KAQC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,IAAA,qCAAiB,EAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAA,kCAAuB,EAAC,+BAAe,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,IAAA,oCAAe,EAAC;QACnC,OAAO,EAAE,+BAAe;QACxB,KAAK,EAAE;YACL,GAAG,KAAK;YACR,OAAO;SACR;QACD,cAAc,EAAE,+BAAY;QAC5B,mBAAmB,EAAE,GAAG,EAAE;YACxB,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAE7D,gFAAgF;YAChF,MAAM,gBAAgB,GAAG,IAAA,0CAA2B,GAAE;iBACnD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACnD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,+BAAY,EAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAEzC,OAAO,gBAAgB,CAAC;QAC1B,CAAC;QACD,OAAO;KACR,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
@@ -7,10 +7,27 @@ const is_ecosystem_wallet_js_1 = require("../ecosystem/is-ecosystem-wallet.js");
|
|
7
7
|
const client_scoped_storage_js_1 = require("../in-app/core/authentication/client-scoped-storage.js");
|
8
8
|
const get_url_token_js_1 = require("../in-app/web/lib/get-url-token.js");
|
9
9
|
const index_js_1 = require("../manager/index.js");
|
10
|
+
let lastAutoConnectionResultPromise = undefined;
|
10
11
|
/**
|
11
12
|
* @internal
|
12
13
|
*/
|
13
|
-
const autoConnectCore = async (
|
14
|
+
const autoConnectCore = async (props) => {
|
15
|
+
// if an auto connect was attempted already
|
16
|
+
if (lastAutoConnectionResultPromise && !props.force) {
|
17
|
+
// wait for its resolution
|
18
|
+
const lastResult = await lastAutoConnectionResultPromise;
|
19
|
+
// if it was successful, return true
|
20
|
+
// if not continue with the new auto connect
|
21
|
+
if (lastResult) {
|
22
|
+
return true;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
const resultPromise = _autoConnectCore(props);
|
26
|
+
lastAutoConnectionResultPromise = resultPromise;
|
27
|
+
return resultPromise;
|
28
|
+
};
|
29
|
+
exports.autoConnectCore = autoConnectCore;
|
30
|
+
const _autoConnectCore = async ({ storage, props, createWalletFn, manager, connectOverride, getInstalledWallets, setLastAuthProvider, }) => {
|
14
31
|
const { wallets, onConnect } = props;
|
15
32
|
const timeout = props.timeout ?? 15000;
|
16
33
|
let autoConnected = false;
|
@@ -121,7 +138,6 @@ const autoConnectCore = async ({ storage, props, createWalletFn, manager, connec
|
|
121
138
|
manager.isAutoConnecting.setValue(false);
|
122
139
|
return autoConnected; // useQuery needs a return value
|
123
140
|
};
|
124
|
-
exports.autoConnectCore = autoConnectCore;
|
125
141
|
/**
|
126
142
|
* @internal
|
127
143
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"autoConnectCore.js","sourceRoot":"","sources":["../../../../src/wallets/connection/autoConnectCore.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"autoConnectCore.js","sourceRoot":"","sources":["../../../../src/wallets/connection/autoConnectCore.ts"],"names":[],"mappings":";;;AAuMA,wDAWC;AA/MD,qEAA+D;AAC/D,gFAAwE;AACxE,qGAA6F;AAK7F,yEAAiE;AAEjE,kDAK6B;AAyB7B,IAAI,+BAA+B,GAAiC,SAAS,CAAC;AAE9E;;GAEG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,KAA2B,EAAE,EAAE;IACnE,2CAA2C;IAC3C,IAAI,+BAA+B,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACpD,0BAA0B;QAC1B,MAAM,UAAU,GAAG,MAAM,+BAA+B,CAAC;QACzD,oCAAoC;QACpC,4CAA4C;QAC5C,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9C,+BAA+B,GAAG,aAAa,CAAC;IAChD,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAfW,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AM,CAC1C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,kBAAkB,IAAI,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAC5E,CAAC;IACF,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE,CAAC;QAClC,IAAI,CAAC;YACH,MAAM,sBAAsB,CAAC;gBAC3B,MAAM;gBACN,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,kBAAkB;gBAClB,UAAU,EAAE,MAAM,EAAE,UAAU;aAC/B,CAAC,CAAC;YACH,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACrC,CAAC;QAAC,MAAM,CAAC;YACP,QAAQ;QACV,CAAC;IACH,CAAC;IACD,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,aAAa,CAAC,CAAC,gCAAgC;AACxD,CAAC,CAAC;AAEF;;GAEG;AACI,KAAK,UAAU,sBAAsB,CAAC,KAK5C;IACC,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;QAC9B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,KAAK,EAAE,KAAK,CAAC,kBAAkB;QAC/B,UAAU,EAAE,KAAK,CAAC,UAAU;KAC7B,CAAC,CAAC;AACL,CAAC"}
|
package/dist/esm/bridge/Buy.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { defineChain } from "../chains/utils.js";
|
2
2
|
import { getClientFetch } from "../utils/fetch.js";
|
3
|
+
import { stringify } from "../utils/json.js";
|
3
4
|
import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
4
5
|
/**
|
5
6
|
* Retrieves a Universal Bridge quote for the provided buy intent. The quote will specify the necessary `originAmount` to receive the desired `destinationAmount`, which is specified with the `buyAmountWei` option.
|
@@ -66,12 +67,27 @@ import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
|
66
67
|
*
|
67
68
|
* You can access this functions input and output types with `Buy.quote.Options` and `Buy.quote.Result`, respectively.
|
68
69
|
*
|
70
|
+
* To limit quotes to routes that have a certain number of steps involved, use the `maxSteps` option.
|
71
|
+
*
|
72
|
+
* ```ts
|
73
|
+
* const quote = await Bridge.Buy.quote({
|
74
|
+
* originChainId: 1,
|
75
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
76
|
+
* destinationChainId: 10,
|
77
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
78
|
+
* amount: toWei("0.01"),
|
79
|
+
* maxSteps: 2, // Will only return a quote for routes with 2 or fewer steps
|
80
|
+
* client: thirdwebClient,
|
81
|
+
* });
|
82
|
+
* ```
|
83
|
+
*
|
69
84
|
* @param options - The options for the quote.
|
70
85
|
* @param options.originChainId - The chain ID of the origin token.
|
71
86
|
* @param options.originTokenAddress - The address of the origin token.
|
72
87
|
* @param options.destinationChainId - The chain ID of the destination token.
|
73
88
|
* @param options.destinationTokenAddress - The address of the destination token.
|
74
89
|
* @param options.amount - The amount of the destination token to receive.
|
90
|
+
* @param [options.maxSteps] - Limit the number of total steps in the route.
|
75
91
|
* @param options.client - Your thirdweb client.
|
76
92
|
*
|
77
93
|
* @returns A promise that resolves to a non-finalized quote for the requested buy.
|
@@ -81,7 +97,7 @@ import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
|
81
97
|
* @beta
|
82
98
|
*/
|
83
99
|
export async function quote(options) {
|
84
|
-
const { originChainId, originTokenAddress, destinationChainId, destinationTokenAddress, client, } = options;
|
100
|
+
const { originChainId, originTokenAddress, destinationChainId, destinationTokenAddress, client, maxSteps, } = options;
|
85
101
|
const amount = "buyAmountWei" in options ? options.buyAmountWei : options.amount;
|
86
102
|
const clientFetch = getClientFetch(client);
|
87
103
|
const url = new URL(`${UNIVERSAL_BRIDGE_URL}/buy/quote`);
|
@@ -90,6 +106,9 @@ export async function quote(options) {
|
|
90
106
|
url.searchParams.set("destinationChainId", destinationChainId.toString());
|
91
107
|
url.searchParams.set("destinationTokenAddress", destinationTokenAddress);
|
92
108
|
url.searchParams.set("buyAmountWei", amount.toString());
|
109
|
+
if (maxSteps) {
|
110
|
+
url.searchParams.set("maxSteps", maxSteps.toString());
|
111
|
+
}
|
93
112
|
const response = await clientFetch(url.toString());
|
94
113
|
if (!response.ok) {
|
95
114
|
const errorJson = await response.json();
|
@@ -202,6 +221,37 @@ export async function quote(options) {
|
|
202
221
|
*
|
203
222
|
* You can access this functions input and output types with `Buy.prepare.Options` and `Buy.prepare.Result`, respectively.
|
204
223
|
*
|
224
|
+
* You can include arbitrary data to be included on any webhooks and status responses with the `purchaseData` option.
|
225
|
+
*
|
226
|
+
* ```ts
|
227
|
+
* const quote = await Bridge.Buy.prepare({
|
228
|
+
* originChainId: 1,
|
229
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
230
|
+
* destinationChainId: 10,
|
231
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
232
|
+
* amount: toWei("0.01"),
|
233
|
+
* purchaseData: {
|
234
|
+
* size: "large",
|
235
|
+
* shippingAddress: "123 Main St, New York, NY 10001",
|
236
|
+
* },
|
237
|
+
* client: thirdwebClient,
|
238
|
+
* });
|
239
|
+
* ```
|
240
|
+
*
|
241
|
+
* To limit quotes to routes that have a certain number of steps involved, use the `maxSteps` option.
|
242
|
+
*
|
243
|
+
* ```ts
|
244
|
+
* const quote = await Bridge.Buy.prepare({
|
245
|
+
* originChainId: 1,
|
246
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
247
|
+
* destinationChainId: 10,
|
248
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
249
|
+
* amount: toWei("0.01"),
|
250
|
+
* maxSteps: 2, // Will only return a quote for routes with 2 or fewer steps
|
251
|
+
* client: thirdwebClient,
|
252
|
+
* });
|
253
|
+
* ```
|
254
|
+
*
|
205
255
|
* @param options - The options for the quote.
|
206
256
|
* @param options.originChainId - The chain ID of the origin token.
|
207
257
|
* @param options.originTokenAddress - The address of the origin token.
|
@@ -211,6 +261,7 @@ export async function quote(options) {
|
|
211
261
|
* @param options.sender - The address of the sender.
|
212
262
|
* @param options.receiver - The address of the recipient.
|
213
263
|
* @param options.purchaseData - Arbitrary data to be passed to the purchase function and included with any webhooks or status calls.
|
264
|
+
* @param [options.maxSteps] - Limit the number of total steps in the route.
|
214
265
|
* @param options.client - Your thirdweb client.
|
215
266
|
*
|
216
267
|
* @returns A promise that resolves to a finalized quote and transactions for the requested buy.
|
@@ -220,7 +271,7 @@ export async function quote(options) {
|
|
220
271
|
* @beta
|
221
272
|
*/
|
222
273
|
export async function prepare(options) {
|
223
|
-
const { originChainId, originTokenAddress, destinationChainId, destinationTokenAddress, sender, receiver, client, amount, purchaseData, } = options;
|
274
|
+
const { originChainId, originTokenAddress, destinationChainId, destinationTokenAddress, sender, receiver, client, amount, purchaseData, maxSteps, } = options;
|
224
275
|
const clientFetch = getClientFetch(client);
|
225
276
|
const url = new URL(`${UNIVERSAL_BRIDGE_URL}/buy/prepare`);
|
226
277
|
const response = await clientFetch(url.toString(), {
|
@@ -228,7 +279,7 @@ export async function prepare(options) {
|
|
228
279
|
headers: {
|
229
280
|
"Content-Type": "application/json",
|
230
281
|
},
|
231
|
-
body:
|
282
|
+
body: stringify({
|
232
283
|
buyAmountWei: amount.toString(),
|
233
284
|
originChainId: originChainId.toString(),
|
234
285
|
originTokenAddress,
|
@@ -237,6 +288,7 @@ export async function prepare(options) {
|
|
237
288
|
sender,
|
238
289
|
receiver,
|
239
290
|
purchaseData,
|
291
|
+
maxSteps,
|
240
292
|
}),
|
241
293
|
});
|
242
294
|
if (!response.ok) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Buy.js","sourceRoot":"","sources":["../../../src/bridge/Buy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD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C;QACjD,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;QACpE,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;QACvD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC/B,GAAG,IAAI;YACP,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBACpD,GAAG,WAAW;gBACd,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;gBAChE,MAAM;gBACN,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC;aACxC,CAAC,CAAC;SACJ,CAAC,CAAC;QACH,MAAM,EAAE;YACN,aAAa;YACb,kBAAkB;YAClB,kBAAkB;YAClB,uBAAuB;YACvB,MAAM;SACP;KACF,CAAC;AACJ,CAAC"}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { getClientFetch } from "../utils/fetch.js";
|
2
|
+
import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
3
|
+
/**
|
4
|
+
* Retrieves supported Universal Bridge chains.
|
5
|
+
*
|
6
|
+
* @example
|
7
|
+
* ```typescript
|
8
|
+
* import { Bridge } from "thirdweb";
|
9
|
+
*
|
10
|
+
* const chains = await Bridge.chains({
|
11
|
+
* client: thirdwebClient,
|
12
|
+
* });
|
13
|
+
* ```
|
14
|
+
*
|
15
|
+
* Returned chains might look something like:
|
16
|
+
* ```typescript
|
17
|
+
* [
|
18
|
+
* {
|
19
|
+
* chainId: 1,
|
20
|
+
* name: "Ethereum",
|
21
|
+
* icon: "https://assets.thirdweb.com/chains/1.png",
|
22
|
+
* nativeCurrency: {
|
23
|
+
* name: "Ether",
|
24
|
+
* symbol: "ETH",
|
25
|
+
* decimals: 18
|
26
|
+
* }
|
27
|
+
* },
|
28
|
+
* {
|
29
|
+
* chainId: 137,
|
30
|
+
* name: "Polygon",
|
31
|
+
* icon: "https://assets.thirdweb.com/chains/137.png",
|
32
|
+
* nativeCurrency: {
|
33
|
+
* name: "MATIC",
|
34
|
+
* symbol: "MATIC",
|
35
|
+
* decimals: 18
|
36
|
+
* }
|
37
|
+
* }
|
38
|
+
* ]
|
39
|
+
* ```
|
40
|
+
*
|
41
|
+
* @param options - The options for fetching chains.
|
42
|
+
* @param options.client - Your thirdweb client.
|
43
|
+
*
|
44
|
+
* @returns A promise that resolves to an array of chains.
|
45
|
+
*
|
46
|
+
* @throws Will throw an error if there is an issue fetching the chains.
|
47
|
+
* @bridge
|
48
|
+
* @beta
|
49
|
+
*/
|
50
|
+
export async function chains(options) {
|
51
|
+
const { client } = options;
|
52
|
+
const clientFetch = getClientFetch(client);
|
53
|
+
const url = new URL(`${UNIVERSAL_BRIDGE_URL}/chains`);
|
54
|
+
const response = await clientFetch(url.toString());
|
55
|
+
if (!response.ok) {
|
56
|
+
const errorJson = await response.json();
|
57
|
+
throw new Error(`${errorJson.code} | ${errorJson.message}`);
|
58
|
+
}
|
59
|
+
const { data } = await response.json();
|
60
|
+
return data;
|
61
|
+
}
|
62
|
+
//# sourceMappingURL=Chains.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Chains.js","sourceRoot":"","sources":["../../../src/bridge/Chains.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAuB;IAClD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE3B,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,oBAAoB,SAAS,CAAC,CAAC;IAEtD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,CAAC,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAsB,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC"}
|
@@ -82,6 +82,21 @@ import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
|
82
82
|
* });
|
83
83
|
* ```
|
84
84
|
*
|
85
|
+
* You can sort the returned routes by `popularity`:
|
86
|
+
* ```ts
|
87
|
+
* import { Bridge } from "thirdweb";
|
88
|
+
*
|
89
|
+
* // Get the 10 most popular routes starting from mainnet ETH
|
90
|
+
* const routes = await Bridge.routes({
|
91
|
+
* originChainId: 1,
|
92
|
+
* originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
93
|
+
* limit: 10,
|
94
|
+
* offset: 0,
|
95
|
+
* sortBy: "popularity",
|
96
|
+
* client: thirdwebClient,
|
97
|
+
* });
|
98
|
+
* ```
|
99
|
+
*
|
85
100
|
* @param options - The options for the quote.
|
86
101
|
* @param options.client - Your thirdweb client.
|
87
102
|
* @param options.originChainId - Filter by a specific origin chain ID.
|
@@ -90,6 +105,7 @@ import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
|
90
105
|
* @param options.destinationTokenAddress - Filter by a specific destination token address.
|
91
106
|
* @param options.transactionHash - Filter by a specific transaction hash.
|
92
107
|
* @param options.maxSteps - Limit the number of steps returned.
|
108
|
+
* @param options.sortBy - Sort the routes by various categories.
|
93
109
|
* @param options.limit - Limit the number of routes returned.
|
94
110
|
* @param options.offset - Offset the number of routes returned.
|
95
111
|
*
|
@@ -100,7 +116,7 @@ import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
|
100
116
|
* @beta
|
101
117
|
*/
|
102
118
|
export async function routes(options) {
|
103
|
-
const { client, originChainId, originTokenAddress, destinationChainId, destinationTokenAddress, maxSteps, limit, offset, } = options;
|
119
|
+
const { client, originChainId, originTokenAddress, destinationChainId, destinationTokenAddress, maxSteps, sortBy, limit, offset, } = options;
|
104
120
|
const clientFetch = getClientFetch(client);
|
105
121
|
const url = new URL(`${UNIVERSAL_BRIDGE_URL}/routes`);
|
106
122
|
if (originChainId) {
|
@@ -124,6 +140,9 @@ export async function routes(options) {
|
|
124
140
|
if (offset) {
|
125
141
|
url.searchParams.set("offset", offset.toString());
|
126
142
|
}
|
143
|
+
if (sortBy) {
|
144
|
+
url.searchParams.set("sortBy", sortBy);
|
145
|
+
}
|
127
146
|
const response = await clientFetch(url.toString());
|
128
147
|
if (!response.ok) {
|
129
148
|
const errorJson = await response.json();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Routes.js","sourceRoot":"","sources":["../../../src/bridge/Routes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD
|
1
|
+
{"version":3,"file":"Routes.js","sourceRoot":"","sources":["../../../src/bridge/Routes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,EAAE,CAAC;QACX,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpD,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,CAAC,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAsB,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/esm/bridge/Sell.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { defineChain } from "../chains/utils.js";
|
2
2
|
import { getClientFetch } from "../utils/fetch.js";
|
3
|
+
import { stringify } from "../utils/json.js";
|
3
4
|
import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
4
5
|
/**
|
5
6
|
* Retrieves a Universal Bridge quote for the provided sell intent. The quote will specify the expected `destinationAmount` that will be received in exchange for the specified `originAmount`, which is specified with the `sellAmountWei` option.
|
@@ -66,12 +67,27 @@ import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
|
66
67
|
*
|
67
68
|
* You can access this functions input and output types with `Sell.quote.Options` and `Sell.quote.Result`, respectively.
|
68
69
|
*
|
70
|
+
* To limit quotes to routes that have a certain number of steps involved, use the `maxSteps` option.
|
71
|
+
*
|
72
|
+
* ```ts
|
73
|
+
* const quote = await Bridge.Sell.quote({
|
74
|
+
* originChainId: 1,
|
75
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
76
|
+
* destinationChainId: 10,
|
77
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
78
|
+
* amount: toWei("0.01"),
|
79
|
+
* maxSteps: 2, // Will only return a quote for routes with 2 or fewer steps
|
80
|
+
* client: thirdwebClient,
|
81
|
+
* });
|
82
|
+
* ```
|
83
|
+
*
|
69
84
|
* @param options - The options for the quote.
|
70
85
|
* @param options.originChainId - The chain ID of the origin token.
|
71
86
|
* @param options.originTokenAddress - The address of the origin token.
|
72
87
|
* @param options.destinationChainId - The chain ID of the destination token.
|
73
88
|
* @param options.destinationTokenAddress - The address of the destination token.
|
74
89
|
* @param options.amount - The amount of the origin token to sell.
|
90
|
+
* @param [options.maxSteps] - Limit the number of total steps in the route.
|
75
91
|
* @param options.client - Your thirdweb client.
|
76
92
|
*
|
77
93
|
* @returns A promise that resolves to a non-finalized quote for the requested sell.
|
@@ -81,7 +97,7 @@ import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
|
81
97
|
* @beta
|
82
98
|
*/
|
83
99
|
export async function quote(options) {
|
84
|
-
const { originChainId, originTokenAddress, destinationChainId, destinationTokenAddress, amount, client, } = options;
|
100
|
+
const { originChainId, originTokenAddress, destinationChainId, destinationTokenAddress, amount, client, maxSteps, } = options;
|
85
101
|
const clientFetch = getClientFetch(client);
|
86
102
|
const url = new URL(`${UNIVERSAL_BRIDGE_URL}/sell/quote`);
|
87
103
|
url.searchParams.set("originChainId", originChainId.toString());
|
@@ -89,6 +105,9 @@ export async function quote(options) {
|
|
89
105
|
url.searchParams.set("destinationChainId", destinationChainId.toString());
|
90
106
|
url.searchParams.set("destinationTokenAddress", destinationTokenAddress);
|
91
107
|
url.searchParams.set("sellAmountWei", amount.toString());
|
108
|
+
if (typeof maxSteps !== "undefined") {
|
109
|
+
url.searchParams.set("maxSteps", maxSteps.toString());
|
110
|
+
}
|
92
111
|
const response = await clientFetch(url.toString());
|
93
112
|
if (!response.ok) {
|
94
113
|
const errorJson = await response.json();
|
@@ -200,6 +219,37 @@ export async function quote(options) {
|
|
200
219
|
*
|
201
220
|
* You can access this functions input and output types with `Sell.prepare.Options` and `Sell.prepare.Result`, respectively.
|
202
221
|
*
|
222
|
+
* You can include arbitrary data to be included on any webhooks and status responses with the `purchaseData` option.
|
223
|
+
*
|
224
|
+
* ```ts
|
225
|
+
* const quote = await Bridge.Sell.prepare({
|
226
|
+
* originChainId: 1,
|
227
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
228
|
+
* destinationChainId: 10,
|
229
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
230
|
+
* amount: toWei("0.01"),
|
231
|
+
* purchaseData: {
|
232
|
+
* size: "large",
|
233
|
+
* shippingAddress: "123 Main St, New York, NY 10001",
|
234
|
+
* },
|
235
|
+
* client: thirdwebClient,
|
236
|
+
* });
|
237
|
+
* ```
|
238
|
+
*
|
239
|
+
* To limit quotes to routes that have a certain number of steps involved, use the `maxSteps` option.
|
240
|
+
*
|
241
|
+
* ```ts
|
242
|
+
* const quote = await Bridge.Sell.prepare({
|
243
|
+
* originChainId: 1,
|
244
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
245
|
+
* destinationChainId: 10,
|
246
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
247
|
+
* amount: toWei("0.01"),
|
248
|
+
* maxSteps: 2, // Will only return a quote for routes with 2 or fewer steps
|
249
|
+
* client: thirdwebClient,
|
250
|
+
* });
|
251
|
+
* ```
|
252
|
+
*
|
203
253
|
* @param options - The options for the quote.
|
204
254
|
* @param options.originChainId - The chain ID of the origin token.
|
205
255
|
* @param options.originTokenAddress - The address of the origin token.
|
@@ -209,6 +259,7 @@ export async function quote(options) {
|
|
209
259
|
* @param options.sender - The address of the sender.
|
210
260
|
* @param options.receiver - The address of the recipient.
|
211
261
|
* @param options.purchaseData - Arbitrary data to be passed to the purchase function and included with any webhooks or status calls.
|
262
|
+
* @param [options.maxSteps] - Limit the number of total steps in the route.
|
212
263
|
* @param options.client - Your thirdweb client.
|
213
264
|
*
|
214
265
|
* @returns A promise that resolves to a finalized quote and transactions for the requested sell.
|
@@ -218,7 +269,7 @@ export async function quote(options) {
|
|
218
269
|
* @beta
|
219
270
|
*/
|
220
271
|
export async function prepare(options) {
|
221
|
-
const { originChainId, originTokenAddress, destinationChainId, destinationTokenAddress, amount, sender, receiver, client, purchaseData, } = options;
|
272
|
+
const { originChainId, originTokenAddress, destinationChainId, destinationTokenAddress, amount, sender, receiver, client, purchaseData, maxSteps, } = options;
|
222
273
|
const clientFetch = getClientFetch(client);
|
223
274
|
const url = new URL(`${UNIVERSAL_BRIDGE_URL}/sell/prepare`);
|
224
275
|
const response = await clientFetch(url.toString(), {
|
@@ -226,7 +277,7 @@ export async function prepare(options) {
|
|
226
277
|
headers: {
|
227
278
|
"Content-Type": "application/json",
|
228
279
|
},
|
229
|
-
body:
|
280
|
+
body: stringify({
|
230
281
|
sellAmountWei: amount.toString(),
|
231
282
|
originChainId: originChainId.toString(),
|
232
283
|
originTokenAddress,
|
@@ -235,6 +286,7 @@ export async function prepare(options) {
|
|
235
286
|
sender,
|
236
287
|
receiver,
|
237
288
|
purchaseData,
|
289
|
+
maxSteps,
|
238
290
|
}),
|
239
291
|
});
|
240
292
|
if (!response.ok) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Sell.js","sourceRoot":"","sources":["../../../src/bridge/Sell.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD
|
1
|
+
{"version":3,"file":"Sell.js","sourceRoot":"","sources":["../../../src/bridge/Sell.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,C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GAAG,IAAI;YACP,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBACpD,GAAG,WAAW;gBACd,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;gBAChE,MAAM;gBACN,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC;aACxC,CAAC,CAAC;SACJ,CAAC,CAAC;QACH,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,MAAM,EAAE;YACN,aAAa;YACb,kBAAkB;YAClB,kBAAkB;YAClB,uBAAuB;YACvB,MAAM;YACN,YAAY;SACb;KACF,CAAC;AACJ,CAAC"}
|
package/dist/esm/bridge/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bridge/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bridge/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Chain.js","sourceRoot":"","sources":["../../../../src/bridge/types/Chain.ts"],"names":[],"mappings":""}
|
@@ -20,6 +20,7 @@ import { getPayBuyWithCryptoHistoryEndpoint } from "../utils/definitions.js";
|
|
20
20
|
* const status = await getBuyWithCryptoHistory(params)
|
21
21
|
* ```
|
22
22
|
* @returns Object of type [`BuyWithCryptoHistoryData`](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoHistoryData)
|
23
|
+
* @deprecated
|
23
24
|
* @buyCrypto
|
24
25
|
*/
|
25
26
|
export async function getBuyWithCryptoHistory(params) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getHistory.js","sourceRoot":"","sources":["../../../../src/pay/buyWithCrypto/getHistory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,kCAAkC,EAAE,MAAM,yBAAyB,CAAC;AAyC7E
|
1
|
+
{"version":3,"file":"getHistory.js","sourceRoot":"","sources":["../../../../src/pay/buyWithCrypto/getHistory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,kCAAkC,EAAE,MAAM,yBAAyB,CAAC;AAyC7E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAkC;IAElC,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,WAAW,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;QAC1D,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAErD,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC3C,MAAM,GAAG,GAAG,GAAG,kCAAkC,EAAE,IAAI,WAAW,EAAE,CAAC;QAErE,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