Business Accounts are in early access. See the overview for the model.
- Environment-Layer: rules set by the developer for the whole environment. For how to set environment-wide rules, see Creating & Managing Rules in the general Policies & Rules guide.
- Account-Layer: one policy that applies to every wallet in the business account. Only a business-account owner or admin can edit it.
- Wallet-Layer: rules for a specific wallet. On a business-account wallet, only a business-account owner or admin can edit it.
- Signer-Layer: rules for an individual signer. A signer can edit their own layer; a business-account owner or admin can edit any signer’s layer.
Before you start
Before this: create and initialize a Dynamic client (see Creating a Dynamic Client, Initializing the Dynamic Client). The policy helpers are exported from@dynamic-labs-sdk/client/waas and the matching React hooks are exported from @dynamic-labs-sdk/react-hooks.
PolicyRules keys
createPolicy and removePolicyRules work with a PolicyRules map. Each key maps to at most one underlying WaasPolicyRule, so calling createPolicy again with the same key updates that rule in place instead of duplicating it.
For the raw fields these keys produce, see Rule fields.
Create or update rules
createPolicy writes a PolicyRules map to a layer in one batch. The scope object decides which layer is updated.
- JavaScript
- React
PolicyScope
required
The policy layer to update. Use
{ businessAccountId } for the account layer, { walletId } for a wallet layer, { walletId, shareSetId } for a specific signer, or { shareSetId } for the caller’s own signer.string
required
The chain the rules apply to, for example
EVM, SVM, or SUI.number[]
The chain IDs the rules apply to. Omit this to target the wildcard rule that matches every chain ID for
chain.PolicyRules
required
The desired rules as a
PolicyRules map.Account-Layer
Usescope: { businessAccountId } to apply rules to every wallet in the business account.
Wallet-Layer
Usescope: { walletId }, where walletId is the wallet’s verifiedCredentialId.
Signer-Layer
The signer layer applies to one share set. A wallet account has one own share set that signs transactions. It can also have other active share sets, such as delegated access and additional business-account signers.addBusinessAccountSigner returns the shareSetId of the signer it grants access to, so capture it when you add a signer. See Manage signers.
scope: { walletId, shareSetId }. For the caller’s own signer, scope: { shareSetId } also works if the wallet account is in the client’s state.
A
shareSetId is the current identifier for a signer. It rotates when the wallet shares are refreshed or reshared, so do not store it. The policy is bound to a stable signerId that the enclave mints, so a rotated shareSetId still points to the same policy. Re-read shareSetId before each update. A stale shareSetId is rejected with a stale-share-set error.scope with removePolicyRules or getPolicy.
Read rules
getPolicy fetches a layer and converts the underlying rules back into a PolicyRules map. Rules with fields that PolicyRules does not include go into unmapped, so they are never silently dropped.
- JavaScript
- React
PolicyScope
required
The policy layer to read.
Remove rules
removePolicyRules removes the rules for one or more PolicyRules keys in one batch. Pass the keys to remove in the rules array.
- JavaScript
- React
PolicyScope
required
The policy layer to update.
string
required
The chain the rules to remove apply to.
number[]
The chain IDs the rules to remove apply to. Omit to target the wildcard rule for
chain.string[]
required
The
PolicyRules keys to remove, for example ['allowAddresses', 'maxAmountPerTransaction'].Who can update a rule
The enclave knows who makes the request. It uses that identity to decide which layers the caller can change and which rules they can edit or remove.Which layers each caller can change
What you can do to a rule
Every rule stores who created it. The enclave uses this to decide what you can change.- Rules you created: You can fully edit or remove them.
- Rules shared with you: A rule marked
modifiableBySignerlets the signer it applies to edit or remove the rule. The signer can change constraint fields, such as addresses and value limits. The signer cannot change security fields. - Rules created by someone else: Admins can revoke or replace these rules. Wallet owners and signers cannot edit or remove rules created by someone else, unless those rules are shared with them.
Guardrails
- A rule with security fields, such as
disableBlockaidSecurityChecksoroperationRestrictions, cannot also bemodifiableBySigner. modifiableBySigneronly works on wallet and signer layers.- A rule must enforce at least one of: an address list, a per-call value limit, or an operation restriction.
createPolicydoes not lock the layer before it updates. Two calls at the same time can create duplicate rules. Avoid concurrent updates to the same scope.
modifiableBySigner and disableBlockaidSecurityChecks, see upsertWalletPolicyRule and upsertSignerPolicyRule.
Rule fields
AWaasPolicyRule has the following fields:
For allowlist semantics, address evaluation, and value limits, see Policies & Rules.
These helpers do not expose
modifiableBySigner or disableBlockaidSecurityChecks. Use the lower-level upsertWalletPolicyRule or upsertSignerPolicyRule functions from @dynamic-labs-sdk/client/waas when you need those fields.Next steps
Manage signers
Add and remove signers on a business-account wallet.
Sign transactions
Sign with a business-account wallet.