Smart Contract Portal
Using the Smart Contract Portal in your SettleMint dApp
About
The SettleMint Smart Contract Portal SDK provides a seamless way to interact with the Smart Contract Portal Middleware API. It enables you to easily interact with your smart contracts using a REST or GraphQL API.
The SDK offers a type-safe interface for all Portal API operations, with comprehensive error handling and validation. It integrates smoothly with modern TypeScript applications while providing a simple and intuitive developer experience.
Examples
Deploy contract
Get pending transactions
Send transaction using hd wallet
API Reference
Functions
createPortalClient()
createPortalClient<
Setup
>(options
,clientOptions?
):object
Defined in: sdk/portal/src/portal.ts:71
Creates a Portal GraphQL client with the provided configuration.
Type Parameters
Type Parameter |
---|
Setup extends AbstractSetupSchema |
Parameters
Parameter | Type | Description |
---|---|---|
options | { accessToken : string ; cache? : "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" ; instance : string ; } | Configuration options for the Portal client |
options.accessToken | string | - |
options.cache? | "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" | - |
options.instance? | string | - |
clientOptions? | RequestConfig | Additional GraphQL client configuration options |
Returns
object
An object containing the configured GraphQL client and graphql helper function
Name | Type | Defined in |
---|---|---|
client | GraphQLClient | sdk/portal/src/portal.ts:75 |
graphql | initGraphQLTada <Setup > | sdk/portal/src/portal.ts:76 |
Throws
If the provided options fail validation
Example
handleWalletVerificationChallenge()
handleWalletVerificationChallenge<
Setup
>(options
):Promise
<{challengeResponse
:string
;verificationId?
:string
; }>
Defined in: sdk/portal/src/utils/wallet-verification-challenge.ts:106
Handles a wallet verification challenge by generating an appropriate response
Type Parameters
Type Parameter |
---|
Setup extends AbstractSetupSchema |
Parameters
Parameter | Type | Description |
---|---|---|
options | HandleWalletVerificationChallengeOptions <Setup > | The options for handling the wallet verification challenge |
Returns
Promise
<{ challengeResponse
: string
; verificationId?
: string
; }>
Promise resolving to an object containing the challenge response and optionally the verification ID
Throws
If the challenge cannot be created or is invalid
Example
waitForTransactionReceipt()
waitForTransactionReceipt(
transactionHash
,options
):Promise
<Transaction
>
Defined in: sdk/portal/src/utils/wait-for-transaction-receipt.ts:82
Waits for a blockchain transaction receipt by subscribing to transaction updates via GraphQL. This function polls until the transaction is confirmed or the timeout is reached.
Parameters
Parameter | Type | Description |
---|---|---|
transactionHash | string | The hash of the transaction to wait for |
options | WaitForTransactionReceiptOptions | Configuration options for the waiting process |
Returns
Promise
<Transaction
>
The transaction details including receipt information when the transaction is confirmed
Throws
Error if the transaction receipt cannot be retrieved within the specified timeout
Example
Interfaces
HandleWalletVerificationChallengeOptions<Setup>
Defined in: sdk/portal/src/utils/wallet-verification-challenge.ts:73
Options for handling a wallet verification challenge
Type Parameters
Type Parameter | Description |
---|---|
Setup extends AbstractSetupSchema | The GraphQL schema setup type |
Transaction
Defined in: sdk/portal/src/utils/wait-for-transaction-receipt.ts:25
Represents the structure of a blockchain transaction with its receipt
WaitForTransactionReceiptOptions
Defined in: sdk/portal/src/utils/wait-for-transaction-receipt.ts:58
Options for waiting for a transaction receipt
Type Aliases
ClientOptions
ClientOptions =
object
Defined in: sdk/portal/src/portal.ts:24
Type representing the validated client options.
Type declaration
Name | Type | Default value | Defined in |
---|---|---|---|
accessToken | string | ApplicationAccessTokenSchema | sdk/portal/src/portal.ts:17 |
cache? | "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" | - | sdk/portal/src/portal.ts:18 |
instance | string | UrlOrPathSchema | sdk/portal/src/portal.ts:16 |
RequestConfig
RequestConfig =
ConstructorParameters
<typeofGraphQLClient
>[1
]
Defined in: sdk/portal/src/portal.ts:10
Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.
Variables
ClientOptionsSchema
const
ClientOptionsSchema:ZodObject
<ClientOptions
>
Defined in: sdk/portal/src/portal.ts:15
Schema for validating Portal client configuration options.
Contributing
We welcome contributions from the community! Please check out our Contributing guide to learn how you can help improve the SettleMint SDK through bug reports, feature requests, documentation updates, or code contributions.
License
The SettleMint SDK is released under the FSL Software License. See the LICENSE file for more details.