Home

JavaScript Client Library

@openfort/openfort-node

This reference documents every object and method available in Openfort's isomorphic JavaScript library, openfort-node. You can use openfort-node to interact with your smart accounts, manage policies, import new contracts and much more.

Authentication

The Openfort API uses API keys to authenticate requests. You can view and manage your API keys in the Openfort Dashboard.

Test mode secret keys have the prefix sk_test_ and live mode secret keys have the prefix sk_live_.

Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Use your API key by setting it in the initial configuration of Openfort. The Node.js library will then automatically send this key in each request.

All API requests must be made over HTTPS and must be authenticated. Calls made over plain HTTP will fail. Below, you can see how to send a GET request to the players endpoint to get a list of all your players.

All API requests must be authenticated and made over HTTPS.

Authenticated

_10
const Openfort = require('@openfort/openfort-node').default;
_10
const openfort = new Openfort(YOUR_SECRET_KEY);

Expanding Responses

Many objects allow you to request additional information as an expanded response by using the expand request parameter. This parameter is available on multiple API requests, and applies to the response of that request only.

In many cases, an object contains the ID of a related object in its response properties. For example, a Player can have multiple accounts. Those objects can be expanded inline with the expand request parameter. ID fields that can be expanded into objects are noted in this documentation with the expandable label.

You can use the expand param on any endpoint which returns expandable fields, including list, create, and update endpoints.

You can expand several objects at once by identifying multiple items in the expand array.

Authenticated

_10
const players = await openfort.players.get({
_10
id: 'pla_e0b84653-1741-4a3d-9e91-2b0fd2942f60',
_10
expand: ['accounts'],
_10
});

Response

_35
{
_35
"id": "pla_...",
_35
"object": "player",
_35
"createdAt": 1689869074,
_35
"name": "Frank McCallister",
_35
"email": "Frank@dMcCallister.com",
_35
"description": "Tutorial",
_35
"livemode": false,
_35
"metadata": null,
_35
"accounts": [
_35
{
_35
"id": "acc_...",
_35
"object": "account",
_35
"createdAt": 1689869074,
_35
"address": "0x0B49...cc73",
_35
"chainId": 80001,
_35
"custodial": true,
_35
"deployed": false
_35
},
_35
{
_35
"id": "acc_7ccae011-4f30-41c0-876f-27679d3e81ef",
_35
"object": "account",
_35
"createdAt": 1689869074,
_35
"address": "0x0B49...cc73",
_35
"chainId": 5,
_35
"custodial": true,
_35
"deployed": false
_35
}
_35
],
_35
"transactionIntents": [
_35
{
_35
"id":"tin_..."
_35
}
_35
]
_35
}

Errors

In this guide, we will talk about what happens when something goes wrong while you work with the API. Let's look at some status codes and error types you might encounter.

You can tell if your request was successful by checking the status code when receiving an API response. If a response comes back unsuccessful, you can use the error type and error message to figure out what has gone wrong and do some rudimentary debugging.

List O Auth Config

The endpoint retrieves the list of oauth configurations for the current project environment. List of oauth configurations.

Parameters
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const oauth = await openfort.oAuth.listConfig(...)

    Create O Auth Config

    The endpoint creates oauth configuration for the current project environment. Create oauth configuration.

    Parameters
    • body
      REQUIRED
      OAuthConfig

      Specifies the oauth provider specific configuration.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const oauth = await openfort.oAuth.createConfig(...)

    Get O Auth Config

    The endpoint retrieves oauth configuration for specified provider for the current project environment. Get oauth configuration.

    Parameters
    • provider
      REQUIRED
      OAuthProvider

      Specifies the oauth provider type.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const oauth = await openfort.oAuth.getConfig(...)

    Delete O Auth Config

    The endpoint deletes oauth configuration for specified provider for the current project environment. Delete oauth configuration.

    Parameters
    • provider
      REQUIRED
      OAuthProvider

      Specifies the oauth provider type.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const oauth = await openfort.oAuth.deleteConfig(...)

    Authorize With O Auth Token

    The endpoint verifies the token generated by OAuth provider, creates or retrieves a player based on his email, and returns the jwt token for the player together with the player id. Authorize player with token.

    Parameters
    • provider
      REQUIRED
      OAuthProvider

      OAuth provider

    • oAuthRequest
      REQUIRED
      OAuthRequest

      Request body

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const oauth = await openfort.oAuth.authorizeWithToken(...)

    Verify O Auth Token

    The endpoint verifies the token generated by OAuth provider and retrieves a corresponding player. Retrieve player by token.

    Parameters
    • provider
      REQUIRED
      OAuthProvider

      OAuth provider

    • oAuthRequest
      REQUIRED
      OAuthRequest

      Request body

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const oauth = await openfort.oAuth.verifyToken(...)

    Get Player By External Id

    Retrieves the player based on his id in the external provider system. Retrieve player by external id.

    Parameters
    • provider
      REQUIRED
      OAuthProvider

      OAuth provider

    • externalUserId
      REQUIRED
      string

      External user id

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const oauth = await openfort.oAuth.getPlayerByExternalId(...)

    Get Accounts

    Returns a list of accounts for the given player. The accounts are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of ten accounts are shown per page. List accounts of a player.

    Parameters
    • player
      REQUIRED
      string

      Specifies the unique player ID (starts with pla_)

    • limitnumber

      Specifies the maximum number of records to return.

    • skipnumber

      Specifies the offset for the first records to return.

    • orderSortOrder

      Specifies the order in which to sort the results.

    • expandobject[]

      Specifies the fields to expand in the response.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const accounts = await openfort.accounts.list(...)

    Create Account

    Creates an account object for an existing player.

    Parameters
    • req
      REQUIRED
      CreateAccountRequest

      Parameters to create a player account.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.createAccount(...)

    Get Account

    Retrieves the details of an existing account. Supply the unique account ID from either a account creation request or the account list, and Openfort will return the corresponding account information. Get existing account.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique account ID.

    • expandobject[]
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const accounts = await openfort.accounts.get(...)

    Request Transfer Ownership

    This endpoint allows you to perform a request to change the owner of an account. To perform an update on the owner of an account, first you must provide a new owner address. Once requested, the owner must accept to take ownership by calling acceptOwnership() in the smart contract account. Request transfer ownership of account.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique account ID.

    • transferOwnershipRequest
      REQUIRED
      TransferOwnershipRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const accounts = await openfort.accounts.requestTransferOwnership(...)

    Cancel Transfer Ownership

    This endpoint allows you to cancel a pending transfer of ownership. Cancel request to transfer ownership of an account.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique account ID.

    • cancelTransferOwnershipRequest
      REQUIRED
      CancelTransferOwnershipRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const accounts = await openfort.accounts.cancelTransferOwnership(...)

    Sign Payload

    Signs the typed data value with types data structure for domain using the EIP-712 (https://eips.ethereum.org/EIPS/eip-712) specification. Sign a given payload

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique account ID.

    • signPayloadRequest
      REQUIRED
      SignPayloadRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const accounts = await openfort.accounts.signPayload(...)

    Sync Account

    This endpoint updates the account state with the blockchain. Specifically, it updates the account owner and whether its deployed or not. Sync account state with the blockchain

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique account ID.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const accounts = await openfort.accounts.sync(...)

    Deploy Account

    This endpoint can be used to deploy an account that was counterfactually generated. Deploy an account.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique account ID.

    • deployRequest
      REQUIRED
      DeployRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const accounts = await openfort.accounts.deploy(...)

    Start Recovery

    Start a recovery process of a recoverable account.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique account ID.

    • startRecoveryRequest
      REQUIRED
      StartRecoveryRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const accounts = await openfort.accounts.startRecovery(...)

    Complete Recovery

    Complete a recovery process of a recoverable account.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique account ID.

    • completeRecoveryRequest
      REQUIRED
      CompleteRecoveryRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const accounts = await openfort.accounts.completeRecovery(...)

    Get Contracts

    List of all contracts per project. By default, a maximum of ten contracts are shown. List contracts.

    Parameters
    • limitnumber

      Specifies the maximum number of records to return.

    • skipnumber

      Specifies the offset for the first records to return.

    • orderSortOrder

      Specifies the order in which to sort the results.

    • namestring

      Specifies the name of the contract.

    • deletedboolean

      Specifies whether to include deleted contracts.

    • chainIdnumber

      The chain ID of the contract.

    • addressstring

      Specifies the address of the contract.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const contracts = await openfort.contracts.list(...)

    Create Contract

    Add a new contract to your project in Openfort Create contract object.

    Parameters
    • createContractRequest
      REQUIRED
      CreateContractRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const contracts = await openfort.contracts.create(...)

    Get Contract

    Retrieve a contract by providing their contract id. Get a contract.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique contract ID (starts with con_).

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const contracts = await openfort.contracts.get(...)

    Update Contract

    Updates a contract object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique contract ID (starts with con_).

    • updateContractRequest
      REQUIRED
      UpdateContractRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const contracts = await openfort.contracts.update(...)

    Delete Contract

    Delete a contract from the project by providing its contract id. Deletes a contract object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique contract ID (starts with con_).

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const contracts = await openfort.contracts.delete(...)

    Read Contract

    Using this endpoint, you can get the data returned by any readable function listed in a contracts ABI. This could be things like querying the totalSupply of a currency contract, the number of owners of an items contract, and more. Read on chain contract data.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique contract ID (starts with con_).

    • functionName
      REQUIRED
      string

      The function name of the contract.

    • functionArgsany[]

      The function arguments of the contract.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const contracts = await openfort.contracts.read(...)

    Get Player Inventory

    Get inventory of player.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique player ID (starts with pla_).

    • chainId
      REQUIRED
      number

      Filter by chain id.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const inventories = await openfort.inventories.getPlayer(...)

    Get Player Nft Inventory

    Retrieves the native assets list of an existing player. Supply the unique player ID from either a player creation request or the player list, and Openfort will return the corresponding player information.

    Parameters
    • req
      REQUIRED
      PlayerInventoryListQueries
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const inventories = await openfort.inventories.getPlayerNftInventory(...)

    Get Player Crypto Currency Inventory

    Retrieves the native assets list of an existing player. Supply the unique player ID from either a player creation request or the player list, and Openfort will return the corresponding player information.

    Parameters
    • req
      REQUIRED
      PlayerInventoryListQueries
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const inventories = await openfort.inventories.getPlayerCryptoCurrencyInventory(...)

    Get Player Native Inventory

    Retrieves the native assets list of an existing player. Supply the unique player ID from either a player creation request or the player list, and Openfort will return the corresponding player information.

    Parameters
    • req
      REQUIRED
      GetPlayerInventoryRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const inventories = await openfort.inventories.getPlayerNativeInventory(...)

    Get Account Inventory

    Get inventory of account.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique account ID.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const inventories = await openfort.inventories.getAccount(...)

    Get Account Nft Inventory

    Retrieves the native assets list of an existing player. Supply the unique player ID from either a player creation request or the player list, and Openfort will return the corresponding player information.

    Parameters
    • req
      REQUIRED
      AccountInventoryListQueries
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const inventories = await openfort.inventories.getAccountNftInventory(...)

    Get Account Crypto Currency Inventory

    Retrieves the native assets list of an existing player. Supply the unique player ID from either a player creation request or the player list, and Openfort will return the corresponding player information.

    Parameters
    • req
      REQUIRED
      AccountInventoryListQueries
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const inventories = await openfort.inventories.getAccountCryptoCurrencyInventory(...)

    Get Account Native Inventory

    Retrieves the native assets list of an existing player. Supply the unique player ID from either a player creation request or the player list, and Openfort will return the corresponding player information.

    Parameters
    • req
      REQUIRED
      GetAccountInventoryRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const inventories = await openfort.inventories.getAccountNativeInventory(...)

    Get Players

    By default, a maximum of ten players are shown. List players.

    Parameters
    • limitnumber

      Specifies the maximum number of records to return.

    • skipnumber

      Specifies the offset for the first records to return.

    • orderSortOrder

      Specifies the order in which to sort the results.

    • expandobject[]

      Specifies the fields to expand in the response.

    • namestring

      Filter by player name.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.list(...)

    Create Player

    Add a new player to your player list in Openfort. Create a player object.

    Parameters
    • playerCreateRequest
      REQUIRED
      PlayerCreateRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.create(...)

    Get Player

    Retrieves the details of an existing player.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique player ID (starts with pla_).

    • expandobject[]

      Specifies the expandable fields.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.get(...)

    Update Player

    Updates a player object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique player ID (starts with pla_).

    • playerUpdateRequest
      REQUIRED
      PlayerUpdateRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.update(...)

    Delete Player

    Deletes a player object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique player ID (starts with pla_).

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.delete(...)

    Request Transfer Account Ownership

    Transfer ownership of an account to an address.

    Parameters
    • req
      REQUIRED
      PlayerTransferOwnershipRequest

      Parameters to transfer account ownership.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.requestTransferAccountOwnership(...)

    Cancel Transfer Account Ownership

    Transfer ownership of an account to an address.

    Parameters
    • req
      REQUIRED
      PlayerCancelTransferOwnershipRequest

      Parameters to transfer account ownership.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.cancelTransferAccountOwnership(...)

    Create Player Session

    Create session object for a player.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique player ID (starts with pla_).

    • createPlayerSessionRequest
      REQUIRED
      CreatePlayerSessionRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.createSession(...)

    Revoke Player Session

    Revoke session object for a player.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique player ID (starts with pla_).

    • revokeSessionPlayerRequest
      REQUIRED
      RevokeSessionPlayerRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.revokeSession(...)

    Get Player Accounts

    List of accounts of a player.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique player ID (starts with pla_).

    • expandobject[]

      Specifies the expandable fields.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.getAccounts(...)

    Create Player Account

    Create account object for a player.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique player ID (starts with pla_).

    • createPlayerAccountRequest
      REQUIRED
      CreatePlayerAccountRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.createAccount(...)

    Get Policies

    List policies.

    Parameters
    • limitnumber

      Specifies the maximum number of records to return.

    • skipnumber

      Specifies the offset for the first records to return.

    • orderSortOrder

      Specifies the order in which to sort the results.

    • expandobject[]

      Specifies the fields to expand in the response.

    • namestring

      Specifies the name of the policy.

    • deletedboolean

      Specifies whether to include deleted contracts.

    • chainIdnumber

      The chain ID of the policy.

    • enabledboolean

      Specifies whether to include enabled contracts.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.list(...)

    Create Policy

    Create a policy object.

    Parameters
    • createPolicyRequest
      REQUIRED
      CreatePolicyRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.create(...)

    Get Policy

    Get a policy object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique policy ID (starts with pol_).

    • expandobject[]

      Specifies the fields to expand.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.get(...)

    Update Policy

    Update a policy object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique policy ID (starts with pol_).

    • updatePolicyRequest
      REQUIRED
      UpdatePolicyRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.update(...)

    Delete Policy

    Delete a policy object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique policy ID (starts with pol_).

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.delete(...)

    Disable Policy

    Disable a policy object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique policy ID (starts with pol_).

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.disable(...)

    Enable Policy

    Enable a policy object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique policy ID (starts with pol_).

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.enable(...)

    Get Policy Allow Functions

    List policy rules of a policy.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique policy ID (starts with pol_).

    • expandobject[]

      Specifies the fields to expand.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.getAllowFunctions(...)

    Create Policy Allow Function

    Create a policy rule object for a policy.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique policy ID (starts with pol_).

    • createPolicyAllowFunctionRequest
      REQUIRED
      CreatePolicyAllowFunctionRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.createAllowFunction(...)

    Update Policy Allow Function

    Update a policy rule object of a policy.

    Parameters
    • policy
      REQUIRED
      string

      Specifies the unique policy ID (starts with pol_).

    • policyRule
      REQUIRED
      string

      Specifies the unique policy rule ID (starts with afu_).

    • updatePolicyRuleRequest
      REQUIRED
      UpdatePolicyRuleRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.updateAllowFunction(...)

    Get Policy Total Gas Usage

    Get policy total gas usage

    Parameters
    • req
      REQUIRED
      GetPolicyTotalGasUsageRequest

      Criteria to get usage

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policies = await openfort.policies.getPolicyTotalGasUsage(...)

    Get Policy Rules

    List policy rules of a policy.

    Parameters
    • policy
      REQUIRED
      string

      Specifies the unique policy ID (starts with pol_).

    • limitnumber

      Specifies the maximum number of records to return.

    • skipnumber

      Specifies the offset for the first records to return.

    • orderSortOrder

      Specifies the order in which to sort the results.

    • expandobject[]

      Specifies the fields to expand in the response.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policyrules = await openfort.policyRules.list(...)

    Create Policy Rules

    Create a policy rule object.

    Parameters
    • createPolicyRuleRequest
      REQUIRED
      CreatePolicyRuleRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policyrules = await openfort.policyRules.create(...)

    Update Policy Rules

    Update a policy rule object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique policy rule ID (starts with afu_).

    • updatePolicyRuleRequest
      REQUIRED
      UpdatePolicyRuleRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policyrules = await openfort.policyRules.update(...)

    Delete Policy Rules

    Deletes a policy rule object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique policy rule ID (starts with afu_).

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const policyrules = await openfort.policyRules.delete(...)

    Create Session

    Creates a session object for the given player.

    Parameters
    • req
      REQUIRED
      CreatePlayerSessionRequest

      Parameters to create a player session.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.createSession(...)

    Get Player Sessions

    List session keys of a player.

    Parameters
    • player
      REQUIRED
      string

      The player ID (starts with pla_)

    • limitnumber

      Specifies the maximum number of records to return.

    • skipnumber

      Specifies the offset for the first records to return.

    • orderSortOrder

      Specifies the order in which to sort the results.

    • expandobject[]

      Specifies the fields to expand in the response.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const sessions = await openfort.sessions.getPlayer(...)

    Revoke Session

    Creates a session object for the given player.

    Parameters
    • req
      REQUIRED
      RevokePlayerSessionRequest

      Parameters to revoce the player session.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const players = await openfort.players.revokeSession(...)

    Signature Session

    Send signed userOpHash to create session.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique session ID (starts with ses_).

    • signatureRequest
      REQUIRED
      SignatureRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const sessions = await openfort.sessions.signature(...)

    Get Session

    Returns a player session by session id

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique session ID (starts with ses_).

    • expandobject[]

      Specifies the fields to expand.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const sessions = await openfort.sessions.get(...)

    Add Depositor Address

    Adds a depositor address to a project environment.

    Parameters
    • req
      REQUIRED
      PaymasterDepositorCreateRequest

      Parameters to add a depositor address to s project environment

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const settings = await openfort.settings.addDepositorAddress(...)

    Get Depositor Addresses

    Lists the depositor addresses of a project.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const settings = await openfort.settings.getDepositorAddresses(...)

    Remove Depositor Address

    Removes a depositor address from a project.

    Parameters
    • id
      REQUIRED
      string

      Id of the depositor address to remove

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const settings = await openfort.settings.removeDepositorAddress(...)

    Get Message For Signing Depositor Address

    Generate message, which should be signed for verification of the address ownership.

    Parameters
    • address
      REQUIRED
      string

      Specifies the paymaster depositor address

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const settings = await openfort.settings.getMessageForSigningDepositorAddress(...)

    Update Webhook

    Creates or updates webhook address in a project environment configuration.

    Parameters
    • url
      REQUIRED
      string

      Url of the webhook

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const settings = await openfort.settings.updateWebhook(...)

    Remove Webhook

    Removes the webhook configuration from the project environment.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const settings = await openfort.settings.removeWebhook(...)

    Get Transaction Intents

    List transaction intents.

    Parameters
    • limitnumber

      Specifies the maximum number of records to return.

    • skipnumber

      Specifies the offset for the first records to return.

    • orderSortOrder

      Specifies the order in which to sort the results.

    • expandobject[]

      Specifies the fields to expand in the response.

    • chainIdnumber

      The chain ID.

    • accountIdstring[]

      Filter by account ID.

    • playerIdstring[]

      Filter by player ID (starts with pla_).

    • policyIdstring[]

      Filter by policy ID (starts with pol_).

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const transactionintents = await openfort.transactionIntents.list(...)

    Create Transaction Intent

    Retrieve a transaction intent by providing their id on Openfort. Transaction intents that have not been processed yet, have the response attribute as undefined. Create a transaction intent object.

    Parameters
    • createTransactionIntentRequest
      REQUIRED
      CreateTransactionIntentRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const transactionintents = await openfort.transactionIntents.create(...)

    Get Transaction Intent

    Get a transaction intent object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique transaction intent ID (starts with tin_).

    • expandobject[]

      Specifies the expandable fields.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const transactionintents = await openfort.transactionIntents.get(...)

    Estimate Transaction Intent Cost

    Estimate the gas cost of creating a transaction intent and putting it on chain. If a policy that includes payment of gas in ERC-20 tokens is provided, an extra field estimatedTXGasFeeToken is returned with the estimated amount of tokens. Estimate gas cost of creating a transaction

    Parameters
    • createTransactionIntentRequest
      REQUIRED
      CreateTransactionIntentRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const transactionintents = await openfort.transactionIntents.estimateCost(...)

    Signature

    Confirms the creation of a session with an external owner.

    Parameters
    • req
      REQUIRED
      SignatureSessionRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const sessions = await openfort.sessions.signature(...)

    Get Web Connections

    Returns a list of web3 connections for the given player. The connections are returned sorted by creation date, with the most recently created connections appearing first. By default, a maximum of ten connections are shown per page. List Web3 connections.

    Parameters
    • limitnumber

      Specifies the maximum number of records to return.

    • skipnumber

      Specifies the offset for the first records to return.

    • orderSortOrder

      Specifies the order in which to sort the results.

    • playerstring

      Specifies the unique player ID (starts with pla_)

    • disconnectedboolean

      Specifies connection status

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const web3connections = await openfort.web3Connections.list(...)

    Create Web Connection

    This endpoint allows you to create a new web3 connection to your Openfort player. Together with the player ID (pla_), you need to provide a chain ID. The chain to use is required because Openfort needs to make sure the account is deployed, as counterfactual addresses cannot use web3 connections. The uri body parameter must contain a WalletConnect pairing URI (see: https://specs.walletconnect.com/2.0/specs/clients/core/pairing/pairing-uri) Create a Web3 Connection object.

    Parameters
    • createWeb3ConnectionRequest
      REQUIRED
      CreateWeb3ConnectionRequest
    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const web3connections = await openfort.web3Connections.create(...)

    Get Web Connection

    Retrieves the details of an existing web3 connection. Supply the unique web3 connection ID from either a web3 connection creation request or the web3 connection list. Openfort will return the corresponding web3 connection information. Get a web3Connection object.

    Parameters
    • id
      REQUIRED
      string

      Specifies the unique web3Connection ID (starts with web3_).

    • expandobject[]

      Specifies the fields to expand.

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const web3connections = await openfort.web3Connections.get(...)

    Get Web Actions

    Returns a list of web3 actions for the given web3 connection. The actions are returned sorted by creation date, with the most recently received action appearing first. By default, a maximum of ten actions are shown per page.

    Parameters
    • req
      REQUIRED
      GetWeb3ActionsList

      Parameters to get list of web3 actions

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const web3connections = await openfort.web3Connections.getWeb3Actions(...)

    Submit Web Action

    Approve or Reject a web3 action for the given web3 connection.

    Parameters
    • req
      REQUIRED
      CreateSubmitWeb3ActionRequest

      Parameters to approve or reject a web3 action

    
    import Openfort from '@openfort/openfort-node'
    const openfort = new Openfort(sk_test_...)
    // Check on parameters for the accepted values
    const web3connections = await openfort.web3Connections.submitWeb3Action(...)