Skip to main content
SDK V2 changes how you create vaults, contacts, and transfers. Each create or update call opens a change request. Your API user must approve the change request before the change takes effect. This page lists the changes and shows the new call sequence.

Install V2

The latest npm tag points to a 1.x release. A plain npm install @primevault/js-api-sdk installs V1. Pin the major version.
V2 requires Node.js 20 or later. Client setup does not change. See Authentication.

What changed

How approval works

Each approval call gets the approval message for the entity. The SDK signs the message with the key in your APIClient. The SDK then submits the signed approval. See Approvals for the REST flow. Use two separate calls: create, then approve. Store the entity id after the create call. If the approval call fails, retry the approval only. Do not repeat the create call, or you create a duplicate.

Vaults

1

Create the vault

Pass vaultName, chains, and vaultGroupIds. Do not pass templateId.
Copy the vault group IDs from the PrimeVault web app. The SDK has no method to list vault groups.
2

Approve the vault

createVaultApproval approves the change request and returns the vault.
3

Wait for wallet addresses

Wallet generation is asynchronous. Retrieve the vault until walletsGenerated is true. Then read the addresses from wallets.
The attempt count and delay are example values. Tune them for your workload.

Contacts

Create a contact

A new contact has status set to PENDING. Use the contact in a transfer only after status is APPROVED.

Update contact groups

updateContact changes assetList and contactGroupIds only. It cannot change name or address.
updateContact sends assetList: [] when you omit assetList. Always pass the current assetList of the contact to keep it.
Pass the full list of group IDs that the contact must belong to.

Transfers

1

Create the transfer

source and destination are party objects with a type and an id. amount is a decimal string.
2

Approve the transfer

Your policy can approve a transfer on create. In that case the status is not PENDING. Skip the approval call.
3

Track the transfer

approveChangeRequest returns the approval result, not the transaction. Call getTransactionById(txn.id) or listen for webhooks. Stop when status is COMPLETED, FAILED, or DECLINED.

One-call helpers

V2 also has helpers that create and approve in one call. Use them in scripts and tests. In production, prefer two calls so a retry does not create a duplicate.

Other V1 methods that changed

Next steps

Approvals

Approval messages, signing, and the REST approval flow.

Create a Transfer

Transfer fields, fee payer, and lifecycle.