@coinbase/cdp-react 0.0.37 → 0.0.39
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/README.md +2 -1
- package/dist/assets/AmountInput.css +1 -1
- package/dist/assets/AuthButton.css +1 -1
- package/dist/assets/Button.css +1 -1
- package/dist/assets/ButtonBase.css +1 -1
- package/dist/assets/Error.css +1 -1
- package/dist/assets/Field.css +1 -1
- package/dist/assets/Fund.css +1 -1
- package/dist/assets/FundPaymentMethods.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/Modal.css +1 -1
- package/dist/assets/PhoneNumberInput.css +1 -1
- package/dist/assets/Select.css +1 -1
- package/dist/assets/SendEvmTransactionButton.css +1 -0
- package/dist/assets/SendSolanaTransactionButton.css +1 -0
- package/dist/assets/SignIn.css +1 -1
- package/dist/assets/SuccessMessage.css +1 -1
- package/dist/components/CDPReactProvider/index.js +26 -26
- package/dist/components/Fund/FundProvider.js +78 -74
- package/dist/components/Fund/hooks/useBuyUrl.d.ts +1 -2
- package/dist/components/Fund/hooks/useBuyUrl.js +23 -23
- package/dist/components/Fund/types.d.ts +2 -1
- package/dist/components/{SendTransactionButton → SendEvmTransactionButton}/index.d.ts +2 -2
- package/dist/components/SendEvmTransactionButton/index.js +67 -0
- package/dist/components/SendSolanaTransactionButton/index.d.ts +13 -0
- package/dist/components/SendSolanaTransactionButton/index.js +67 -0
- package/dist/components/SignIn/SignInForm.js +38 -24
- package/dist/components/ui/SwitchTransition/index.js +65 -65
- package/dist/index.d.ts +2 -1
- package/dist/index.js +88 -81
- package/dist/theme/index.js +14 -9
- package/dist/theme/theme.d.ts +116 -18
- package/dist/theme/tokens.d.ts +321 -39
- package/dist/theme/tokens.js +117 -25
- package/dist/theme/utils.d.ts +6 -3
- package/dist/theme/utils.js +16 -18
- package/package.json +5 -5
- package/dist/assets/SendTransactionButton.css +0 -1
- package/dist/components/SendTransactionButton/index.js +0 -67
package/README.md
CHANGED
|
@@ -7,7 +7,8 @@ the CDP frontend SDK.
|
|
|
7
7
|
- {@link SignIn | `SignIn`} - the forms for the sign in flow, a logo, heading, and description text
|
|
8
8
|
- {@link SignOutButton | `SignOutButton`} - a sign out button
|
|
9
9
|
- {@link AuthButton | `AuthButton`} - the `SignOutButton` when logged in, and the `SignInModal` when logged out
|
|
10
|
-
- {@link
|
|
10
|
+
- {@link SendEvmTransactionButton | `SendEvmTransactionButton`} - a button that signs and sends an EVM transaction
|
|
11
|
+
- {@link SendSolanaTransactionButton | `SendSolanaTransactionButton`} - a button that signs and sends a Solana transaction
|
|
11
12
|
- {@link Fund | `Fund`} - the fund flow
|
|
12
13
|
- {@link FundModal | `FundModal`} - a button that triggers a modal with the fund flow
|
|
13
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.AmountInput-module__amount-input___24NlC{box-sizing:border-box;color:var(--cdp-web-colors-page-text-default);font-family:var(--cdp-web-font-family-
|
|
1
|
+
.AmountInput-module__amount-input___24NlC{box-sizing:border-box;color:var(--cdp-web-colors-page-text-default);font-family:var(--cdp-web-font-family-input);font-size:var(--cdp-web-font-size-base);line-height:1.2;display:flex;align-items:center;justify-content:flex-start;gap:.25rem;overflow:hidden;position:relative;width:100%}.AmountInput-module__input___Af-R1{appearance:textfield;background-color:transparent;color:var(--cdp-web-colors-page-text-default);border:0;font-size:1em;font-family:var(--cdp-web-font-family-input);font-weight:500;margin:0;outline:0;padding:0;width:1em}.AmountInput-module__input___Af-R1::placeholder{color:var(--cdp-web-colors-page-text-muted)}.AmountInput-module__amount-unit___48d60{font-size:3.75em;font-weight:500;display:flex;align-items:center;justify-content:flex-start}.AmountInput-module__amount-unit___48d60.AmountInput-module__visible___qmvT0{cursor:text;transform-origin:left center}.AmountInput-module__hidden___cO0sQ{visibility:hidden;position:absolute;pointer-events:none}.AmountInput-module__unit___-zmGz{color:var(--cdp-web-colors-page-text-muted)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.AuthButton-module__loading___JpDqi{border-radius:
|
|
1
|
+
.AuthButton-module__loading___JpDqi{border-radius:var(--cdp-web-borderRadius-cta);height:3em;width:7.5em}
|
package/dist/assets/Button.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Button-module__btn___Wj6Dr{--cdp-web-button-ring-color: transparent;--cdp-web-button-ring-width: 2px;--cdp-web-button-ring-inset-color: transparent;--cdp-web-button-ring-inset-width: 2px;border-radius:
|
|
1
|
+
.Button-module__btn___Wj6Dr{--cdp-web-button-ring-color: transparent;--cdp-web-button-ring-width: 2px;--cdp-web-button-ring-inset-color: transparent;--cdp-web-button-ring-inset-width: 2px;border-radius:var(--cdp-web-borderRadius-cta);font-family:var(--cdp-web-font-family-cta)}.Button-module__link-primary___6Zgkh,.Button-module__link-secondary___S0Qdo{padding:0 .25em}.Button-module__primary___WGT--{background-color:var(--cdp-web-colors-cta-primary-bg-default);color:var(--cdp-web-colors-cta-primary-text-default);border-radius:var(--cdp-web-borderRadius-cta);font-family:var(--cdp-web-font-family-cta)}.Button-module__primary___WGT--:hover{background-color:var(--cdp-web-colors-cta-primary-bg-hover);color:var(--cdp-web-colors-cta-primary-text-hover)}.Button-module__primary___WGT--:active{background-color:var(--cdp-web-colors-cta-primary-bg-pressed)}.Button-module__primary___WGT--:focus{outline:none}.Button-module__primary___WGT--:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-cta-primary-border-focus);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-page-bg-default);outline:none}.Button-module__secondary___Fx0LJ{background-color:var(--cdp-web-colors-cta-secondary-bg-default);color:var(--cdp-web-colors-cta-secondary-text-default);border-radius:var(--cdp-web-borderRadius-cta);font-family:var(--cdp-web-font-family-cta)}.Button-module__secondary___Fx0LJ:hover{background-color:var(--cdp-web-colors-cta-secondary-bg-hover);color:var(--cdp-web-colors-cta-secondary-text-hover)}.Button-module__secondary___Fx0LJ:active{background-color:var(--cdp-web-colors-cta-secondary-bg-pressed)}.Button-module__secondary___Fx0LJ:focus{outline:none}.Button-module__secondary___Fx0LJ:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-cta-secondary-border-focus);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-page-bg-default);outline:none}.Button-module__link-primary___6Zgkh,.Button-module__transparent-primary___iwWv5{background-color:transparent;color:var(--cdp-web-colors-link-primary-text-default);border-radius:var(--cdp-web-borderRadius-link);font-family:var(--cdp-web-font-family-link)}.Button-module__link-primary___6Zgkh:hover,.Button-module__transparent-primary___iwWv5:hover{color:var(--cdp-web-colors-link-primary-text-hover)}.Button-module__link-primary___6Zgkh:active,.Button-module__transparent-primary___iwWv5:active{color:var(--cdp-web-colors-link-primary-text-pressed)}.Button-module__link-primary___6Zgkh:focus,.Button-module__transparent-primary___iwWv5:focus{outline:none}.Button-module__link-primary___6Zgkh:focus-visible,.Button-module__transparent-primary___iwWv5:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-link-primary-text-default);outline:none}.Button-module__link-secondary___S0Qdo,.Button-module__transparent-secondary___GfRXu{background-color:transparent;color:var(--cdp-web-colors-link-secondary-text-default);border-radius:var(--cdp-web-borderRadius-link);font-family:var(--cdp-web-font-family-link)}.Button-module__link-secondary___S0Qdo:hover,.Button-module__transparent-secondary___GfRXu:hover{color:var(--cdp-web-colors-link-secondary-text-hover)}.Button-module__link-secondary___S0Qdo:active,.Button-module__transparent-secondary___GfRXu:active{color:var(--cdp-web-colors-link-secondary-text-pressed)}.Button-module__link-secondary___S0Qdo:focus,.Button-module__transparent-secondary___GfRXu:focus{outline:none}.Button-module__link-secondary___S0Qdo:focus-visible,.Button-module__transparent-secondary___GfRXu:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-link-secondary-text-default);outline:none}.Button-module__control-btn___9Gkoz{--cdp-web-button-ring-inset-color: var(--cdp-web-colors-select-trigger-border-default);--cdp-web-button-ring-inset-width: 1px;background-color:var(--cdp-web-colors-select-trigger-bg-default);border-radius:var(--cdp-web-borderRadius-select-trigger);color:var(--cdp-web-colors-select-trigger-text-default);font-family:var(--cdp-web-font-family-select);font-weight:400}.Button-module__control-btn___9Gkoz:hover{background-color:var(--cdp-web-colors-select-trigger-bg-hover)}.Button-module__control-btn___9Gkoz:active{background-color:var(--cdp-web-colors-select-trigger-bg-pressed)}.Button-module__control-btn___9Gkoz:focus{outline:none}.Button-module__control-btn___9Gkoz:focus-visible{--cdp-web-button-ring-inset-color: var(--cdp-web-colors-input-border-focus);--cdp-web-button-ring-inset-width: 2px;outline:none}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ButtonBase-module__btn___9S8PJ{--cdp-web-button-ring-color: transparent;--cdp-web-button-ring-width: 2px;--cdp-web-button-ring-inset-color: transparent;--cdp-web-button-ring-inset-width: 2px;box-sizing:border-box;box-shadow:inset 0 0 0 var(--cdp-web-button-ring-inset-width) var(--cdp-web-button-ring-inset-color),0 0 0 var(--cdp-web-button-ring-width) var(--cdp-web-button-ring-color);display:inline-flex;align-items:center;justify-content:center;gap:.5em;padding:1em;border:0;background-color:transparent;color:var(--cdp-web-colors-page-text-default);font-size:var(--cdp-web-font-size-base);font-family:var(--cdp-web-font-family-
|
|
1
|
+
.ButtonBase-module__btn___9S8PJ{--cdp-web-button-ring-color: transparent;--cdp-web-button-ring-width: 2px;--cdp-web-button-ring-inset-color: transparent;--cdp-web-button-ring-inset-width: 2px;box-sizing:border-box;box-shadow:inset 0 0 0 var(--cdp-web-button-ring-inset-width) var(--cdp-web-button-ring-inset-color),0 0 0 var(--cdp-web-button-ring-width) var(--cdp-web-button-ring-color);display:inline-flex;align-items:center;justify-content:center;gap:.5em;padding:1em;border:0;background-color:transparent;color:var(--cdp-web-colors-page-text-default);font-size:var(--cdp-web-font-size-base);font-family:var(--cdp-web-font-family-interactive);font-weight:500;line-height:1.5;text-decoration:none;cursor:pointer;transition:all .15s ease-in-out;transition-property:color,background-color,border-color,box-shadow,transform;-webkit-user-select:none;user-select:none}.ButtonBase-module__full-width___vLJsn{display:flex;width:100%}.ButtonBase-module__size-lg___569jT{padding:1em}.ButtonBase-module__size-md___sAsBJ{padding:.75em}.ButtonBase-module__size-sm___xHCtU{padding:.5em .75em}.ButtonBase-module__size-xs___LiiO7{padding:.25em .75em}
|
package/dist/assets/Error.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Error-module__error___zeTQt{color:var(--cdp-web-colors-fg-negative);line-height:1.25em;font-family:var(--cdp-web-font-family-
|
|
1
|
+
.Error-module__error___zeTQt{color:var(--cdp-web-colors-fg-negative);line-height:1.25em;font-family:var(--cdp-web-font-family-body);font-size:var(--cdp-web-font-size-base);display:flex;align-items:center;gap:.25em;margin:0}.Error-module__error___zeTQt span{font-size:.875em}.Error-module__icon___uwkis{width:auto;height:.875em;flex-grow:0;flex-shrink:0}
|
package/dist/assets/Field.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Field-module__field-wrapper___SCcbl{display:flex;flex-direction:column;font-family:var(--cdp-web-font-family-
|
|
1
|
+
.Field-module__field-wrapper___SCcbl{display:flex;flex-direction:column;font-family:var(--cdp-web-font-family-body);font-size:var(--cdp-web-font-size-base);gap:.25em}
|
package/dist/assets/Fund.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Fund-module__fund___6j-Og{box-sizing:border-box;color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;font-family:var(--cdp-web-font-family-
|
|
1
|
+
.Fund-module__fund___6j-Og{box-sizing:border-box;color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;font-family:var(--cdp-web-font-family-body);font-size:var(--cdp-web-font-size-base);gap:1em;width:100%;max-width:28.125em;padding:.75em 2em 1em}.Fund-module__fund___6j-Og *{box-sizing:border-box}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.FundPaymentMethods-module__select-loading-skeleton___ZuD3n{width:100%;border-radius
|
|
1
|
+
.FundPaymentMethods-module__select-loading-skeleton___ZuD3n{width:100%;border-radius:var(--cdp-web-borderRadius-select-trigger);height:3em}.FundPaymentMethods-module__select-item___9VyxH{display:flex;align-items:center;line-height:1.25em;gap:.5em}.FundPaymentMethods-module__select-item-icon___28unQ{display:flex;align-items:center;justify-content:center;flex-grow:0;flex-shrink:0;width:2.25em}.FundPaymentMethods-module__select-item-name___5vLc0{display:block;font-weight:600;font-size:.875em}.FundPaymentMethods-module__select-item-description___C5mTB{color:var(--cdp-web-colors-select-list-item-text-muted);display:block;font-size:.875em}.FundPaymentMethods-module__select-trigger___ypebl .FundPaymentMethods-module__select-item___9VyxH{line-height:1.5em;gap:.75em}.FundPaymentMethods-module__select-trigger___ypebl .FundPaymentMethods-module__select-item-icon___28unQ{width:auto}.FundPaymentMethods-module__select-trigger___ypebl .FundPaymentMethods-module__select-item-name___5vLc0{font-size:1em}.FundPaymentMethods-module__select-trigger___ypebl .FundPaymentMethods-module__select-item-description___C5mTB{display:none}
|
package/dist/assets/Input.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Input-module__input___-mK8z{--cdp-web-input-ring-width: 1px;--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-default);box-sizing:border-box;font-family:var(--cdp-web-font-family-
|
|
1
|
+
.Input-module__input___-mK8z{--cdp-web-input-ring-width: 1px;--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-default);box-sizing:border-box;font-family:var(--cdp-web-font-family-input);font-size:var(--cdp-web-font-size-base);line-height:1.5;padding:1em;border-radius:var(--cdp-web-borderRadius-input);border:0;background-color:var(--cdp-web-colors-input-bg-default);box-shadow:0 0 0 var(--cdp-web-input-ring-width) var(--cdp-web-input-ring-color) inset;color:var(--cdp-web-colors-input-text-default);transition:box-shadow .15s ease-in-out;width:100%}.Input-module__size-lg___IYoRG{padding:1em}.Input-module__size-md___8hkn5{padding:.75em}.Input-module__size-sm___cnynF{padding:.5em .75em}.Input-module__size-xs___aK-NH{padding:.25em .75em}.Input-module__input___-mK8z::placeholder{color:var(--cdp-web-colors-input-placeholder-default)}.Input-module__input___-mK8z:focus-visible{outline:none;--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-focus);--cdp-web-input-ring-width: 2px}.Input-module__input___-mK8z[aria-invalid=true]{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-error)}.Input-module__input___-mK8z[data-success=true]{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-success)}
|
package/dist/assets/Modal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Modal-module__modal___MUsZA{--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 10%), 0 2px 4px -2px rgb(0 0 0 / 10%);box-sizing:border-box;box-shadow:var(--shadow-md);width:100%;max-width:28.125em;min-width:0;background:var(--cdp-web-colors-page-bg-default);border-radius
|
|
1
|
+
.Modal-module__modal___MUsZA{--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 10%), 0 2px 4px -2px rgb(0 0 0 / 10%);box-sizing:border-box;box-shadow:var(--shadow-md);width:100%;max-width:28.125em;min-width:0;background:var(--cdp-web-colors-page-bg-default);border-radius:var(--cdp-web-borderRadius-modal);outline:1px solid var(--cdp-web-colors-page-border-default);overflow:hidden;position:relative}.Modal-module__modal___MUsZA[data-state=open]{animation:Modal-module__slide-in___p-A8u .2s ease-out,Modal-module__fade-in___NfUjS .2s ease-out}.Modal-module__modal___MUsZA[data-state=closed]{animation:Modal-module__slide-out___hrRK1 .2s ease-in,Modal-module__fade-out___LpBNV .2s ease-in}.Modal-module__overlay___-RqGQ{background:var(--cdp-web-colors-bg-overlay);box-sizing:border-box;-webkit-backdrop-filter:blur(.5em);backdrop-filter:blur(.5em);display:grid;grid-template-rows:auto 1fr;inset:0;overflow-y:auto;place-items:end center;position:fixed;z-index:auto}.Modal-module__overlay___-RqGQ[data-state=open]{animation:Modal-module__fade-in___NfUjS .2s ease-out}.Modal-module__overlay___-RqGQ[data-state=closed]{animation:Modal-module__fade-out___LpBNV .2s ease-in}.Modal-module__spacer___dIfOA{height:1em}@keyframes Modal-module__fade-in___NfUjS{0%{opacity:0}to{opacity:1}}@keyframes Modal-module__fade-out___LpBNV{0%{opacity:1}to{opacity:0}}@keyframes Modal-module__slide-in___p-A8u{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes Modal-module__slide-out___hrRK1{0%{transform:translateY(0)}to{transform:translateY(100%)}}@media (min-width: 400px){.Modal-module__overlay___-RqGQ{padding:.5rem}}@media (min-width: 450px){.Modal-module__overlay___-RqGQ{place-items:center;padding:1rem;grid-template-rows:1fr}.Modal-module__modal___MUsZA{height:auto}.Modal-module__spacer___dIfOA{display:none}@keyframes Modal-module__slide-in___p-A8u{0%{transform:translateY(10%)}to{transform:translateY(0)}}@keyframes Modal-module__slide-out___hrRK1{0%{transform:translateY(0)}to{transform:translateY(10%)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.PhoneNumberInput-module__phone-number-input___mYty2{--cdp-web-input-ring-width: 1px;--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-default);box-sizing:border-box;display:flex;align-items:stretch;font-family:var(--cdp-web-font-family-
|
|
1
|
+
.PhoneNumberInput-module__phone-number-input___mYty2{--cdp-web-input-ring-width: 1px;--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-default);box-sizing:border-box;display:flex;align-items:stretch;font-family:var(--cdp-web-font-family-input);font-size:var(--cdp-web-font-size-base);line-height:1.5;padding-left:1em;border-radius:var(--cdp-web-borderRadius-input);border:0;background-color:var(--cdp-web-colors-input-bg-default);box-shadow:0 0 0 var(--cdp-web-input-ring-width) var(--cdp-web-input-ring-color) inset;color:var(--cdp-web-colors-input-text-default);transition:box-shadow .15s ease-in-out;width:100%}.PhoneNumberInput-module__phone-number-input___mYty2.PhoneNumberInput-module__invalid___zDA2p,.PhoneNumberInput-module__phone-number-input___mYty2:focus-within.PhoneNumberInput-module__invalid___zDA2p{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-error)}.PhoneNumberInput-module__phone-number-input___mYty2.PhoneNumberInput-module__success___uPjMx{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-success)}.PhoneNumberInput-module__phone-number-input___mYty2:focus-within{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-focus);--cdp-web-input-ring-width: 2px}.PhoneNumberInput-module__phone-number-input___mYty2 .PhoneNumberInput-module__input___H-XG-{--cdp-web-input-ring-width: 0px;background-color:transparent;padding-left:.75em}.PhoneNumberInput-module__country-calling-code___N6zDW{display:flex;align-items:center;gap:.25rem}
|
package/dist/assets/Select.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Select-module__select-trigger___yqioM{--cdp-web-button-ring-inset-color: var(--cdp-web-colors-select-trigger-border-default);--cdp-web-button-ring-inset-width: 1px;background-color:var(--cdp-web-colors-select-trigger-bg-default);border-radius
|
|
1
|
+
.Select-module__select-trigger___yqioM{--cdp-web-button-ring-inset-color: var(--cdp-web-colors-select-trigger-border-default);--cdp-web-button-ring-inset-width: 1px;background-color:var(--cdp-web-colors-select-trigger-bg-default);border-radius:var(--cdp-web-borderRadius-select-trigger);color:var(--cdp-web-colors-select-trigger-text-default);font-family:var(--cdp-web-font-family-select);font-weight:500;text-align:left;justify-content:space-between}.Select-module__select-trigger___yqioM:hover{background-color:var(--cdp-web-colors-select-trigger-bg-hover)}.Select-module__select-trigger___yqioM:active{background-color:var(--cdp-web-colors-select-trigger-bg-pressed)}.Select-module__select-trigger___yqioM:focus{outline:none}.Select-module__select-trigger___yqioM:focus-visible{--cdp-web-button-ring-inset-color: var(--cdp-web-colors-select-trigger-border-focus);--cdp-web-button-ring-inset-width: 2px;outline:none}.Select-module__select-icon___hE7Wy{transition:transform .2s ease-in-out}.Select-module__select-trigger___yqioM[data-state=open] .Select-module__select-icon___hE7Wy{transform:rotate(0)}.Select-module__select-trigger___yqioM[data-state=closed] .Select-module__select-icon___hE7Wy{transform:rotate(-90deg)}.Select-module__select-content___6R8J9{--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 10%), 0 1px 2px -1px rgb(0 0 0 / 10%);background-color:var(--cdp-web-colors-select-list-bg-default);border:1px solid var(--cdp-web-colors-select-list-border-default);border-radius:var(--cdp-web-borderRadius-select-list);box-sizing:border-box;box-shadow:var(--shadow-sm);font-size:var(--cdp-web-font-size-base);font-family:var(--cdp-web-font-family-select);max-height:var(--radix-select-content-available-height);padding:.5em;text-align:left;width:var(--radix-select-trigger-width)}.Select-module__select-content___6R8J9[data-state=open]{animation:Select-module__slide-down-and-fade___66mDK .2s cubic-bezier(.4,0,.2,1)}.Select-module__select-content___6R8J9[data-side=top][data-state=open]{animation:Select-module__slide-up-and-fade___0H9hX .2s cubic-bezier(.4,0,.2,1)}.Select-module__select-item___12l2C{background-color:var(--cdp-web-colors-select-list-item-bg-default);border-radius:var(--cdp-web-borderRadius-select-list);color:var(--cdp-web-colors-select-list-item-text-default);cursor:pointer;font-size:.875em;display:flex;align-items:center;justify-content:space-between;gap:.5em;padding:.5em;transition:background-color .2s cubic-bezier(.4,0,.2,1)}.Select-module__select-item___12l2C[data-highlighted]{background-color:var(--cdp-web-colors-select-list-item-bg-highlight);color:var(--cdp-web-colors-select-list-item-text-onHighlight);outline:none}.Select-module__rotate-180___KuvGV{transform:rotate(180deg)}@keyframes Select-module__slide-down-and-fade___66mDK{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}@keyframes Select-module__slide-up-and-fade___0H9hX{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.SendEvmTransactionButton-module__send-evm-transaction-button___74m57{padding-left:2em;padding-right:2em}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.SendSolanaTransactionButton-module__send-solana-transaction-button___OxwvB{padding-left:2em;padding-right:2em}
|
package/dist/assets/SignIn.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.SignIn-module__sign-in___cYpee{
|
|
1
|
+
.SignIn-module__sign-in___cYpee{box-sizing:border-box;font:var(--cdp-web-font-size-base) / 1.5 var(--cdp-web-font-family-body);font-optical-sizing:auto;background-color:var(--cdp-web-colors-page-bg-default);color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;max-width:38.25em;padding:.75em 2em 1em;overflow:hidden;width:100%}.SignIn-module__title-desc-wrapper___VpPcA{display:flex;flex-direction:column;gap:1.5em;margin:1.5em 0}.SignIn-module__sign-in___cYpee *{box-sizing:border-box}.SignIn-module__back-button___bmE-y{align-self:flex-start}.SignIn-module__back-button-wrapper___Q9FA1{min-height:3em}.SignIn-module__footer___3Gkbc{margin-top:1.5em}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.SuccessMessage-module__success___ZOELg{color:var(--cdp-web-colors-fg-positive);font-family:var(--cdp-web-font-family-
|
|
1
|
+
.SuccessMessage-module__success___ZOELg{color:var(--cdp-web-colors-fg-positive);font-family:var(--cdp-web-font-family-body);font-size:var(--cdp-web-font-size-base);line-height:1.25em;display:flex;align-items:center;gap:.25em;margin:0}.SuccessMessage-module__success___ZOELg span{font-size:.875em}.SuccessMessage-module__icon___QpPW-{width:auto;height:.875em;flex-grow:0;flex-shrink:0}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { CDPContext as
|
|
3
|
-
import { createContext as b, useMemo as
|
|
2
|
+
import { CDPContext as A, CDPHooksProvider as O } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { createContext as b, useMemo as r, useContext as f } from "react";
|
|
4
4
|
import { ThemeProvider as w } from "../ThemeProvider/index.js";
|
|
5
5
|
const E = [
|
|
6
6
|
/** Email OTP method */
|
|
7
7
|
"email",
|
|
8
8
|
/** SMS OTP method */
|
|
9
9
|
"sms"
|
|
10
|
-
], F = ({ children: o, config: e, theme:
|
|
10
|
+
], F = ({ children: o, config: e, theme: n }) => {
|
|
11
11
|
const {
|
|
12
|
-
appName:
|
|
12
|
+
appName: i,
|
|
13
13
|
appLogoUrl: s,
|
|
14
|
-
showCoinbaseFooter:
|
|
15
|
-
authMethods:
|
|
14
|
+
showCoinbaseFooter: a,
|
|
15
|
+
authMethods: p,
|
|
16
16
|
projectId: c,
|
|
17
|
-
useMock:
|
|
17
|
+
useMock: C,
|
|
18
18
|
debugging: u,
|
|
19
|
-
basePath:
|
|
20
|
-
ethereum:
|
|
21
|
-
solana:
|
|
22
|
-
} = e, P =
|
|
19
|
+
basePath: d,
|
|
20
|
+
ethereum: P,
|
|
21
|
+
solana: x
|
|
22
|
+
} = e, { createOnLogin: m } = P ?? {}, { createOnLogin: g } = x ?? {}, v = r(
|
|
23
23
|
() => ({
|
|
24
24
|
projectId: c,
|
|
25
|
-
useMock:
|
|
25
|
+
useMock: C,
|
|
26
26
|
debugging: u,
|
|
27
|
-
basePath:
|
|
28
|
-
ethereum: m
|
|
29
|
-
solana:
|
|
27
|
+
basePath: d,
|
|
28
|
+
ethereum: { createOnLogin: m },
|
|
29
|
+
solana: { createOnLogin: g }
|
|
30
30
|
}),
|
|
31
|
-
[c,
|
|
32
|
-
),
|
|
33
|
-
() => ({ appName:
|
|
34
|
-
[
|
|
35
|
-
),
|
|
36
|
-
return
|
|
31
|
+
[c, C, u, d, m, g]
|
|
32
|
+
), L = r(
|
|
33
|
+
() => ({ appName: i, appLogoUrl: s, showCoinbaseFooter: a, authMethods: p }),
|
|
34
|
+
[i, s, a, p]
|
|
35
|
+
), h = /* @__PURE__ */ t(M, { config: L, children: /* @__PURE__ */ t(w, { theme: n, children: o }) });
|
|
36
|
+
return f(A) ? h : /* @__PURE__ */ t(O, { config: v, children: h });
|
|
37
37
|
}, l = b(void 0), D = {
|
|
38
38
|
appName: "",
|
|
39
39
|
appLogoUrl: "",
|
|
40
40
|
showCoinbaseFooter: !0,
|
|
41
41
|
authMethods: ["email"]
|
|
42
42
|
}, M = ({ children: o, config: e }) => {
|
|
43
|
-
const
|
|
43
|
+
const n = r(
|
|
44
44
|
() => ({
|
|
45
45
|
app: {
|
|
46
46
|
...D,
|
|
@@ -49,9 +49,9 @@ const E = [
|
|
|
49
49
|
}),
|
|
50
50
|
[e]
|
|
51
51
|
);
|
|
52
|
-
return /* @__PURE__ */ t(l.Provider, { value:
|
|
53
|
-
},
|
|
54
|
-
const o =
|
|
52
|
+
return /* @__PURE__ */ t(l.Provider, { value: n, children: o });
|
|
53
|
+
}, N = () => {
|
|
54
|
+
const o = f(l);
|
|
55
55
|
if (!o)
|
|
56
56
|
throw new Error("useAppConfig must be used within an AppConfigProvider");
|
|
57
57
|
return o.app;
|
|
@@ -59,5 +59,5 @@ const E = [
|
|
|
59
59
|
export {
|
|
60
60
|
E as AUTH_METHODS,
|
|
61
61
|
F as CDPReactProvider,
|
|
62
|
-
|
|
62
|
+
N as useAppConfig
|
|
63
63
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const x = {
|
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as E, useContext as R, useEffect as f, useMemo as b } from "react";
|
|
3
|
+
import { useBuyUrl as M } from "./hooks/useBuyUrl.js";
|
|
4
|
+
import { useEmitLifecycleStatus as g } from "./hooks/useEmitLifecycleStatus.js";
|
|
5
|
+
import { useExchangeRate as k } from "./hooks/useExchangeRate.js";
|
|
6
|
+
import { usePaymentMethods as H } from "./hooks/usePaymentMethods.js";
|
|
7
|
+
import { useFundReducer as N } from "./useFundReducer.js";
|
|
8
|
+
const h = {
|
|
10
9
|
country: "US",
|
|
11
10
|
cryptoCurrency: "ETH",
|
|
12
11
|
cryptoDecimalPlaces: 8,
|
|
@@ -18,113 +17,118 @@ const x = {
|
|
|
18
17
|
transactionStatus: {
|
|
19
18
|
statusName: "init",
|
|
20
19
|
statusData: null
|
|
21
|
-
}
|
|
22
|
-
|
|
20
|
+
},
|
|
21
|
+
destinationAddress: ""
|
|
22
|
+
}, S = E(void 0), q = ({
|
|
23
23
|
children: c,
|
|
24
|
-
fetchBuyOptions:
|
|
25
|
-
fetchBuyQuote:
|
|
26
|
-
inputType:
|
|
24
|
+
fetchBuyOptions: v,
|
|
25
|
+
fetchBuyQuote: y,
|
|
26
|
+
inputType: D,
|
|
27
27
|
onError: u,
|
|
28
|
-
onStatus:
|
|
29
|
-
onSuccess:
|
|
30
|
-
...
|
|
28
|
+
onStatus: F,
|
|
29
|
+
onSuccess: I,
|
|
30
|
+
...w
|
|
31
31
|
}) => {
|
|
32
32
|
const {
|
|
33
33
|
country: t,
|
|
34
34
|
cryptoCurrency: e,
|
|
35
|
-
cryptoDecimalPlaces:
|
|
35
|
+
cryptoDecimalPlaces: i,
|
|
36
36
|
fiatCurrency: s,
|
|
37
|
-
fiatDecimalPlaces:
|
|
38
|
-
locale:
|
|
39
|
-
network:
|
|
40
|
-
presetAmountInputs:
|
|
41
|
-
redirectUrl:
|
|
42
|
-
subdivision:
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
fiatDecimalPlaces: d,
|
|
38
|
+
locale: m,
|
|
39
|
+
network: n,
|
|
40
|
+
presetAmountInputs: p,
|
|
41
|
+
redirectUrl: T,
|
|
42
|
+
subdivision: o,
|
|
43
|
+
destinationAddress: a
|
|
44
|
+
} = w, [l, r] = N({
|
|
45
|
+
...h,
|
|
45
46
|
country: t,
|
|
46
47
|
cryptoCurrency: e,
|
|
47
|
-
cryptoDecimalPlaces:
|
|
48
|
+
cryptoDecimalPlaces: i,
|
|
48
49
|
fiatCurrency: s,
|
|
49
|
-
fiatDecimalPlaces:
|
|
50
|
-
locale:
|
|
51
|
-
network:
|
|
52
|
-
presetAmountInputs:
|
|
53
|
-
subdivision:
|
|
54
|
-
|
|
50
|
+
fiatDecimalPlaces: d,
|
|
51
|
+
locale: m,
|
|
52
|
+
network: n,
|
|
53
|
+
presetAmountInputs: p,
|
|
54
|
+
subdivision: o,
|
|
55
|
+
destinationAddress: a,
|
|
56
|
+
selectedInputType: D || h.selectedInputType
|
|
55
57
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
f(() => {
|
|
59
|
+
r({
|
|
58
60
|
type: "SYNC_WITH_PROPS",
|
|
59
61
|
payload: {
|
|
60
62
|
country: t,
|
|
61
63
|
cryptoCurrency: e,
|
|
62
|
-
cryptoDecimalPlaces:
|
|
64
|
+
cryptoDecimalPlaces: i,
|
|
63
65
|
fiatCurrency: s,
|
|
64
|
-
fiatDecimalPlaces:
|
|
65
|
-
locale:
|
|
66
|
-
network:
|
|
67
|
-
presetAmountInputs:
|
|
68
|
-
subdivision:
|
|
66
|
+
fiatDecimalPlaces: d,
|
|
67
|
+
locale: m,
|
|
68
|
+
network: n,
|
|
69
|
+
presetAmountInputs: p,
|
|
70
|
+
subdivision: o,
|
|
71
|
+
destinationAddress: a
|
|
69
72
|
}
|
|
70
73
|
});
|
|
71
74
|
}, [
|
|
72
75
|
t,
|
|
73
76
|
e,
|
|
74
|
-
a,
|
|
75
|
-
s,
|
|
76
77
|
i,
|
|
78
|
+
s,
|
|
77
79
|
d,
|
|
78
|
-
o,
|
|
79
80
|
m,
|
|
81
|
+
n,
|
|
82
|
+
p,
|
|
83
|
+
o,
|
|
80
84
|
r,
|
|
81
|
-
|
|
82
|
-
]),
|
|
83
|
-
lifecycleStatus:
|
|
85
|
+
a
|
|
86
|
+
]), g({
|
|
87
|
+
lifecycleStatus: l.transactionStatus,
|
|
84
88
|
onError: u,
|
|
85
|
-
onStatus:
|
|
86
|
-
onSuccess:
|
|
89
|
+
onStatus: F,
|
|
90
|
+
onSuccess: I
|
|
87
91
|
});
|
|
88
|
-
const { fetchExchangeRate:
|
|
92
|
+
const { fetchExchangeRate: P } = k({
|
|
89
93
|
cryptoCurrency: e,
|
|
90
94
|
country: t,
|
|
91
|
-
dispatch:
|
|
92
|
-
fetchBuyQuote:
|
|
95
|
+
dispatch: r,
|
|
96
|
+
fetchBuyQuote: y,
|
|
93
97
|
fiatCurrency: s,
|
|
94
|
-
network:
|
|
98
|
+
network: n,
|
|
95
99
|
onError: u,
|
|
96
|
-
subdivision:
|
|
97
|
-
}), { fetchPaymentMethods:
|
|
100
|
+
subdivision: o
|
|
101
|
+
}), { fetchPaymentMethods: x } = H({
|
|
98
102
|
country: t,
|
|
99
103
|
cryptoCurrency: e,
|
|
100
|
-
dispatch:
|
|
101
|
-
fetchBuyOptions:
|
|
104
|
+
dispatch: r,
|
|
105
|
+
fetchBuyOptions: v,
|
|
102
106
|
fiatCurrency: s,
|
|
103
|
-
network:
|
|
107
|
+
network: n,
|
|
104
108
|
onError: u,
|
|
105
|
-
subdivision:
|
|
106
|
-
}), { fetchBuyUrl:
|
|
109
|
+
subdivision: o
|
|
110
|
+
}), { fetchBuyUrl: C } = M({
|
|
107
111
|
cryptoCurrency: e,
|
|
108
|
-
destinationAddress: A || void 0,
|
|
109
112
|
fiatCurrency: s,
|
|
110
|
-
fetchBuyQuote:
|
|
113
|
+
fetchBuyQuote: y,
|
|
111
114
|
country: t,
|
|
112
|
-
network:
|
|
113
|
-
redirectUrl:
|
|
114
|
-
subdivision:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}, [y]), l(() => {
|
|
115
|
+
network: n,
|
|
116
|
+
redirectUrl: T,
|
|
117
|
+
subdivision: o,
|
|
118
|
+
destinationAddress: a
|
|
119
|
+
}), U = b(() => ({ state: l, dispatch: r, fetchBuyUrl: C }), [l, r, C]);
|
|
120
|
+
return f(() => {
|
|
119
121
|
P();
|
|
120
|
-
}, [P]),
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
}, [P]), f(() => {
|
|
123
|
+
x();
|
|
124
|
+
}, [x]), /* @__PURE__ */ A(S.Provider, { value: U, children: c });
|
|
125
|
+
}, z = () => {
|
|
126
|
+
const c = R(S);
|
|
123
127
|
if (!c)
|
|
124
128
|
throw new Error("useFundContext must be used within a FundProvider");
|
|
125
129
|
return c;
|
|
126
130
|
};
|
|
127
131
|
export {
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
q as FundProvider,
|
|
133
|
+
z as useFundContext
|
|
130
134
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { OnrampError, FundProps, FundState } from '../types';
|
|
2
|
-
export type UseBuyUrlParams = Pick<FundState, "country" | "cryptoCurrency" | "fiatCurrency" | "network" | "subdivision"> & {
|
|
2
|
+
export type UseBuyUrlParams = Pick<FundState, "country" | "cryptoCurrency" | "fiatCurrency" | "network" | "subdivision" | "destinationAddress"> & {
|
|
3
3
|
fetchBuyQuote: FundProps["fetchBuyQuote"];
|
|
4
4
|
onError?: (e: OnrampError | undefined) => void;
|
|
5
|
-
destinationAddress?: string;
|
|
6
5
|
redirectUrl?: string;
|
|
7
6
|
};
|
|
8
7
|
export interface FetchBuyUrlParams {
|
|
@@ -8,29 +8,29 @@ const _ = (o) => {
|
|
|
8
8
|
}, h = ({
|
|
9
9
|
country: o,
|
|
10
10
|
cryptoCurrency: a,
|
|
11
|
-
destinationAddress:
|
|
11
|
+
destinationAddress: c,
|
|
12
12
|
fetchBuyQuote: u,
|
|
13
13
|
fiatCurrency: p,
|
|
14
|
-
network:
|
|
15
|
-
onError:
|
|
16
|
-
redirectUrl:
|
|
14
|
+
network: d,
|
|
15
|
+
onError: n,
|
|
16
|
+
redirectUrl: s,
|
|
17
17
|
subdivision: i
|
|
18
18
|
}) => {
|
|
19
|
-
const
|
|
20
|
-
async ({ paymentMethod:
|
|
21
|
-
if (isNaN(m) || !
|
|
19
|
+
const U = y(
|
|
20
|
+
async ({ paymentMethod: l, paymentAmount: m }, f) => {
|
|
21
|
+
if (isNaN(m) || !l)
|
|
22
22
|
return "";
|
|
23
23
|
try {
|
|
24
24
|
const e = (await u({
|
|
25
25
|
purchaseCurrency: a.toUpperCase(),
|
|
26
|
-
purchaseNetwork:
|
|
26
|
+
purchaseNetwork: d.toLowerCase(),
|
|
27
27
|
paymentCurrency: p.toUpperCase(),
|
|
28
28
|
paymentAmount: m.toFixed(),
|
|
29
|
-
paymentMethod:
|
|
29
|
+
paymentMethod: l.replace("_GUEST", ""),
|
|
30
30
|
// remove "_GUEST" from the payment method since it is not valid in the Buy Quote API
|
|
31
31
|
country: o.toUpperCase(),
|
|
32
32
|
subdivision: i?.toUpperCase(),
|
|
33
|
-
destinationAddress:
|
|
33
|
+
destinationAddress: c
|
|
34
34
|
})).onrampUrl;
|
|
35
35
|
if (!e) {
|
|
36
36
|
const r = {
|
|
@@ -38,39 +38,39 @@ const _ = (o) => {
|
|
|
38
38
|
code: "NO_ONRAMP_URL",
|
|
39
39
|
debugMessage: "No payment methods found for the selected country and currency. See docs for more information: https://docs.cdp.coinbase.com/onramp/docs/api-configurations"
|
|
40
40
|
};
|
|
41
|
-
return f?.(r),
|
|
41
|
+
return f?.(r), n?.(r), "";
|
|
42
42
|
}
|
|
43
|
-
if (
|
|
43
|
+
if (s && _(s)) {
|
|
44
44
|
const r = new URL(e);
|
|
45
|
-
return r.searchParams.set("redirectUrl",
|
|
45
|
+
return r.searchParams.set("redirectUrl", s), r.toString();
|
|
46
46
|
}
|
|
47
47
|
return e;
|
|
48
|
-
} catch (
|
|
48
|
+
} catch (t) {
|
|
49
49
|
let e;
|
|
50
|
-
return
|
|
50
|
+
return t instanceof Error ? e = {
|
|
51
51
|
errorType: "handled_error",
|
|
52
52
|
code: "BUY_URL_ERROR",
|
|
53
|
-
debugMessage:
|
|
53
|
+
debugMessage: t.message
|
|
54
54
|
} : e = {
|
|
55
55
|
errorType: "unknown_error",
|
|
56
56
|
code: "UNKNOWN_BUY_URL_ERROR",
|
|
57
|
-
debugMessage: JSON.stringify(
|
|
58
|
-
}, f?.(e),
|
|
57
|
+
debugMessage: JSON.stringify(t)
|
|
58
|
+
}, f?.(e), n?.(e), "";
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
[
|
|
62
62
|
o,
|
|
63
63
|
a,
|
|
64
|
-
|
|
64
|
+
c,
|
|
65
65
|
u,
|
|
66
66
|
p,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
d,
|
|
68
|
+
n,
|
|
69
|
+
s,
|
|
70
70
|
i
|
|
71
71
|
]
|
|
72
72
|
);
|
|
73
|
-
return R(() => ({ fetchBuyUrl:
|
|
73
|
+
return R(() => ({ fetchBuyUrl: U }), [U]);
|
|
74
74
|
};
|
|
75
75
|
export {
|
|
76
76
|
h as useBuyUrl
|
|
@@ -100,8 +100,9 @@ export interface FundState {
|
|
|
100
100
|
selectedPaymentMethod?: FundPaymentMethod;
|
|
101
101
|
subdivision?: string;
|
|
102
102
|
transactionStatus: FundLifecycleStatus;
|
|
103
|
+
destinationAddress: string;
|
|
103
104
|
}
|
|
104
|
-
export type FundStateProps = Pick<FundState, "country" | "cryptoCurrency" | "cryptoDecimalPlaces" | "fiatCurrency" | "fiatDecimalPlaces" | "locale" | "network" | "presetAmountInputs" | "subdivision">;
|
|
105
|
+
export type FundStateProps = Pick<FundState, "country" | "cryptoCurrency" | "cryptoDecimalPlaces" | "fiatCurrency" | "fiatDecimalPlaces" | "locale" | "network" | "presetAmountInputs" | "subdivision" | "destinationAddress">;
|
|
105
106
|
export interface FundProps extends FundStateProps, FundLifecycleEvents {
|
|
106
107
|
children?: ReactNode | ((state: FundState) => ReactNode);
|
|
107
108
|
className?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APIError, SendEvmTransactionOptions } from '@coinbase/cdp-hooks';
|
|
2
2
|
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
import { ButtonVariant } from '../../theme/theme';
|
|
4
|
-
export interface
|
|
4
|
+
export interface SendEvmTransactionButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onError"> {
|
|
5
5
|
account: SendEvmTransactionOptions["evmAccount"];
|
|
6
6
|
network: SendEvmTransactionOptions["network"];
|
|
7
7
|
onError?: (error: APIError | Error) => void;
|
|
@@ -10,4 +10,4 @@ export interface SendTransactionButtonProps extends Omit<ButtonHTMLAttributes<HT
|
|
|
10
10
|
transaction: SendEvmTransactionOptions["transaction"];
|
|
11
11
|
variant?: ButtonVariant;
|
|
12
12
|
}
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const SendEvmTransactionButton: ({ account, children, className, network, onClick, onError, onSuccess, pendingLabel, transaction, variant, ...props }: SendEvmTransactionButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
2
|
+
import { useSendEvmTransaction as b, APIError as y } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { useState as T, useCallback as _ } from "react";
|
|
4
|
+
import { Button as w } from "../ui/Button/index.js";
|
|
5
|
+
import "../../theme/theme.js";
|
|
6
|
+
import { getMessageFromUnknownError as B } from "../../utils/getMessageFromUnknownError.js";
|
|
7
|
+
import '../../assets/SendEvmTransactionButton.css';const P = {
|
|
8
|
+
"send-evm-transaction-button": "SendEvmTransactionButton-module__send-evm-transaction-button___74m57"
|
|
9
|
+
}, q = ({
|
|
10
|
+
account: e,
|
|
11
|
+
children: f,
|
|
12
|
+
className: l = "",
|
|
13
|
+
network: s,
|
|
14
|
+
onClick: o,
|
|
15
|
+
onError: a,
|
|
16
|
+
onSuccess: i,
|
|
17
|
+
pendingLabel: u,
|
|
18
|
+
transaction: r,
|
|
19
|
+
variant: p = "primary",
|
|
20
|
+
...g
|
|
21
|
+
}) => {
|
|
22
|
+
const [v, m] = T(!1), { sendEvmTransaction: c } = b(), h = _(
|
|
23
|
+
async (d) => {
|
|
24
|
+
d.preventDefault(), o?.(d);
|
|
25
|
+
try {
|
|
26
|
+
if (!e || !s || !r) {
|
|
27
|
+
const n = [];
|
|
28
|
+
throw e || n.push("account"), s || n.push("network"), r || n.push("transaction"), new Error(`Missing required parameters: ${n.join(", ")}`);
|
|
29
|
+
}
|
|
30
|
+
m(!0);
|
|
31
|
+
const { transactionHash: t } = await c({
|
|
32
|
+
transaction: r,
|
|
33
|
+
evmAccount: e,
|
|
34
|
+
network: s
|
|
35
|
+
});
|
|
36
|
+
i?.(t);
|
|
37
|
+
} catch (t) {
|
|
38
|
+
let n;
|
|
39
|
+
if (t instanceof y || t instanceof Error)
|
|
40
|
+
n = t;
|
|
41
|
+
else {
|
|
42
|
+
const E = B(t);
|
|
43
|
+
n = new Error(E);
|
|
44
|
+
}
|
|
45
|
+
a?.(n);
|
|
46
|
+
} finally {
|
|
47
|
+
m(!1);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
[e, s, o, a, i, c, r]
|
|
51
|
+
);
|
|
52
|
+
return /* @__PURE__ */ S(
|
|
53
|
+
w,
|
|
54
|
+
{
|
|
55
|
+
className: `${P["send-evm-transaction-button"]} ${l}`,
|
|
56
|
+
isPending: v,
|
|
57
|
+
pendingLabel: u || "Sending transaction...",
|
|
58
|
+
onClick: h,
|
|
59
|
+
variant: p,
|
|
60
|
+
...g,
|
|
61
|
+
children: f || "Send transaction"
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
q as SendEvmTransactionButton
|
|
67
|
+
};
|