Skip to content

Commit 2c234ed

Browse files
removal of transak config (#195)
* removal of transak config * chore(i18n): update translations [en] Sync file structure, format locales. Branch: 195/merge --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 516bfb4 commit 2c234ed

File tree

8 files changed

+284
-22
lines changed

8 files changed

+284
-22
lines changed
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
title: useERC1155SaleContractCheckout
3+
description: Hook para gestionar el checkout del contrato de venta ERC-1155
4+
sidebarTitle: useERC1155SaleContractCheckout
5+
---
6+
7+
## Importar
8+
9+
```tsx
10+
import { useERC1155SaleContractCheckout } from '@0xsequence/checkout'
11+
```
12+
13+
## Uso
14+
15+
```tsx
16+
import { useERC1155SaleContractCheckout } from "@0xsequence/checkout"
17+
import { useAccount } from "wagmi"
18+
19+
function App() {
20+
const { address: userAddress } = useAccount()
21+
const { openCheckoutModal } = useERC1155SaleContractCheckout({
22+
chain: 80001, // chainId of the chain the collectible is on
23+
contractAddress: "0x0327b2f274e04d292e74a06809bcd687c63a4ba4", // address of the contract handling the minting function
24+
wallet: userAddress!, // address of the recipient
25+
collectionAddress: "0x888a322db4b8033bac3ff84412738c096f87f9d0", // address of the collection contract
26+
items: [
27+
// array of collectibles to purchase
28+
{
29+
tokenId: "0",
30+
quantity: "1",
31+
},
32+
],
33+
onSuccess: (txnHash: string) => {
34+
console.log("success!", txnHash)
35+
},
36+
onError: (error: Error) => {
37+
console.error(error)
38+
},
39+
})
40+
41+
const onClick = () => {
42+
if (!userAddress) {
43+
return
44+
}
45+
openCheckoutModal()
46+
}
47+
48+
return <button onClick={onClick}>Buy ERC-1155 collectible!</button>
49+
}
50+
```
51+
52+
## Tipo de retorno: `UseERC1155SaleContractCheckoutReturnType`
53+
El hook retorna un objeto con las siguientes propiedades:
54+
55+
```tsx
56+
interface UseERC1155SaleContractCheckoutReturnType {
57+
openCheckoutModal: () => void
58+
closeCheckoutModal: () => void
59+
selectPaymentSettings?: SelectPaymentSettings
60+
isLoading: boolean
61+
isError: boolean
62+
}
63+
```
64+
65+
### Propiedades
66+
67+
#### openCheckoutModal
68+
`() => void`
69+
70+
Función para abrir el modal de checkout con la compra ERC-1155 configurada.
71+
72+
#### closeCheckoutModal
73+
`() => void`
74+
75+
Función para cerrar el modal de checkout.
76+
77+
#### selectPaymentSettings
78+
`SelectPaymentSettings | undefined`
79+
80+
```tsx
81+
export interface SelectPaymentSettings {
82+
collectibles: Collectible[]
83+
chain: number | string
84+
currencyAddress: string | Hex
85+
price: string
86+
targetContractAddress: string | Hex
87+
txData: Hex
88+
collectionAddress: string | Hex
89+
recipientAddress: string | Hex
90+
approvedSpenderAddress?: string
91+
transactionConfirmations?: number
92+
onSuccess?: (txHash: string) => void
93+
onError?: (error: Error) => void
94+
onClose?: () => void
95+
enableMainCurrencyPayment?: boolean
96+
enableSwapPayments?: boolean
97+
enableTransferFunds?: boolean
98+
creditCardProviders?: string[]
99+
copyrightText?: string
100+
customProviderCallback?: (onSuccess: (txHash: string) => void, onError: (error: Error) => void, onClose: () => void) => void
101+
supplementaryAnalyticsInfo?: SupplementaryAnalyticsInfo
102+
}
103+
```
104+
105+
La configuración actual de pago para el modal.
106+
107+
#### isLoading
108+
`boolean`
109+
110+
Indica si los datos del contrato aún se están cargando.
111+
112+
#### isError
113+
`boolean`
114+
115+
Indica si hubo un error al cargar los datos del contrato.
116+
117+
## Parámetros
118+
El hook acepta un objeto de configuración con las siguientes propiedades:
119+
120+
| Parámetro | Tipo | Descripción |
121+
| ------------------- | -------------------------------------------- | ------------------------------------------------------------ |
122+
| `chain` | `number` | ID de cadena donde está desplegado el contrato de venta |
123+
| `contractAddress` | `string` | Dirección del contrato de venta ERC-1155 |
124+
| `wallet` | `string` | Dirección del wallet que recibirá los NFTs |
125+
| `collectionAddress` | `string` | Dirección del contrato de token ERC-1155 |
126+
| `items` | `Array<{tokenId: string, quantity: string}>` | Lista de IDs de token y cantidades a comprar |
127+
| `onSuccess` | `(txnHash: string) => void` | (Opcional) Función callback cuando la transacción es exitosa |
128+
| `onError` | `(error: Error) => void` | (Opcional) Función callback cuando ocurre un error |
129+
| `onClose` | `() => void` | (Opcional) Función callback cuando se cierra el modal |
130+
131+
## Notas
132+
Este hook simplifica el proceso de compra de tokens ERC-1155 al realizar automáticamente las siguientes acciones:
133+
- Obtener información de precios desde el contrato de venta
134+
- Determinar opciones de pago (cripto, tarjeta de crédito, etc.)
135+
- Generar los datos de transacción adecuados
136+
- Abrir y gestionar el modal de checkout
137+
138+
## Aviso de Deprecación
139+
140+
<Warning>
141+
El hook `useERC1155SaleContractPaymentModal` está obsoleto. Use `useERC1155SaleContractCheckout` en su lugar.
142+
</Warning>

es/sdk/web/checkout-sdk/hooks/useSelectPaymentModal.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@ function BuyNFT() {
111111
currencyAddress,
112112
collectionAddress,
113113
creditCardProviders: ['transak'],
114-
transakConfig: {
115-
contractId: 'your-contract-id',
116-
apiKey: 'your-api-key'
117-
},
118114
onSuccess: (txnHash: string) => {
119115
console.log('success!', txnHash)
120116
},
@@ -172,7 +168,6 @@ El objeto `settings` puede incluir las siguientes propiedades:
172168
| `currencyAddress` | `string` | Dirección del contrato del token de la moneda |
173169
| `collectionAddress` | `string` | Dirección del contrato de la colección NFT |
174170
| `creditCardProviders` | `string[]` | Lista de proveedores de tarjetas de crédito compatibles (por ejemplo, 'transak') |
175-
| `transakConfig` | `object` | Configuración para la integración con Transak |
176171
| `copyrightText` | `string` | Texto de derechos de autor para mostrar en el modal |
177172
| `onSuccess` | `(txnHash: string) => void` | Callback cuando la transacción es exitosa |
178173
| `onError` | `(error: Error) => void` | Callback cuando ocurre un error |
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
title: useERC1155SaleContractCheckout
3+
description: ERC-1155販売コントラクトのチェックアウトを管理するためのフック
4+
sidebarTitle: useERC1155SaleContractCheckout
5+
---
6+
7+
## インポート
8+
9+
```tsx
10+
import { useERC1155SaleContractCheckout } from '@0xsequence/checkout'
11+
```
12+
13+
## 使い方
14+
15+
```tsx
16+
import { useERC1155SaleContractCheckout } from "@0xsequence/checkout"
17+
import { useAccount } from "wagmi"
18+
19+
function App() {
20+
const { address: userAddress } = useAccount()
21+
const { openCheckoutModal } = useERC1155SaleContractCheckout({
22+
chain: 80001, // chainId of the chain the collectible is on
23+
contractAddress: "0x0327b2f274e04d292e74a06809bcd687c63a4ba4", // address of the contract handling the minting function
24+
wallet: userAddress!, // address of the recipient
25+
collectionAddress: "0x888a322db4b8033bac3ff84412738c096f87f9d0", // address of the collection contract
26+
items: [
27+
// array of collectibles to purchase
28+
{
29+
tokenId: "0",
30+
quantity: "1",
31+
},
32+
],
33+
onSuccess: (txnHash: string) => {
34+
console.log("success!", txnHash)
35+
},
36+
onError: (error: Error) => {
37+
console.error(error)
38+
},
39+
})
40+
41+
const onClick = () => {
42+
if (!userAddress) {
43+
return
44+
}
45+
openCheckoutModal()
46+
}
47+
48+
return <button onClick={onClick}>Buy ERC-1155 collectible!</button>
49+
}
50+
```
51+
52+
## 返り値の型: `UseERC1155SaleContractCheckoutReturnType`
53+
このフックは以下のプロパティを持つオブジェクトを返します。
54+
55+
```tsx
56+
interface UseERC1155SaleContractCheckoutReturnType {
57+
openCheckoutModal: () => void
58+
closeCheckoutModal: () => void
59+
selectPaymentSettings?: SelectPaymentSettings
60+
isLoading: boolean
61+
isError: boolean
62+
}
63+
```
64+
65+
### プロパティ
66+
67+
#### openCheckoutModal
68+
`() => void`
69+
70+
設定済みのERC-1155購入でチェックアウトモーダルを開く関数です。
71+
72+
#### closeCheckoutModal
73+
`() => void`
74+
75+
チェックアウトモーダルを閉じる関数です。
76+
77+
#### selectPaymentSettings
78+
`SelectPaymentSettings | undefined`
79+
80+
```tsx
81+
export interface SelectPaymentSettings {
82+
collectibles: Collectible[]
83+
chain: number | string
84+
currencyAddress: string | Hex
85+
price: string
86+
targetContractAddress: string | Hex
87+
txData: Hex
88+
collectionAddress: string | Hex
89+
recipientAddress: string | Hex
90+
approvedSpenderAddress?: string
91+
transactionConfirmations?: number
92+
onSuccess?: (txHash: string) => void
93+
onError?: (error: Error) => void
94+
onClose?: () => void
95+
enableMainCurrencyPayment?: boolean
96+
enableSwapPayments?: boolean
97+
enableTransferFunds?: boolean
98+
creditCardProviders?: string[]
99+
copyrightText?: string
100+
customProviderCallback?: (onSuccess: (txHash: string) => void, onError: (error: Error) => void, onClose: () => void) => void
101+
supplementaryAnalyticsInfo?: SupplementaryAnalyticsInfo
102+
}
103+
```
104+
105+
モーダルの現在の支払い設定構成です。
106+
107+
#### isLoading
108+
`boolean`
109+
110+
コントラクトデータがまだ読み込み中かどうか。
111+
112+
#### isError
113+
`boolean`
114+
115+
コントラクトデータの読み込み時にエラーが発生したかどうか。
116+
117+
## パラメータ
118+
このフックは、以下のプロパティを持つ設定オブジェクトを受け取ります:
119+
120+
| パラメータ || 説明 |
121+
| ------------------- | -------------------------------------------- | ------------------------------ |
122+
| `chain` | `number` | 販売コントラクトがデプロイされているチェーンID |
123+
| `contractAddress` | `string` | ERC-1155販売コントラクトのアドレス |
124+
| `wallet` | `string` | NFTを受け取るウォレットのアドレス |
125+
| `collectionAddress` | `string` | ERC-1155トークンコントラクトのアドレス |
126+
| `items` | `Array<{tokenId: string, quantity: string}>` | 購入するトークンIDと数量の配列。 |
127+
| `onSuccess` | `(txnHash: string) => void` | (オプション)トランザクションが成功した際のコールバック関数 |
128+
| `onError` | `(error: Error) => void` | (オプション)エラー発生時のコールバック関数 |
129+
| `onClose` | `() => void` | (オプション)モーダルが閉じられた際のコールバック関数 |
130+
131+
## 補足
132+
このフックは、ERC-1155トークンの購入プロセスを自動化し、以下の作業を簡単にします。
133+
- 販売コントラクトから価格情報を取得。
134+
- 支払いオプション(暗号資産、クレジットカードなど)を判定。
135+
- 適切なトランザクションデータを生成。
136+
- チェックアウトモーダルの表示と管理。
137+
138+
## 非推奨のお知らせ
139+
140+
<Warning>
141+
`useERC1155SaleContractPaymentModal`フックは非推奨です。代わりに`useERC1155SaleContractCheckout`をご利用ください。
142+
</Warning>

ja/sdk/web/checkout-sdk/hooks/useSelectPaymentModal.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@ function BuyNFT() {
111111
currencyAddress,
112112
collectionAddress,
113113
creditCardProviders: ['transak'],
114-
transakConfig: {
115-
contractId: 'your-contract-id',
116-
apiKey: 'your-api-key'
117-
},
118114
onSuccess: (txnHash: string) => {
119115
console.log('success!', txnHash)
120116
},
@@ -172,7 +168,6 @@ type UseSelectPaymentModalReturnType = {
172168
| `currencyAddress` | `string` | 通貨トークンコントラクトのアドレス |
173169
| `collectionAddress` | `string` | NFTコレクションコントラクトのアドレス |
174170
| `creditCardProviders` | `string[]` | 対応しているクレジットカードプロバイダー一覧(例:'transak') |
175-
| `transakConfig` | `object` | Transak連携用の設定 |
176171
| `copyrightText` | `string` | モーダル内に表示する著作権テキスト |
177172
| `onSuccess` | `(txnHash: string) => void` | トランザクションが成功した際のコールバック |
178173
| `onError` | `(error: Error) => void` | エラー発生時のコールバック |

ja/sdk/web/hooks/useERC1155SaleContractCheckout.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export interface SelectPaymentSettings {
9797
enableTransferFunds?: boolean
9898
creditCardProviders?: string[]
9999
copyrightText?: string
100-
transakConfig?: TransakConfig
101100
customProviderCallback?: (onSuccess: (txHash: string) => void, onError: (error: Error) => void, onClose: () => void) => void
102101
supplementaryAnalyticsInfo?: SupplementaryAnalyticsInfo
103102
}

ja/sdk/web/hooks/useSelectPaymentModal.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ function App() {
6464
currencyAddress,
6565
collectionAddress,
6666
creditCardProviders: ['transak'],
67-
transakConfig: {
68-
contractId: 'your-contract-id',
69-
apiKey: 'your-api-key'
70-
},
7167
copyrightText: 'ⓒ2024 Your Company',
7268
onSuccess: (txnHash: string) => {
7369
console.log('success!', txnHash)
@@ -122,7 +118,6 @@ type UseSelectPaymentModalReturnType = {
122118
| `currencyAddress` | `string` | 通貨トークンコントラクトのアドレス |
123119
| `collectionAddress` | `string` | NFTコレクションコントラクトのアドレス |
124120
| `creditCardProviders` | `string[]` | 対応するクレジットカードプロバイダーのリスト(例: 'transak') |
125-
| `transakConfig` | `object` | Transak連携用の設定 |
126121
| `copyrightText` | `string` | モーダル内に表示する著作権テキスト |
127122
| `onSuccess` | `(txnHash: string) => void` | トランザクションが成功した際のコールバック |
128123
| `onError` | `(error: Error) => void` | エラー発生時のコールバック |

sdk/web/checkout-sdk/hooks/useERC1155SaleContractCheckout.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ export interface SelectPaymentSettings {
102102
enableTransferFunds?: boolean
103103
creditCardProviders?: string[]
104104
copyrightText?: string
105-
transakConfig?: TransakConfig
106105
customProviderCallback?: (onSuccess: (txHash: string) => void, onError: (error: Error) => void, onClose: () => void) => void
107106
supplementaryAnalyticsInfo?: SupplementaryAnalyticsInfo
108107
}

sdk/web/checkout-sdk/hooks/useSelectPaymentModal.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ function BuyNFT() {
112112
currencyAddress,
113113
collectionAddress,
114114
creditCardProviders: ['transak'],
115-
transakConfig: {
116-
contractId: 'your-contract-id',
117-
apiKey: 'your-api-key'
118-
},
119115
onSuccess: (txnHash: string) => {
120116
console.log('success!', txnHash)
121117
},
@@ -175,7 +171,6 @@ The `settings` object can include the following properties:
175171
| `currencyAddress` | `string` | Address of the currency token contract |
176172
| `collectionAddress` | `string` | Address of the NFT collection contract |
177173
| `creditCardProviders` | `string[]` | List of supported credit card providers (e.g., 'transak') |
178-
| `transakConfig` | `object` | Configuration for Transak integration |
179174
| `copyrightText` | `string` | Copyright text to display in the modal |
180175
| `onSuccess` | `(txnHash: string) => void` | Callback when transaction succeeds |
181176
| `onError` | `(error: Error) => void` | Callback when an error occurs |

0 commit comments

Comments
 (0)