* Asterisks indicate required fields
SDK methods
PaperEmbeddedWalletSdk
Arguments
{
clientId: string,
chain: string,
styles?: Styles,
advancedOptions?: AdvancedOptions,
}| Name | Type | Description |
|---|---|---|
| clientId * | string | The Client ID from the Dashboard: Wallet Settings. |
| chain * | enum Valid values: | The blockchain to manage wallets on. |
| styles | object | Settings to customize the UI components. |
| advancedOptions | object | Use to customize various settings not immediately needed when starting to develop. See the advanceOptions object for more |
Styles object
Styles object| Name | Type | Description |
|---|---|---|
| colorBackground | string 6-character hex beginning with # (ex: #232323) | The background color of the UI components. |
| colorText | string 6-character hex beginning with # (ex: #F5F5F5) | The text color of the UI components. |
| colorPrimary | string 6-character hex beginning with # (ex: #F5F5F5) | The button and link color of the UI components. |
| borderRadius | number Common values: 0 (sharp), 12 (rounded), 24 (pill-shaped) | The roundness of buttons. |
AdvancedOptions object
AdvancedOptions object| Name | Type | Description |
|---|---|---|
| recoveryShareManagement |
Valid Values: | Indicates who should be in charge of managing the user's recovery share. Choosing AWS_MANAGED is the easiest to get started and is generally what we recommend. For more information, see managing the user's recovery share. |
Return type
PaperEmbeddedWalletSdkgetUser
This method is asynchronous.
Arguments
None
Return type
Promise<{
status: UserStatus.LOGGED_OUT;
}| InitializedUser>| Name | Type | Description |
|---|---|---|
| status | UserStatus Valid values: - UserStatus.LOGGED_OUT- UserStatus.LOGGED_IN_WALLET_INITIALIZED | An enum representing whether the user is logged in. |
| user | InitializedUser | undefined | Set to undefined only if the user is logged out. |
InitializedUser object
InitializedUser object| Name | Type | Description |
|---|---|---|
| status | UserStatus.LOGGED_IN_WALLET_INITIALIZED | |
| authDetails | AuthDetails | Detailed information about the authenticated user. |
| walletAddress | string | The user's wallet address. |
| wallet | EmbeddedWallet | An initialized wallet class that has methods to read and interact with the blockchain. |
AuthDetails object
AuthDetails object| Name | Type | Description |
|---|---|---|
| string | The user's email address |
auth
These methods are called in the auth namespace, e.g. sdk.auth.logout().
loginWithPaperModal
This method is asynchronous.
Arguments
None
Return type
Promise<{
user: InitializedUser;
}>| Name | Type | Description |
|---|---|---|
| user | InitializedUser |
InitializedUser object
InitializedUser object| Name | Type | Description |
|---|---|---|
| status | UserStatus.LOGGED_IN_WALLET_INITIALIZED | |
| authDetails | AuthDetails | Detailed information about the authenticated user. |
| walletAddress | string | The user's wallet address. |
| wallet | EmbeddedWallet | An initialized wallet class that has methods to read and interact with the blockchain. |
AuthDetails object
AuthDetails object| Name | Type | Description |
|---|---|---|
| string | The user's email address |
loginWithPaperEmailOtp
This method is asynchronous.
Arguments
| Name | Type | Description |
|---|---|---|
| email***** | string | The user's email address to verify. |
Return type
This response type is identical to loginWithPaperModal.
loginWithJwtAuth
This method is asynchronous.
Arguments
| Name | Type | Description |
|---|---|---|
| token***** | string | The user's JWT to be verified by your JWKS endpoint. |
| authProvider | AuthProvider Valid values: - CustomJWT | The authentication provider for the user to log into. |
| recoveryCode | string | Required if the user is an existing user |
Return type
This response type is identical to loginWithPaperModal.
sendPaperEmailLoginOtp
This method is asynchronous.
Arguments
| Name | Type | Description |
|---|---|---|
| email***** | string | The user's email address to verify. |
Return type
Promise<{
isNewUser: boolean;
}> | Name | Type | Description |
|---|---|---|
| isNewUser | boolean | Returns true if this is the user's first time logging into your Paper EWS |
verifyPaperEmailLoginOtp
This method is asynchronous.
Arguments
| Name | Type | Description |
|---|---|---|
| email***** | string | The user's email address to verify. |
| otp***** | string | The OTP that was sent to the user's email |
| recoveryCode | string | Required if the user is an existing user (if !isNewUser === true from the sendPaperEmailLoginOtp response earlier) |
Return type
This response type is identical to loginWithPaperModal.
logout
This method is asynchronous.
Arguments
None
Return type
Promise<{
success: boolean;
}> | Name | Type | Description |
|---|---|---|
| success | boolean | Returns true if the user is successfully logged out. |
EmbeddedWallet
These methods are called on the EmbeddedWallet returned from getUserStatus() or login methods.
const loginResult = await sdk.auth.loginWithPaperModal();
const wallet = loginResult.user.wallet;getEthersJsSigner
This method is asynchronous.
Arguments
None
Return type
Promise<EthersSigner>EthersSigner satisfies the Ethers.js Signer abstract class.
setChain
This method is asynchronous.
Arguments
{
chain: Chain;
}| Name | Type | Description |
|---|---|---|
| chain * | Chain | The new chain that you want to switch too |
Return type
Promise<void>gasless.callContract
This method is asynchronous.
Arguments
{
contractAddress: string;
methodInterface: string;
methodArgs: ArgType[];
}| Name | Type | Description |
|---|---|---|
| contractAddress * | string | The address of the smart contract. |
| methodInterface * | string | The interface of the smart contract method to call. Example: |
| methodArgs * | ArgType[] Valid types: | The arguments to pass to the method. Should match the order and type from the method stub. |
Return type
Promise<CallContractReturnType>| Name | Type | Description |
|---|---|---|
| transactionHash * | string | The blockchain transaction hash of this request. Note: A hash is provided even if the transaction failed on-chain. Please check the result of the transaction if you need to confirm if the transaction was successful. |