Customers can be created with or without a wallet address. When no wallet is provided, the system generates a referenceKey that you can use to link a wallet later.
// With walletconst customer = await trusset.customers.manage.create({ walletAddress: '0x1234...abcd', name: 'Acme Capital GmbH', country: 'DE', investorType: 'PROFESSIONAL', externalId: 'your-crm-id-4821', metadata: { department: 'treasury' },})// Without wallet - gets a referenceKeyconst pending = await trusset.customers.manage.create({ name: 'Pending Investor AG', country: 'AT', externalId: 'crm-9920',})// pending.referenceKey -> "ref_a1b2c3d4..."// Company customer with linked individualsconst company = await trusset.customers.manage.create({ name: 'Acme Capital GmbH', customerType: 'COMPANY', companyUrl: 'acme.example.com', // normalized to https://})await trusset.customers.manage.create({ name: 'Jane Doe', companyId: company.id, // link individual to the company})
If the wallet address is already registered on-chain in the IdentityRegistry, the customer status is automatically set to verified.
The SDK provides typed search methods that map to different lookup strategies. Each returns a single Customer object or throws a TrussetError with code NOT_FOUND.
// By wallet addressconst c1 = await trusset.customers.manage.searchByWallet('0x1234...abcd')// By your internal ID (resolves reliably regardless of ID format or length)const c2 = await trusset.customers.manage.searchByExternalId('crm-4821')// By reference key (for pre-wallet customers)const c3 = await trusset.customers.manage.searchByReference('ref_a1b2c3d4...')// By name (substring match, returns paginated list)const results = await trusset.customers.manage.searchByName('Acme', { limit: 20, offset: 0,})// results.customers, results.total
The wallet address must not already be assigned to another customer in the same instance. If the address is already verified on-chain, the customer status updates to verified automatically.
A customer has one primary wallet and any number of linked wallets. Linked wallets resolve to the same customer in lookups and country checks. A wallet can only belong to one customer per instance.
// List all wallets (primary + linked)const wallets = await trusset.customers.manage.listWallets('customer-id')// wallets.primary, wallets.total, wallets.wallets: [{ address, label, isPrimary, addedAt }]// Link an additional walletawait trusset.customers.manage.addWallet('customer-id', '0x9999...aaaa', 'Trading desk')// Make a linked wallet the primary. The previous primary stays linked,// labeled "Previously primary".await trusset.customers.manage.promoteWallet('customer-id', '0x9999...aaaa')// Remove a linked (non-primary) walletawait trusset.customers.manage.removeWallet('customer-id', '0x9999...aaaa')
Conflicts return 409 with a specific code: ALREADY_PRIMARY, WALLET_ALREADY_LINKED (same customer), or WALLET_IN_USE (another customer).