Arkane Connect JS

Introduction

In order to conveniently integrate Arkane into your JavaScript applications we’ve developed a JavaScript SDK: Arkane Connect JS.

This wraps all of Arkane’s functionalities with a JavaScript layer in order to facilitate development.

Get Arkane Connect JS

Arkane Connect JS has been published to npmjs.com. So using npm, you can fetch it by executing the following:

npm i @arkane-network/arkane-connect

You can also download it directly via UNPKG CDN:

It is best to point Arkane Connect JS to a specific version when including this URL in your code. See https://unpkg.com/ on how to do that.

Integrating Arkane Connect JS

To integrate Arkane Connect JS in your web application, you will need to create a new ArkaneConnect instance and provide the instance with a way to authenticate. There are two options for doing this:

  1. You use the Arkane authentication provider.

  2. You initialize Arkane Connect JS providing it with your own bearer token provider.

Constructor

Signature
new ArkaneConnect(clientID:string, options?: ConstructorOptions);
Table 1. Parameters

Parameter

Required

Description

Example

clientID

true

The clientID (case sensitive)

'Arketype'

options

false

ConstructorOptions

{ windowMode: 'REDIRECT' }

Examples

Example 1
// use production environment
// + sign/execute transactions using the POPUP method
// + authentication using Arkane Connect JS
const arkaneConnect = new ArkaneConnect('Arketype');
Example 2
// use production environment
// + sign transactions using the REDIRECT method
// + authentication using Arkane Connect JS
const arkaneConnect = new ArkaneConnect('Arketype', { windowMode: 'REDIRECT' });
Example 3
// use staging environment
// + sign transactions using the REDIRECT method
// + authentication using bearerTokenProvider supplied by the client
const arkaneConnect = new ArkaneConnect('Arketype', { environment: 'staging',
                                                      windowMode: 'REDIRECT',
                                                      bearerTokenProvider: () => auth.token});

DataTypes

ConstructorOptions

Signature
{
  environment?: string,
  windowMode?: WindowMode,
  signMethod?: string,
  bearerTokenProvider?: () => string
}
Table 2. Parameters

Option

Required

Description

Example

environment

false (default = 'prod')

The environment to which you want to connect, possible values are 'local', 'tst1', 'staging', 'prod'

'staging'

windowMode

false (default = 'POPUP')

WindowMode The sign method you want to use, possible values are 'POPUP' or 'REDIRECT'

'REDIRECT'

signMethod

false (default = 'POPUP')

Deprecated Use windowMode instead

bearerTokenProvider

false (default = the Arkane Connect JS authentication client)

You can implement all the authentication handling yourself and provide Arkane Connect JS with your own bearer token provider. The bearer token provider is a function returning the bearer token (access token) to login to Arkane.

() ⇒ auth.token

WindowMode

Signature
{
    POPUP = 'POPUP',
    REDIRECT = 'REDIRECT'
}

Authentication [Check buildingblock Arkane Identity]

Check if a user is authenticated

Signature
arkaneConnect.checkAuthenticated(options?: AuthenticationOptions): Promise<AuthenticationResult>

Returns Promise<AuthenticationResult>

Description

This function call will check if the user is authenticated and redirect the user to options.redirectUri (if present) with the result.

If you set the redirectUri option, make sure that the SDK and the AuthenticationResult handling is also present on the page you redirect to.
Table 3. Parameters

Parameter

Required

Description

Example

options

false

AuthenticationOptions

{ redirectUri: 'https://arkane.network' }

Examples

Example 1
// Redirect to the current page
arkaneConnect.checkAuthenticated();
Example 2
// Redirect to https://arkane.network
arkaneConnect.checkAuthenticated({ redirectUri: 'https://arkane.network' });

Authenticate a user

Signature
arkaneConnect.flows.authenticate(options?: AuthenticationOptions): Promise<AuthenticationResult>

Returns Promise<AuthenticationResult>

Description

This function will check if the user is authenticated (showing a login form if the user is not already authenticated).

  • For windowMode = 'REDIRECT', the user will be redirect to options.redirectUri (if present) with the result (after logging in).

  • For windowMode = 'POPUP', when the user finishes the popup closes and the promise resolves. No extra options are required.

If you set the redirectUri option, make sure that the SDK and the AuthenticationResult handling is also present on the page you redirect to.
Table 4. Parameters

Parameter

Required

Description

Example

options

false

AuthenticationOptions

{ redirectUri: 'https://arkane.network', windowMode: 'REDIRECT' }

Examples

Example 1
// Redirect to the current page
arkaneConnect.flows.authenticate({ windowMode: 'REDIRECT' });
Example 2
// Redirect to https://arkane.network
arkaneConnect.flows.authenticate({ redirectUri: 'https://arkane.network', windowMode: 'REDIRECT'});
Example 4
// Login using popup
arkaneConnect.flows.authenticate({ windowMode: 'POPUP' })
    .then((result: AuthenticationResult) => {
        result
            .authenticated((auth: AuthenticationInstance) => {
                alert('logged in: ' + auth.subject);
            })
            .notAuthenticated((auth: AuthenticationInstance) => {
                alert('not logged in');
            });
    });

Log a user out

Signature
arkaneConnect.logout(options?: AuthentciationOptions): Promise<void>

Returns Promise<void>

Description

This logs the user out of Arkane. The behaviour is different depending on the windowMode used to instantiate ArkaneConnect or provided in the options:

  1. POPUP (default): The user will be logged out in the background and the promise will resolve when finished. This means the application needs to cleanup all user data on screen itself.

  2. REDIRECT: The user will be redirected to the logout endpoint of our Arkane authentication provider and afterwards will be redirected back to the page he/she was on (or the redirectUri provided in the options). So the page refreshes automatically and no cleanup should be necessary.

Table 5. Parameters

Parameter

Required

Description

Example

options

false

[AuthenticationOptions]

{ redirectUri: 'https://arkane.network', windowMode: 'REDIRECT' }

Example 1
// Log out, then cleanup user data on screen
arkaneConnect.logout({ windowMode: 'POPUP' })
             .then(() => {
                 // Cleanup user data on screen
                 handleLogout();
             });
Example 2
// Log out and redirect to the current page
arkaneConnect.logout({ windowMode: 'REDIRECT' });
Example 3
// Log out and redirect to https://arkane.network
arkaneConnect.logout({ windowMode: 'REDIRECT' , redirectUri: 'https://arkane.network'});

Receive a callback when the bearer token refreshes

Signature
arkaneConnect.addOnTokenRefreshCallback(tokenRefreshCallback: (token: string) => void): void
Description

You can add a callback method that will be called each time the bearer token is refreshed. This can only be used while using the Arkane Connect JS authentication client. This function has one parameter: a callback function accepting one parameter (the new bearer token) and returning void.

Table 6. Paramters

Parameter

Required

Description

Example

tokenRefreshCallback

true

a callback function accepting one parameter (the new bearer token) and returning void

arkaneConnect.addOnTokenRefreshCallback(token => {
  console.log('Refreshed bearer token: ' + token);
});

Data types

AuthenticationOptions

Signature
{
  redirectUri?: string,
  windowMode: WindowMode,
  closePopup?: boolean
}
Table 7. Parameters

Parameter

Required

Description

Example

redirectUri

false (default = the current URI)

The URI you want the user to be redirected after checking authentication. Only used when windowMode=REDIRECT

'https://arkane.network'

windowMode

false (default = windowMode passed in ConstructorOptions)

WindowMode Show login form in POPUP, or login using redirect

'REDIRECT'

AuthenticationResult

Signature
{
    auth: AuthenticationInstance,
    isAuthenticated: boolean,
    authenticated: (onAuthenticated: (auth: AuthenticationInstance) => void) => AuthenticationResult;
    notAuthenticated: (onNotAuthenticated: (auth: AuthenticationInstance) => void) => AuthenticationResult;
}
Description

You can supply two callback functions to the AuthenticationResult: authenticated and notAuthenticated, each will be passed the AuthenticationInstance.

Table 8. Parameters

Parameter

Required

Description

Example

authenticated

true

a callback function to be executed when the user is authenticated after the call.

(auth) => {
  console.log('The user is authenticated: ' + auth.subject);
};

notAuthenticated

true

a callback function to be executed when the user is not authenticated after the call.

(auth) => {
  console.log('The user is not authenticated');
};
Example
// Check if a user is authenticated.
arkaneConnect.checkAuthenticated()
             .then((result) => result.authenticated((auth) => {
                                        console.log('The user is authenticated: ' + auth.subject);
                                     })
                                     .notAuthenticated((auth) => {
                                        console.log('The user is not authenticated');
                                     })
             );

// Check if a user is authenticated. If not, show the login form
arkaneConnect.authenticate()
            .then((result) => result.authenticated((auth) => {
                                       console.log('The user is authenticated: '  + auth.subject);
                                    })
                                    .notAuthenticated((auth) => {
                                       console.log('The user is not authenticated');
                                    })
            );

AuthenticationInstance

Signature
{
  authenticated?: boolean;
  subject?: string;
  realmAccess?: { roles: string[] };
  resourceAccess?: string[];
  token?: string;
  tokenParsed?: {
    exp?: number;
    email?: string,
    name?: string,
    iat?: number;
    nonce?: string;
    sub?: string;
    session_state?: string;
    realm_access?: { roles: string[] };
    resource_access?: string[];
  };
  refreshToken?: string;
  refreshTokenParsed?: { nonce?: string };
  idToken?: string;
  idTokenParsed?: { nonce?: string };
  timeSkew?: number;
}
Table 9. Parameters

Parameter

Description

authenticated

Is true if the user is authenticated, false otherwise.

subject

The user id.

realmAccess

The realm roles associated with the token.

resourceAccess

The resource roles associated with the token.

token

The base64 encoded token that can be sent in the Authorization header in requests to services.

tokenParsed

The parsed JWT token as a JavaScript object.

refreshToken

The base64 encoded refresh token that can be used to retrieve a new token.

refreshTokenParsed

The parsed refresh token as a JavaScript object.

idToken

The base64 encoded ID token.

idTokenParsed

The parsed id token as a JavaScript object.

timeSkew

The estimated time difference between the browser time and the authentication server in seconds. This value is just an estimation, but is accurate enough when determining if a token is expired or not.

Profile

User Profile [Reference]

Signature
arkaneConnect.api.getProfile(): Promise<Profile>

Wallet Flows

Get Account

Signature
arkaneConnect.flows.getAccount(chain: SecretType): Promise<Account>

Returns Account

Description
  • In case the user is authenticated and has linked wallets, no popup opens.

  • If user is not authenticated, it will open a popup to login in or create a new account.

  • If user has no linked wallets, it will open the manage wallets popup and ask to link a wallet or create a new one.

  • When not logged in and no linked wallets / or no account yet, it will do all the steps above sequentially.

When finished, popup closes (if opened of course) and promise resolves.

Table 10. Parameters

Parameter

Required

Description

chain

true

The requested chain of which it will return it’s wallets.

Example
// Authenticate, and get the ethereum wallets of current user.
arkaneConnect.flows.getAccount('ETHEREUM').then((account: Account) => {
    if(account.isAuthenticated) {
        console.log('wallets', account.wallets);
        console.log('name', account.auth.tokenParsed.name);
    }
}).catch((e) => {
    console.log('user closed window, or an error occurred', e);
});

Account

Signature
{
   wallets: Wallet[],
   auth: AuthenticationInstance,
   isAuthenticated: boolean
}
Signature
arkaneConnect.flows.linkWallets(options?: {
    redirectUri?: string,
    correlationID?: string
}): Promise<PopupResult | void>
Table 11. Parameters

Parameter

Required

Description

options

false

The options you want to provide (if any)

options.redirectUri

false (default = the current URI/referer)

The URI you want users to be redirected to after linking their wallets.

options.correlationID

false

A unique correlationID allowing you to identify this specific transaction. It will be appended as a request parameter to the redirectUri upon return.

Example
// redirects the user to the link wallets screen
// + redirects the user to https://arkane.network once he's done
// + appends the correlationID as a request parameter when being redirected back
arkaneConnect.flows.linkWallets({
    redirectUri: 'https://arkane.network',
    correlationID: 'f173a18d-7a75-4429-9df4-25153d64a921'
});

Manage wallets [Reference]

Signature
arkaneConnect.flows.manageWallets(
    chain: string,
    options?: {
        redirectUri?: string,
        correlationID?: string
    }
): Promise<PopupResult | void>

Returns Promise<PopupResult | void>

Table 12. Parameters

Parameter

Required

Description

chain

true

The chain for which your user wants to manage his wallets ('AETERNITY', 'BITCOIN', 'ETHEREUM', 'GOCHAIN', 'LITECOIN', 'TRON', 'VECHAIN')

options

false

The options you want to provide (if any)

options.redirectUri

false (default = the current URI/referer)

The URI you want users to be redirected to after linking their wallets.

options.correlationID

false

A unique correlationID allowing you to identify this specific transaction. It will be appended as a request parameter to the redirectUri upon return.

Example
// redirects the user to the manage wallets screen for his Ethereum wallets
// + redirects the user to https://arkane.network once he's done
// + appends the correlationID as a request parameter when being redirected back
arkaneConnect.manageWallets(
    'ETHEREUM',
    {
        redirectUri: 'https://arkane.network',
        correlationID: 'f173a18d-7a75-4429-9df4-25153d64a921'
    }
);

PopupResult

Signature
{
    status: 'SUCCESS' | 'ABORTED' | 'FAILED',
    result?: any,
    errors?: any[]
}

Wallet Api

List user wallets [Reference]

Signature
arkaneConnect.api.getWallets(filter?: { secretType?: SecretType }): Promise<Wallet[]>
Table 13. Parameters

Parameter

Required

Description

filter

false

The filter that will be applied on the wallets result

filter.secretType

false

The secretType ('AETERNITY', 'BITCOIN', 'ETHEREUM', 'GOCHAIN', 'LITECOIN', 'TRON', 'VECHAIN') you want to filter on

Get user wallet [Reference]

Signature
arkaneConnect.api.getWallet(walletId: string): Promise<Wallet>
Table 14. Parameters

Parameter

Required

Description

walletId

true

The Arkane ID of the wallet you want to fetch

Get native balance [Reference]

Signature
arkaneConnect.api.getBalance(walletId: string): Promise<WalletBalance>
Table 15. Parameters

Parameter

Required

Description

walletId

true

The Arkane ID of the wallet you want to fetch the balance for.

Get token balances [Reference]

Signature
arkaneConnect.api.getTokenBalances(walletId: string): Promise<TokenBalance[]>
Table 16. Parameters

Parameter

Required

Description

walletId

true

The Arkane ID of the wallet you want to fetch the balance for.

Get specific token balance [Reference]

Signature
arkaneConnect.api.getTokenBalance(walletId: string, tokenAddress: string): Promise<TokenBalance>
Table 17. Parameters

Parameter

Required

Description

walletId

true

The Arkane ID of the wallet you want to fetch the balance for.

tokenAddress

true

The address of the token contract you want to fetch the balance of.

Signature
arkaneConnect.api.unlink(walletId: string): Promise<void>
Table 18. Parameters

Parameter

Required

Description

walletId

true

The Arkane ID of the wallet you want to unlink.

Application wallet

Create application wallet [Reference]

To create an application wallet for a user, he needs to enter his PIN for approval. For this we can use an Arkane Connect JS Signer,

Signature
signer.confirm(confirmRequest, options?): Promise<SignerResult>

Returns Promise<SignerResult>

When successful, the signerResult.data-property will contain the wallet ID of the newly created wallet

Table 19. Parameters

Parameter

Required

Description

confirmRequest

true

The confirm request you want to execute. For more info on how this request should look like, see reference.

options

false

The options you want to pass.

Full example
const signer = arkaneConnect.createSigner();

signer.confirm({ secretType: 'TRON', confirmationRequestType: 'CREATE_APPLICATION_WALLET' })
      .then((signerResult) => {
          if (signerResult.success) {
              console.log(`An application wallet with ID ${signerResult.result.walletId} has been successfully created!`);
          } else {
              console.warn(`Something went wrong while trying to create an application wallet`);
          }
      })
      .catch((reason) => {
          console.log(error);
      });

Execute a requested transaction [Reference]

Signature
signer.executeSavedTransaction(transactionRequestId: string, redirectOptions?: RedirectOptions): Promise<SignerResult>

Returns Promise<SignerResult>

When successful, the SignerResult.data-property will contain the transaction hash of the executed transaction

Table 20. Parameters

Parameter

Required

Description

transactionRequestId

true

The ID of the transaction request you want the user to sign off.

redirectOptions

false

The RedirectOptions you want to pass.

Full example
const signer = arkaneConnect.createSigner();

signer.executeTransaction('70fc00ec-9b0f-4edb-b301-097cf6ee8e31')
      .then((signerResult) => {
          if (signerResult.success) {
              console.log(`Transaction ${signerResult.result.transactionHash} has been successfully executed!`);
          } else {
              console.warn(`Something went wrong while executing the transaction`);
          }
      })
      .catch((reason) => {
          console.log(error);
      });

Transactions

The signer

To execute and sign transactions, the user needs to enter his PIN. To enable him to do so, we have to create a Signer. In Arkane Connect JS we provide you with two types of signers:

  • popup-signer (default): This will open the signer in a popup

  • redirect-signer: This will redirect the user to a signer page

Creating a signer

Signature
arkaneConnect.createSigner(signUsing?: 'POPUP' | 'REDIRECT'): Signer
Table 21. Parameters

Parameter

Required

Description

signUsing

false (default = the method supplied in the constructor, 'POPUP' if none was passed).

The method you want to use to sign this transaction.

If you are using the popup signer and you want to execute a transaction as a reaction to an event (e.g. a button click), then call arkaneConnect.createSigner(…​) as very first in your event handler, otherwise the popup might get blocked by the popup blocker of the browser.

Closing the signer (if signUsing='POPUP')

Code snippet
const signer = arkaneConnect.createSigner('POPUP');
if (arkaneConnect.isPopupSigner(signer)) {
    signer.closePopup();
}

If you want to close the signer popup manually (e.g. if something goes wrong between opening it and submitting the transactionRequest), you can use above code snippet to close it. The type guard, isn’t mandatory, but it makes the code more robust.

Simple transfer [Reference]

Signature
signer.executeTransfer(transferRequestDto, options?): Promise<SignerResult>

Returns Promise<SignerResult>

Table 22. Parameters

Parameter

Required

Description

transferRequestDto

true

The transfer request you want to execute. For more info on how this request should look like, see reference.

options

false

The options you want to pass.

Full example
const signer = arkaneConnect.createSigner();

signer.executeTransfer({
    walletId: '71dec640-4eb8-4321-adb8-b79461573fc4',
    to: '0xf147cA0b981C0CD0955D1323DB9980F4B43e9FED',
    value: 3.14159265359,
    secretType: 'ETHEREUM',
}).then((signerResult) => {
   if (signerResult.success) {
       console.log(`Transaction ${signerResult.result.transactionHash} has been successfully executed!`);
   } else {
       console.warn(`Something went wrong while executing the transaction`);
   }
}).catch((reason) => {
    console.log(error);
});

Token transfer [Reference]

Signature
signer.executeTokenTransfer(tokenTransferRequestDto, options?): Promise<SignerResult>

Returns Promise<SignerResult>

Table 23. Parameters

Parameter

Required

Description

tokenTransferRequestDto

true

The transfer request you want to execute. For more info on how this request should look like, see reference.

options

false

The options you want to pass.

Full example
const signer = arkaneConnect.createSigner();

signer.executeTokenTransfer({
    walletId: '71dec640-4eb8-4321-adb8-b79461573fc4',
    to: '0xf147cA0b981C0CD0955D1323DB9980F4B43e9FED',
    value: 1010,
    tokenAddress: '0x02f96ef85cad6639500ca1cc8356f0b5ca5bf1d2'
    secretType: 'ETHEREUM',
}).then((signerResult) => {
    if (signerResult.success) {
        console.log(`Transaction ${signerResult.result.transactionHash} has been successfully executed!`);
    } else {
        console.warn(`Something went wrong while executing the transaction`);
    }
}).catch((reason) => {
    console.log(error);
});

NFT transfer [Reference]

Signature
signer.executeNftTransfer(nftTransferRequestDto, options?): Promise<SignerResult>

Returns Promise<SignerResult>

Table 24. Parameters

Parameter

Required

Description

nftTransferRequestDto

true

The transfer request you want to execute. For more info on how this request should look like, see reference.

options

false

The options you want to pass.

Full example
const signer = arkaneConnect.createSigner();

signer.executeNftTransfer({
    walletId: '71dec640-4eb8-4321-adb8-b79461573fc4',
    to: '0xf147cA0b981C0CD0955D1323DB9980F4B43e9FED',
    tokenAddress: '0x158b6a3540eeced8ecb40f9389e88f0902a3da9f'
    tokenId: '65'
    secretType: 'ETHEREUM',
}).then((signerResult) => {
    if (signerResult.success) {
        console.log(`Transaction ${signerResult.result.transactionHash} has been successfully executed!`);
    } else {
        console.warn(`Something went wrong while executing the transaction`);
    }
}).catch((reason) => {
    console.log(error);
});

Gas transfer [Reference]

Signature
signer.executeGasTransfer(gasTransferRequestDto, options?): Promise<SignerResult>

Returns Promise<SignerResult>

Table 25. Parameters

Parameter

Required

Description

gasTransferRequestDto

true

The transfer request you want to execute. For more info on how this request should look like, see reference.

options

false

The options you want to pass.

Full example
const signer = arkaneConnect.createSigner();

signer.executeGasTransfer({
    walletId: '6683c01d-2e10-4982-9b3a-c6ecd45896bb',
    to: 'AN2VD52SLntUGFwzZyjzsRqBBkUzjKpKpT',
    value: 18,
    secretType: 'NEO',
}).then((signerResult) => {
   if (signerResult.success) {
       console.log(`Transaction ${signerResult.result.transactionHash} has been successfully executed!`);
   } else {
       console.warn(`Something went wrong while executing the transaction`);
   }
}).catch((reason) => {
    console.log(error);
});

Contract execution [Reference]

Signature
signer.executeContract(contractExecutionDto, options?): Promise<SignerResult>

Returns Promise<SignerResult>

Table 26. Parameters

Parameter

Required

Description

contractExecutionDto

true

Details about the smart contract function you want to execute. For more info on how this request should look like, see reference.

options

false

The options you want to pass.

Full example
const signer = arkaneConnect.createSigner();

signer.executeContract({
    secretType: 'ETHEREUM',
    walletId: '71dec640-4eb8-4321-adb8-b79461573fc4',
    to: '0xf147cA0b981C0CD0955D1323DB9980F4B43e9FED',
    value: 0,
    functionName: 'transfer',
    inputs: [
      {type: "address", value: "0x80cbb6c4342948e5be81987dce8251dbedd69138"},
      {type: "uint256", value: "73680000"}
    ]
}).then((signerResult) => {
    if (signerResult.success) {
        console.log(`Transaction ${signerResult.result.transactionHash} has been successfully executed!`);
    } else {
        console.warn(`Something went wrong while executing the transaction`);
    }
}).catch((reason) => {
    console.log(error);
});

Native transactions [Reference]

You can also choose to use a native transaction instead of the generic one. This opens up some chain specific functionalities (e.g. multiple clauses for VeChain). For this you need to submit a native transaction request.

Signature
signer.executeNativeTransaction(transactionRequest, options?): Promise<SignerResult>

Returns Promise<SignerResult>

Table 27. Parameters

Parameter

Required

Description

transactionRequest

true

The transaction request you want to execute. More info on the structure of the native transaction requests can be found in the Reference. Exactly the same request bodies are accepted by this function.

options

false

The options you want to pass.

Example
const signer = arkaneConnect.createSigner();
signer.executeNativeTransaction({...nativeTransactionRequest...})
      .then((signerResult) => {
          if (signerResult.success) {
              console.log(`Transaction ${signerResult.result.transactionHash} has been successfully executed!`);
          } else {
              console.warn(`Something went wrong while executing the transaction`);
          }
      }).catch((reason) => {
          console.log(error);
      });

Signing data / transactions

You can use the signer.sign(…​) function to sign data or a transaction. This function accepts signatureRequests of which you can find an overview below and will return a Promise containing a result which on its turn contains the signed transaction.

Signature
signer.sign(signatureRequest, redirectOptions?): Promise<SignerResult>

Returns Promise<SignerResult>

Table 28. Parameters

Parameter

Required

Description

signatureRequest

true

The transaction request you want to execute. More info on the structure of the native transaction requests can be found in the Reference. Exactly the same request bodies are accepted by this function.

redirectOptions

false

The RedirectOptions you want to pass.

Example
const signer = arkaneConnect.createSigner();
signer.sign({...signatureRequest...})
      .then((signerResult) => {
          if (signerResult.success) {
              console.log(`The request has been successfuly signed: ${signerResult.result.signedTransaction}`);
          } else {
              console.warn(`Something went wrong while signing the request`);
          }
      }).catch((reason) => {
          console.log(error);
      });

Data types

Options

Options are only applicable to the redirect-signer
RedirectOptions
{
  redirectUri?: string,
  correlationID?: string
}

Parameter

Required

Description

redirectUri

false (default = the current URI/referer)

The URI you want users to be redirected to after the transaction.

correlationID

false

A unique correlationID allowing you to identify this specific transaction. It will be appended as a request parameter to the redirectUri upon return.

SignerResult

The result after the user enters his PIN differs on the Signer type.

  • popup-signer: You will receive a Promise<SignerResult>

  • redirect-signer: The user will be redirected back and the SignerResult will be added as a request parameter to the URL

SignerResult
{
    status: 'SUCCESS' | 'ABORTED' | 'FAILED',
    result?: any,
    errors?: []
}

Parameter

Required

Description

Example

status

true

The status of the transaction:
SUCCESS means that the request is successfully executed.
ABORTED means that the user has closed the popup or clicked the back to <app> link.
FAILED means that something went wrong while trying to process the request.

'SUCCESS'

result

false, only when status 'SUCCESS'

An object containing the result of the sign action, this is different for different actions:
execute(Native)Transaction: The transactionHash of the transaction
sign: The signature of the requested data
confirm - Create Application Wallet: the wallet ID of the newly created wallet

'0x4b4c1e2d83
6dc31ad27fc5
4fed4d7dbabd
41aa1b070fb8
c437f5beffb1
d5d7b7'

errors

false, only when status 'ABORTED' or 'ERROR'

An array containing the errors of the transaction that you tried to execute.

^