SDK Reference

* Asterisks indicate required fields

SDK methods

PaperEmbeddedWalletSdk

Arguments

{
  clientId: string,
  chain: string,
  styles?: Styles,
 	advancedOptions?: AdvancedOptions,
}
NameTypeDescription
clientId *stringThe Client ID from the Dashboard: Wallet Settings.
chain *enum

Valid values:
Polygon
Mumbai
Ethereum
Goerli
The blockchain to manage wallets on.
stylesobjectSettings to customize the UI components.
advancedOptionsobjectUse to customize various settings not immediately needed when starting to develop. See the advanceOptions object for more

Styles object

NameTypeDescription
colorBackgroundstring

6-character hex beginning with # (ex: #232323)
The background color of the UI components.
colorTextstring

6-character hex beginning with # (ex: #F5F5F5)
The text color of the UI components.
colorPrimarystring

6-character hex beginning with # (ex: #F5F5F5)
The button and link color of the UI components.
borderRadiusnumber

Common values: 0 (sharp), 12 (rounded), 24 (pill-shaped)
The roundness of buttons.

AdvancedOptions object

NameTypeDescription
recoveryShareManagementRecoveryShareManagement enum

Valid Values:
USER_MANAGED
AWS_MANAGED
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

PaperEmbeddedWalletSdk

getUser

This method is asynchronous.

Arguments

None

Return type

Promise<{
  status: UserStatus.LOGGED_OUT;
}| InitializedUser>
NameTypeDescription
statusUserStatus
Valid values:
- UserStatus.LOGGED_OUT
- UserStatus.LOGGED_IN_WALLET_INITIALIZED
An enum representing whether the user is logged in.
userInitializedUser | undefinedSet to undefined only if the user is logged out.

InitializedUser object

NameTypeDescription
statusUserStatus.LOGGED_IN_WALLET_INITIALIZED
authDetailsAuthDetailsDetailed information about the authenticated user.
walletAddressstringThe user's wallet address.
walletEmbeddedWalletAn initialized wallet class that has methods to read and interact with the blockchain.

AuthDetails object

NameTypeDescription
emailstringThe 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;
}>
NameTypeDescription
userInitializedUser

InitializedUser object

NameTypeDescription
statusUserStatus.LOGGED_IN_WALLET_INITIALIZED
authDetailsAuthDetailsDetailed information about the authenticated user.
walletAddressstringThe user's wallet address.
walletEmbeddedWalletAn initialized wallet class that has methods to read and interact with the blockchain.

AuthDetails object

NameTypeDescription
emailstringThe user's email address

loginWithPaperEmailOtp

This method is asynchronous.

Arguments

NameTypeDescription
email*stringThe user's email address to verify.

Return type

This response type is identical to loginWithPaperModal.

loginWithJwtAuth

This method is asynchronous.

Arguments

NameTypeDescription
token*stringThe user's JWT to be verified by your JWKS endpoint.
authProviderAuthProvider
Valid values:
- CustomJWT
The authentication provider for the user to log into.
recoveryCodestringRequired if the user is an existing user

Return type

This response type is identical to loginWithPaperModal.

sendPaperEmailLoginOtp

This method is asynchronous.

Arguments

NameTypeDescription
email*stringThe user's email address to verify.

Return type

Promise<{
  isNewUser: boolean;
}> 
NameTypeDescription
isNewUserbooleanReturns true if this is the user's first time logging into your Paper EWS

verifyPaperEmailLoginOtp

This method is asynchronous.

Arguments

NameTypeDescription
email*stringThe user's email address to verify.
otp*stringThe OTP that was sent to the user's email
recoveryCodestringRequired 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;
}> 
NameTypeDescription
successbooleanReturns 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;
}
NameTypeDescription
chain *ChainThe 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[];
}
NameTypeDescription
contractAddress *stringThe address of the smart contract.
methodInterface *stringThe interface of the smart contract method to call.

Example:
function claimTo(address _to, uint256 _tokenId, uint256 _quantity) external
methodArgs *ArgType[]

Valid types:
- boolean
- string
- number
- object
- array
The arguments to pass to the method. Should match the order and type from the method stub.

Return type

Promise<CallContractReturnType>
NameTypeDescription
transactionHash *stringThe 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.