Amulet¶
The amulet namespace is used for Canton coin specific operations.
Availability and extensibility¶
The amulet namespace is an extended namespace that requires configuration. You can initialize it either during SDK creation or later using the extend() method.
Option 1: Initialize during SDK creation
const sdk = await SDK.create({
auth: authConfig,
ledgerClientUrl: 'http://localhost:2975',
amulet: {
validatorUrl: 'http://localhost:2000/api/validator',
scanApiUrl: 'http://localhost:2000/api/scan',
auth: amuletAuthConfig,
registryUrl: 'http://localhost:2000/api/registry'
}
})
// amulet namespace is now available
await sdk.amulet.traffic.status()
Option 2: Add amulet namespace later using extend()
// Create basic SDK first
const basicSDK = await SDK.create({
auth: authConfig,
ledgerClientUrl: 'http://localhost:2975'
})
// Extend with amulet namespace when needed
const extendedSDK = await basicSDK.extend({
amulet: {
validatorUrl: 'http://localhost:2000/api/validator',
scanApiUrl: 'http://localhost:2000/api/scan',
auth: amuletAuthConfig,
registryUrl: 'http://localhost:2000/api/registry'
}
})
// Now amulet namespace is available
await extendedSDK.amulet.traffic.status()
Configuration¶
The AmuletConfig type defines the configuration for the amulet namespace:
type AmuletConfig = {
auth: TokenProviderConfig
validatorUrl: string | URL
scanApiUrl: string | URL
registryUrl: URL
}
auth: Authentication configuration for accessing the validator and scan servicesvalidatorUrl: URL of the validator servicescanApiUrl: URL of the scan APIregistryUrl: URL of the amulet registry
Key changes from v0 to v1¶
v0 used the tokenStandard controller with implicit party context set via sdk.setPartyId() and the instrumentId and instrumentAdmin were passed in explicitly to each function.
v1 uses the amulet namespace where you:
Pass
partyIdexplicitly to each operationInitialize the namespace with configuration, which determines the instrumentAdmin and instrumentId
Access operations through logical groupings (
trafficandpreapproval)
Creating preapprovals
The below example demonstrates the full process of renewing and cancelling preapprovals:
Buy Member Traffic
Check Traffic Status
Refer to the following example for more information:
Tap
The is useful for testing against LocalNet or Devnet.
Migration reference¶
v0 method |
v1 method |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See also¶
Wallet SDK Configuration - SDK configuration
User Management - User management overview