Skip to content

Commit ac4911e

Browse files
committed
forteConfig documentation
1 parent b625783 commit ac4911e

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,58 @@ The `settings` object can include the following properties:
176176
| `onError` | `(error: Error) => void` | Callback when an error occurs |
177177
| `onClose` | `() => void` | Callback when the modal is closed |
178178
| `txData` | `string` | Encoded transaction data for the purchase |
179+
| `forteConfig` | `object` | Forte configuration |
180+
181+
#### forteConfig
182+
183+
The forteConfig object must be provided to enable Forte payments.
184+
185+
The protocol must be set to either `custom_evm_call` and or `mint` depending on whether the transaction is a mint or a general transaction.
186+
Furthermore, a `sellerAddress` string must be provided, indicating the address of the seller in the case of a transaction or the address of the contract in the case of a mint
187+
188+
The calldata can be either string with the calldata (the same as the `txData` already provided) or a structured calldata object, detailing the function name and the arguments. Crucially, the structured calldata requires a receiver address to be specified as shown in the example below.
189+
190+
```tsx
191+
const structuredCalldata = {
192+
functionName: 'mint',
193+
arguments: [
194+
{
195+
type: 'address',
196+
value: '${receiver_address}' // The address of the receiver of the minted NFTs
197+
},
198+
{
199+
type: 'uint256[]',
200+
value: ['1']
201+
},
202+
{
203+
type: 'uint256[]',
204+
value: ['1']
205+
},
206+
{
207+
type: 'bytes',
208+
value: toHex(0)
209+
},
210+
{
211+
type: 'address',
212+
value: currencyAddress
213+
},
214+
{
215+
type: 'uint256',
216+
value: price
217+
},
218+
{
219+
type: 'bytes32[]',
220+
value: [toHex(0, { size: 32 })]
221+
}
222+
]
223+
}
224+
225+
forteConfig: {
226+
protocol: 'custom_evm_call',
227+
calldata: structuredCalldata,
228+
sellerAddress: '0x184D4F89ad34bb0491563787ca28118273402986'
229+
}
230+
```
179231

180232
#### closeSelectPaymentModal
181233

0 commit comments

Comments
 (0)