Skip to main content

Web3 Policy Scope

Source: src/sdk/web3-policy.ts

Use sdk.web3Policy to retrieve or replace the current web3 dApp policy configuration in Core.

Methods

getConfig(): Promise<Web3PolicyConfigResponseDto>

Endpoint

GET /api/v1/core/web3-policy/config

How it works

Returns the current web3 policy mode and configured dApps/contracts.

Returns

Promise<Web3PolicyConfigResponseDto>

Request Example

const policy = await sdk.web3Policy.getConfig();

upsertConfig(dto: UpsertWeb3PolicyConfigDto): Promise<Web3PolicyConfigResponseDto>

Endpoint

PUT /api/v1/core/web3-policy/config

How it works

Replaces the current web3 policy configuration with the provided payload.

Arguments

ArgumentTypeRequiredNotes
dto.mode'whitelist' | 'blacklist'YesPolicy strategy to apply.
dto.dappsWeb3DappConfigDto[]YesdApp entries with contract targets by network and address.

Returns

Promise<Web3PolicyConfigResponseDto>

Request Example

import {
Web3PolicyMode,
Web3PolicyTargetNetwork,
} from '@ledgerlink/link-sdk';

const updatedPolicy = await sdk.web3Policy.upsertConfig({
mode: Web3PolicyMode.WHITELIST,
dapps: [
{
name: 'Uniswap',
contracts: [
{
network: Web3PolicyTargetNetwork.ETHEREUM,
address: '0x1111111111111111111111111111111111111111',
},
],
},
],
});