Use this file to discover all available pages before exploring further.
The sync sub-module handles bulk migration of customer data between your existing systems and Trusset. It is designed for institutions with established customer databases that need to onboard thousands of records without manual entry.Records are mapped by externalId - your system’s unique customer identifier. This key is used for deduplication and conflict resolution across syncs.
import { SyncRecord } from '@trusset/sdk'const records: SyncRecord[] = existingCustomers.map(row => ({ externalId: row.customerId, // required - your unique ID name: row.fullName, walletAddress: row.ethAddress, // optional country: row.countryCode, investorType: 'RETAIL', metadata: { source: 'core-banking', migrationBatch: '2025-Q1' },}))const result = await trusset.customers.sync.importRecords(records, { batchSize: 50, onConflict: 'update', onProgress: (done, total) => { console.log(`${done}/${total} processed`) },})result.total // total records submittedresult.created // new customers createdresult.updated // existing customers updatedresult.skipped // skipped due to onConflict: 'skip'result.errors // array of { externalId, code, message }
The SDK processes records in configurable batches to avoid overloading the API. Each record is matched against existing customers by externalId. If a match is found, the onConflict strategy determines the outcome.
Set verifyOnChain: true to automatically batch-verify imported records that have both a walletAddress and a country. This runs after the database import completes and requires a configured relayer.
Pull all customer data back out as flat SyncRecord objects. Useful for syncing Trusset state back into your core systems or for audit purposes.
const records = await trusset.customers.sync.exportRecords({ includeArchived: false,})// records: SyncRecord[]// Each record: { externalId, walletAddress?, name?, country?, investorType?, metadata? }
The method paginates internally - it fetches all records regardless of total count. For very large datasets (50k+ customers), consider using the list endpoint directly with pagination for more control.