@mantle-rwa/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.js +198 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/constants/index.js +211 -0
- package/dist/cjs/constants/index.js.map +1 -0
- package/dist/cjs/errors/index.js +218 -0
- package/dist/cjs/errors/index.js.map +1 -0
- package/dist/cjs/index.js +51 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/modules/compliance.js +202 -0
- package/dist/cjs/modules/compliance.js.map +1 -0
- package/dist/cjs/modules/index.js +18 -0
- package/dist/cjs/modules/index.js.map +1 -0
- package/dist/cjs/modules/kyc.js +278 -0
- package/dist/cjs/modules/kyc.js.map +1 -0
- package/dist/cjs/modules/token.js +365 -0
- package/dist/cjs/modules/token.js.map +1 -0
- package/dist/cjs/modules/yield.js +406 -0
- package/dist/cjs/modules/yield.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/types/index.js +20 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/utils/index.js +206 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/esm/client.js +194 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/constants/index.js +208 -0
- package/dist/esm/constants/index.js.map +1 -0
- package/dist/esm/errors/index.js +209 -0
- package/dist/esm/errors/index.js.map +1 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/modules/compliance.js +198 -0
- package/dist/esm/modules/compliance.js.map +1 -0
- package/dist/esm/modules/index.js +8 -0
- package/dist/esm/modules/index.js.map +1 -0
- package/dist/esm/modules/kyc.js +273 -0
- package/dist/esm/modules/kyc.js.map +1 -0
- package/dist/esm/modules/token.js +360 -0
- package/dist/esm/modules/token.js.map +1 -0
- package/dist/esm/modules/yield.js +401 -0
- package/dist/esm/modules/yield.js.map +1 -0
- package/dist/esm/types/index.js +17 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/utils/index.js +188 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/types/client.d.ts +93 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/constants/index.d.ts +83 -0
- package/dist/types/constants/index.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +83 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/modules/compliance.d.ts +29 -0
- package/dist/types/modules/compliance.d.ts.map +1 -0
- package/dist/types/modules/index.d.ts +8 -0
- package/dist/types/modules/index.d.ts.map +1 -0
- package/dist/types/modules/kyc.d.ts +131 -0
- package/dist/types/modules/kyc.d.ts.map +1 -0
- package/dist/types/modules/token.d.ts +145 -0
- package/dist/types/modules/token.d.ts.map +1 -0
- package/dist/types/modules/yield.d.ts +143 -0
- package/dist/types/modules/yield.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +254 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +80 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/package.json +52 -0
- package/src/client.ts +258 -0
- package/src/constants/index.ts +226 -0
- package/src/errors/index.ts +291 -0
- package/src/index.ts +42 -0
- package/src/modules/compliance.ts +252 -0
- package/src/modules/index.ts +8 -0
- package/src/modules/kyc.ts +446 -0
- package/src/modules/token.ts +488 -0
- package/src/modules/yield.ts +566 -0
- package/src/types/index.ts +326 -0
- package/src/utils/index.ts +240 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RWAClient - Main entry point for the Mantle RWA SDK
|
|
3
|
+
*/
|
|
4
|
+
import { type Provider, type Signer } from 'ethers';
|
|
5
|
+
import { TokenModule } from './modules/token';
|
|
6
|
+
import { KYCModule } from './modules/kyc';
|
|
7
|
+
import { YieldModule } from './modules/yield';
|
|
8
|
+
import { ComplianceModule } from './modules/compliance';
|
|
9
|
+
import type { NetworkConfig, CustomNetwork, DeploymentConfig, DeployedContracts } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for RWAClient
|
|
12
|
+
*/
|
|
13
|
+
export interface RWAClientConfig {
|
|
14
|
+
/** Network to connect to */
|
|
15
|
+
network: 'mantle' | 'mantle-sepolia' | CustomNetwork;
|
|
16
|
+
/** Private key for signing transactions (optional if signer provided) */
|
|
17
|
+
privateKey?: string;
|
|
18
|
+
/** Ethers signer instance (optional if privateKey provided) */
|
|
19
|
+
signer?: Signer;
|
|
20
|
+
/** Factory contract address (optional, uses default if not provided) */
|
|
21
|
+
factoryAddress?: string;
|
|
22
|
+
/** Number of transaction retries */
|
|
23
|
+
retries?: number;
|
|
24
|
+
/** Retry delay in milliseconds */
|
|
25
|
+
retryDelay?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Main client for interacting with Mantle RWA contracts
|
|
29
|
+
*/
|
|
30
|
+
export declare class RWAClient {
|
|
31
|
+
private readonly _provider;
|
|
32
|
+
private readonly _signer;
|
|
33
|
+
private readonly _networkConfig;
|
|
34
|
+
private readonly _factoryAddress?;
|
|
35
|
+
private readonly _retries;
|
|
36
|
+
private readonly _retryDelay;
|
|
37
|
+
/** Token module for RWA token operations */
|
|
38
|
+
readonly token: TokenModule;
|
|
39
|
+
/** KYC module for investor verification */
|
|
40
|
+
readonly kyc: KYCModule;
|
|
41
|
+
/** Yield module for distribution management */
|
|
42
|
+
readonly yield: YieldModule;
|
|
43
|
+
/** Compliance module for transfer eligibility */
|
|
44
|
+
readonly compliance: ComplianceModule;
|
|
45
|
+
constructor(config: RWAClientConfig);
|
|
46
|
+
/**
|
|
47
|
+
* Get the provider instance
|
|
48
|
+
*/
|
|
49
|
+
get provider(): Provider;
|
|
50
|
+
/**
|
|
51
|
+
* Get the signer instance (throws if not available)
|
|
52
|
+
*/
|
|
53
|
+
get signer(): Signer;
|
|
54
|
+
/**
|
|
55
|
+
* Check if a signer is available
|
|
56
|
+
*/
|
|
57
|
+
get hasSigner(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Get the network configuration
|
|
60
|
+
*/
|
|
61
|
+
get network(): NetworkConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Deploy a complete RWA system using the factory contract
|
|
64
|
+
* @param config Deployment configuration
|
|
65
|
+
* @returns Addresses of all deployed contracts
|
|
66
|
+
*/
|
|
67
|
+
deployRWASystem(config: DeploymentConfig): Promise<DeployedContracts>;
|
|
68
|
+
/**
|
|
69
|
+
* Connect to an existing RWA token
|
|
70
|
+
*/
|
|
71
|
+
connectToken(address: string): import("./modules").TokenInstance;
|
|
72
|
+
/**
|
|
73
|
+
* Connect to an existing KYC registry
|
|
74
|
+
*/
|
|
75
|
+
connectKYCRegistry(address: string): import("./modules").KYCRegistryInstance;
|
|
76
|
+
/**
|
|
77
|
+
* Connect to an existing yield distributor
|
|
78
|
+
*/
|
|
79
|
+
connectYieldDistributor(address: string): import("./modules").YieldDistributorInstance;
|
|
80
|
+
/**
|
|
81
|
+
* Get the current block number
|
|
82
|
+
*/
|
|
83
|
+
getBlockNumber(): Promise<number>;
|
|
84
|
+
/**
|
|
85
|
+
* Get the balance of an address
|
|
86
|
+
*/
|
|
87
|
+
getBalance(address: string): Promise<bigint>;
|
|
88
|
+
/**
|
|
89
|
+
* Validate deployment configuration
|
|
90
|
+
*/
|
|
91
|
+
private _validateDeploymentConfig;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE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AEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,aAAa,CAE3B;IAED;;;;OAIG;IACG,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA2D3E;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM;IAI5B;;OAEG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM;IAIlC;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM;IAIvC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAIvC;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlD;;OAEG;IACH,OAAO,CAAC,yBAAyB;CAyBpC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for the Mantle RWA SDK
|
|
3
|
+
*/
|
|
4
|
+
import type { NetworkConfig } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Mantle Mainnet configuration
|
|
7
|
+
*/
|
|
8
|
+
export declare const MANTLE_MAINNET: NetworkConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Mantle Sepolia Testnet configuration
|
|
11
|
+
*/
|
|
12
|
+
export declare const MANTLE_SEPOLIA: NetworkConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Network configurations by name
|
|
15
|
+
*/
|
|
16
|
+
export declare const NETWORKS: Record<string, NetworkConfig>;
|
|
17
|
+
/**
|
|
18
|
+
* Role identifiers (keccak256 hashes)
|
|
19
|
+
*/
|
|
20
|
+
export declare const ROLES: {
|
|
21
|
+
readonly DEFAULT_ADMIN_ROLE: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
22
|
+
readonly ISSUER_ROLE: "0x114e74f6ea3bd819998f78687bfcb11b140da08e9b7d222fa9c1f1ba1f2aa122";
|
|
23
|
+
readonly COMPLIANCE_OFFICER_ROLE: "0x5c5f5c5f5c5f5c5f5c5f5c5f5c5f5c5f5c5f5c5f5c5f5c5f5c5f5c5f5c5f5c5f";
|
|
24
|
+
readonly KYC_ADMIN_ROLE: "0x6b79635f61646d696e5f726f6c650000000000000000000000000000000000";
|
|
25
|
+
readonly VAULT_SIGNER_ROLE: "0x7661756c745f7369676e65725f726f6c650000000000000000000000000000";
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Common payment token addresses on Mantle
|
|
29
|
+
*/
|
|
30
|
+
export declare const PAYMENT_TOKENS: {
|
|
31
|
+
readonly mantle: {
|
|
32
|
+
readonly USDC: "0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9";
|
|
33
|
+
readonly USDT: "0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE";
|
|
34
|
+
readonly MNT: "0x0000000000000000000000000000000000000000";
|
|
35
|
+
};
|
|
36
|
+
readonly 'mantle-sepolia': {
|
|
37
|
+
readonly USDC: "0x0000000000000000000000000000000000000000";
|
|
38
|
+
readonly USDT: "0x0000000000000000000000000000000000000000";
|
|
39
|
+
readonly MNT: "0x0000000000000000000000000000000000000000";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Default configuration values
|
|
44
|
+
*/
|
|
45
|
+
export declare const DEFAULTS: {
|
|
46
|
+
/** Default number of days for yield claim window */
|
|
47
|
+
readonly YIELD_CLAIM_WINDOW_DAYS: 30;
|
|
48
|
+
/** Default vault withdrawal threshold (in wei) */
|
|
49
|
+
readonly VAULT_WITHDRAWAL_THRESHOLD: "1000000000000000000000";
|
|
50
|
+
/** Default number of transaction retries */
|
|
51
|
+
readonly TRANSACTION_RETRIES: 3;
|
|
52
|
+
/** Default retry delay in milliseconds */
|
|
53
|
+
readonly RETRY_DELAY_MS: 1000;
|
|
54
|
+
/** Gas estimation buffer (20%) */
|
|
55
|
+
readonly GAS_BUFFER_PERCENT: 20;
|
|
56
|
+
/** Default KYC expiry duration in seconds (1 year) */
|
|
57
|
+
readonly KYC_EXPIRY_DURATION: number;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Common ERC20 ABI fragments
|
|
61
|
+
*/
|
|
62
|
+
export declare const ERC20_ABI: readonly ["function name() view returns (string)", "function symbol() view returns (string)", "function decimals() view returns (uint8)", "function totalSupply() view returns (uint256)", "function balanceOf(address account) view returns (uint256)", "function transfer(address to, uint256 amount) returns (bool)", "function allowance(address owner, address spender) view returns (uint256)", "function approve(address spender, uint256 amount) returns (bool)", "function transferFrom(address from, address to, uint256 amount) returns (bool)", "event Transfer(address indexed from, address indexed to, uint256 value)", "event Approval(address indexed owner, address indexed spender, uint256 value)"];
|
|
63
|
+
/**
|
|
64
|
+
* RWAToken ABI fragments
|
|
65
|
+
*/
|
|
66
|
+
export declare const RWA_TOKEN_ABI: readonly ["function name() view returns (string)", "function symbol() view returns (string)", "function decimals() view returns (uint8)", "function totalSupply() view returns (uint256)", "function balanceOf(address account) view returns (uint256)", "function transfer(address to, uint256 amount) returns (bool)", "function allowance(address owner, address spender) view returns (uint256)", "function approve(address spender, uint256 amount) returns (bool)", "function transferFrom(address from, address to, uint256 amount) returns (bool)", "event Transfer(address indexed from, address indexed to, uint256 value)", "event Approval(address indexed owner, address indexed spender, uint256 value)", "function setKYCRegistry(address registry)", "function addComplianceModule(address module)", "function removeComplianceModule(address module)", "function isTransferAllowed(address from, address to, uint256 amount) view returns (bool allowed, string reason)", "function mint(address to, uint256 amount)", "function burn(address from, uint256 amount)", "function pause()", "function unpause()", "function paused() view returns (bool)", "function grantIssuerRole(address account)", "function grantComplianceOfficerRole(address account)", "function revokeIssuerRole(address account)", "function revokeComplianceOfficerRole(address account)", "function kycRegistry() view returns (address)", "function isComplianceModule(address module) view returns (bool)", "function getComplianceModules() view returns (address[])", "function snapshot() returns (uint256)", "function balanceOfAt(address account, uint256 snapshotId) view returns (uint256)", "function totalSupplyAt(uint256 snapshotId) view returns (uint256)", "event TransferRestricted(address indexed from, address indexed to, uint256 amount, string reason)", "event ComplianceModuleUpdated(address indexed module, bool enabled)", "event TokensPaused(address indexed by)", "event TokensUnpaused(address indexed by)", "event KYCRegistryUpdated(address indexed oldRegistry, address indexed newRegistry)"];
|
|
67
|
+
/**
|
|
68
|
+
* KYCRegistry ABI fragments
|
|
69
|
+
*/
|
|
70
|
+
export declare const KYC_REGISTRY_ABI: readonly ["function addInvestor(address investor, uint8 tier, uint256 expiryTimestamp, bytes32 identityHash)", "function updateInvestor(address investor, uint8 tier, uint256 expiryTimestamp)", "function removeInvestor(address investor)", "function batchAddInvestors(address[] investors, uint8[] tiers, uint256[] expiries, bytes32[] identityHashes)", "function isVerified(address investor) view returns (bool)", "function getInvestorInfo(address investor) view returns (bool verified, uint8 tier, uint256 expiry, bytes32 identityHash)", "function isAccredited(address investor) view returns (bool)", "event InvestorVerified(address indexed investor, uint8 tier, uint256 expiry)", "event InvestorRemoved(address indexed investor)", "event InvestorUpdated(address indexed investor, uint8 newTier, uint256 newExpiry)"];
|
|
71
|
+
/**
|
|
72
|
+
* YieldDistributor ABI fragments
|
|
73
|
+
*/
|
|
74
|
+
export declare const YIELD_DISTRIBUTOR_ABI: readonly ["function createDistribution(address paymentToken, uint256 totalAmount, uint256 claimWindowDays) returns (uint256 distributionId)", "function claim(uint256 distributionId)", "function claimMultiple(uint256[] distributionIds)", "function handleUnclaimedFunds(uint256 distributionId)", "function setUnclaimedFundsRecipient(address recipient)", "function getClaimableAmount(uint256 distributionId, address account) view returns (uint256)", "function getDistributionInfo(uint256 distributionId) view returns (address paymentToken, uint256 totalAmount, uint256 snapshotId, uint256 claimDeadline, uint256 claimedAmount)", "function hasClaimed(uint256 distributionId, address account) view returns (bool)", "function distributionCount() view returns (uint256)", "event DistributionCreated(uint256 indexed distributionId, address indexed paymentToken, uint256 totalAmount, uint256 snapshotId)", "event YieldClaimed(uint256 indexed distributionId, address indexed claimant, uint256 amount)", "event UnclaimedFundsHandled(uint256 indexed distributionId, uint256 amount, address indexed recipient)"];
|
|
75
|
+
/**
|
|
76
|
+
* AssetVault ABI fragments
|
|
77
|
+
*/
|
|
78
|
+
export declare const ASSET_VAULT_ABI: readonly ["function deposit(address token, uint256 amount)", "function depositETH() payable", "function proposeWithdrawal(address token, uint256 amount, address recipient) returns (uint256 proposalId)", "function approveWithdrawal(uint256 proposalId)", "function executeWithdrawal(uint256 proposalId)", "function declareEmergency()", "function resolveEmergency()", "function emergencyWithdraw(address token, address recipient)", "function getCollateralizationRatio() view returns (uint256)", "function getAssetBalance(address token) view returns (uint256)", "function isBackingVerified() view returns (bool)", "function isEmergency() view returns (bool)", "event Deposited(address indexed token, uint256 amount, address indexed depositor)", "event Withdrawn(address indexed token, uint256 amount, address indexed recipient)", "event EmergencyWithdrawal(address indexed token, uint256 amount, address indexed recipient)", "event SignerAdded(address indexed signer)", "event SignerRemoved(address indexed signer)", "event ThresholdUpdated(uint256 newThreshold)", "event WithdrawalProposed(uint256 indexed proposalId, address indexed token, uint256 amount, address recipient)", "event WithdrawalApproved(uint256 indexed proposalId, address indexed approver)", "event EmergencyDeclared(address indexed declaredBy)", "event EmergencyResolved(address indexed resolvedBy)"];
|
|
79
|
+
/**
|
|
80
|
+
* RWAFactory ABI fragments
|
|
81
|
+
*/
|
|
82
|
+
export declare const RWA_FACTORY_ABI: readonly ["function deploy((string tokenName, string tokenSymbol, uint256 initialSupply, address[] complianceModules, uint256 yieldClaimWindowDays, address[] vaultSigners, uint256 vaultThreshold, uint256 vaultWithdrawalThreshold) config) returns ((address token, address vault, address yieldDistributor, address kycRegistry) contracts)", "function upgradeToken(address proxy, address newImplementation)", "function upgradeVault(address proxy, address newImplementation)", "function upgradeYieldDistributor(address proxy, address newImplementation)", "function upgradeKYCRegistry(address proxy, address newImplementation)", "event RWASystemDeployed(address indexed deployer, address token, address vault, address yieldDistributor, address kycRegistry)"];
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAM9C;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAK5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAK5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAGlD,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,KAAK;;;;;;CAMR,CAAC;AAMX;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;CAWjB,CAAC;AAMX;;GAEG;AACH,eAAO,MAAM,QAAQ;IACjB,oDAAoD;;IAEpD,kDAAkD;;IAElD,4CAA4C;;IAE5C,0CAA0C;;IAE1C,kCAAkC;;IAElC,sDAAsD;;CAEhD,CAAC;AAMX;;GAEG;AACH,eAAO,MAAM,SAAS,yrBAYZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa,igEAgChB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,gBAAgB,gzBAWnB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,qBAAqB,4kCAaxB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe,w1CAuBlB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe,kvBAOlB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling for the Mantle RWA SDK
|
|
3
|
+
* Provides descriptive error messages with suggested fixes
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Error codes for categorizing errors
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ErrorCode {
|
|
9
|
+
NOT_VERIFIED = "NOT_VERIFIED",
|
|
10
|
+
KYC_EXPIRED = "KYC_EXPIRED",
|
|
11
|
+
TRANSFER_RESTRICTED = "TRANSFER_RESTRICTED",
|
|
12
|
+
TOKENS_PAUSED = "TOKENS_PAUSED",
|
|
13
|
+
UNAUTHORIZED = "UNAUTHORIZED",
|
|
14
|
+
INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
|
|
15
|
+
INVALID_RECIPIENT = "INVALID_RECIPIENT",
|
|
16
|
+
CLAIM_WINDOW_EXPIRED = "CLAIM_WINDOW_EXPIRED",
|
|
17
|
+
ALREADY_CLAIMED = "ALREADY_CLAIMED",
|
|
18
|
+
WITHDRAWAL_THRESHOLD_NOT_MET = "WITHDRAWAL_THRESHOLD_NOT_MET",
|
|
19
|
+
EMERGENCY_NOT_DECLARED = "EMERGENCY_NOT_DECLARED",
|
|
20
|
+
REENTRANCY = "REENTRANCY",
|
|
21
|
+
RPC_ERROR = "RPC_ERROR",
|
|
22
|
+
TIMEOUT = "TIMEOUT",
|
|
23
|
+
NONCE_TOO_LOW = "NONCE_TOO_LOW",
|
|
24
|
+
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
|
|
25
|
+
GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED",
|
|
26
|
+
NETWORK_MISMATCH = "NETWORK_MISMATCH",
|
|
27
|
+
INVALID_ADDRESS = "INVALID_ADDRESS",
|
|
28
|
+
INVALID_AMOUNT = "INVALID_AMOUNT",
|
|
29
|
+
MISSING_PARAMETER = "MISSING_PARAMETER",
|
|
30
|
+
INVALID_CONFIGURATION = "INVALID_CONFIGURATION",
|
|
31
|
+
PROVIDER_NOT_CONFIGURED = "PROVIDER_NOT_CONFIGURED",
|
|
32
|
+
SIGNER_REQUIRED = "SIGNER_REQUIRED",
|
|
33
|
+
UNKNOWN = "UNKNOWN"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Base error class for RWA SDK errors
|
|
37
|
+
*/
|
|
38
|
+
export declare class RWAError extends Error {
|
|
39
|
+
readonly code: ErrorCode;
|
|
40
|
+
readonly suggestion: string;
|
|
41
|
+
readonly details?: Record<string, unknown>;
|
|
42
|
+
constructor(code: ErrorCode, message: string, details?: Record<string, unknown>);
|
|
43
|
+
/**
|
|
44
|
+
* Get a formatted error message including suggestion
|
|
45
|
+
*/
|
|
46
|
+
toFormattedString(): string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Error class for contract-related errors
|
|
50
|
+
*/
|
|
51
|
+
export declare class ContractError extends RWAError {
|
|
52
|
+
readonly contractAddress: string;
|
|
53
|
+
readonly functionName: string;
|
|
54
|
+
readonly revertReason?: string;
|
|
55
|
+
constructor(code: ErrorCode, message: string, contractAddress: string, functionName: string, revertReason?: string, details?: Record<string, unknown>);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Error class for network-related errors
|
|
59
|
+
*/
|
|
60
|
+
export declare class NetworkError extends RWAError {
|
|
61
|
+
readonly chainId?: number;
|
|
62
|
+
readonly rpcUrl?: string;
|
|
63
|
+
readonly retryable: boolean;
|
|
64
|
+
constructor(code: ErrorCode, message: string, retryable: boolean, chainId?: number, rpcUrl?: string, details?: Record<string, unknown>);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Error class for validation errors
|
|
68
|
+
*/
|
|
69
|
+
export declare class ValidationError extends RWAError {
|
|
70
|
+
readonly field: string;
|
|
71
|
+
readonly constraint: string;
|
|
72
|
+
readonly value: unknown;
|
|
73
|
+
constructor(code: ErrorCode, message: string, field: string, constraint: string, value: unknown, details?: Record<string, unknown>);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Parse a contract revert reason and return the appropriate error
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseContractError(error: unknown, contractAddress: string, functionName: string): ContractError;
|
|
79
|
+
/**
|
|
80
|
+
* Parse a network error and return the appropriate error
|
|
81
|
+
*/
|
|
82
|
+
export declare function parseNetworkError(error: unknown, chainId?: number, rpcUrl?: string): NetworkError;
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|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|
1
|
+
/**
|
|
2
|
+
* @mantle-rwa/sdk
|
|
3
|
+
* TypeScript SDK for Real-World Asset tokenization on Mantle Network
|
|
4
|
+
*/
|
|
5
|
+
export { RWAClient } from './client';
|
|
6
|
+
export type { RWAClientConfig } from './client';
|
|
7
|
+
export { TokenModule, TokenInstance, KYCModule, KYCRegistryInstance, YieldModule, YieldDistributorInstance, ComplianceModule, } from './modules';
|
|
8
|
+
export type { KYCProvider } from './modules';
|
|
9
|
+
export * from './types';
|
|
10
|
+
export * from './errors';
|
|
11
|
+
export * from './constants';
|
|
12
|
+
export { isValidAddress, normalizeAddress, parseAmount, formatAmount, hashIdentityData, timestampToDate, dateToTimestamp, isExpired, calculatePercentage, } from './utils';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EACH,WAAW,EACX,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,WAAW,EACX,wBAAwB,EACxB,gBAAgB,GACnB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C,cAAc,SAAS,CAAC;AAGxB,cAAc,UAAU,CAAC;AAGzB,cAAc,aAAa,CAAC;AAG5B,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,SAAS,EACT,mBAAmB,GACtB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ComplianceModule - Handles transfer eligibility and compliance reporting
|
|
3
|
+
*/
|
|
4
|
+
import { type Provider, type Signer } from 'ethers';
|
|
5
|
+
import type { TransferEligibility, ComplianceReport, FilingData } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Module for compliance operations
|
|
8
|
+
*/
|
|
9
|
+
export declare class ComplianceModule {
|
|
10
|
+
private readonly _provider;
|
|
11
|
+
constructor(provider: Provider, _signer: Signer | null);
|
|
12
|
+
/**
|
|
13
|
+
* Check if a transfer is eligible
|
|
14
|
+
*/
|
|
15
|
+
checkTransferEligibility(tokenAddress: string, from: string, to: string, amount: string): Promise<TransferEligibility>;
|
|
16
|
+
/**
|
|
17
|
+
* Generate a compliance report for a token
|
|
18
|
+
*/
|
|
19
|
+
generateComplianceReport(tokenAddress: string): Promise<ComplianceReport>;
|
|
20
|
+
/**
|
|
21
|
+
* Export a compliance report in various formats
|
|
22
|
+
*/
|
|
23
|
+
exportReport(report: ComplianceReport, format: 'json' | 'csv' | 'pdf'): Promise<Buffer>;
|
|
24
|
+
/**
|
|
25
|
+
* Prepare filing data for regulatory submissions
|
|
26
|
+
*/
|
|
27
|
+
prepareFilingData(tokenAddress: string, filingType: string, startDate?: Date, endDate?: Date): Promise<FilingData>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=compliance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compliance.d.ts","sourceRoot":"","sources":["../../../src/modules/compliance.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,KAAK,EACR,mBAAmB,EAEnB,gBAAgB,EAChB,UAAU,EACb,MAAM,UAAU,CAAC;AAKlB;;GAEG;AACH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;gBAEzB,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAItD;;OAEG;IACG,wBAAwB,CAC1B,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC;IAyH/B;;OAEG;IACG,wBAAwB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAiC/E;;OAEG;IACG,YAAY,CACd,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAC/B,OAAO,CAAC,MAAM,CAAC;IA4BlB;;OAEG;IACG,iBAAiB,CACnB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,IAAI,EAChB,OAAO,CAAC,EAAE,IAAI,GACf,OAAO,CAAC,UAAU,CAAC;CAmBzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Modules
|
|
3
|
+
*/
|
|
4
|
+
export { TokenModule, TokenInstance } from './token';
|
|
5
|
+
export { KYCModule, KYCRegistryInstance, type KYCProvider } from './kyc';
|
|
6
|
+
export { YieldModule, YieldDistributorInstance } from './yield';
|
|
7
|
+
export { ComplianceModule } from './compliance';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KYCModule - Handles KYC registry interactions and provider integrations
|
|
3
|
+
*/
|
|
4
|
+
import { type Provider, type Signer } from 'ethers';
|
|
5
|
+
import type { InvestorData, VerificationSession, VerificationResult, TransactionResult, TransactionOptions, AccreditationTier } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Interface for KYC providers
|
|
8
|
+
*/
|
|
9
|
+
export interface KYCProvider {
|
|
10
|
+
/** Provider name */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Initiate verification for an investor */
|
|
13
|
+
initiateVerification(investorAddress: string, options?: unknown): Promise<VerificationSession>;
|
|
14
|
+
/** Check verification status */
|
|
15
|
+
checkStatus(sessionId: string): Promise<'pending' | 'in_progress' | 'completed' | 'failed'>;
|
|
16
|
+
/** Get verification result */
|
|
17
|
+
getVerificationResult(sessionId: string): Promise<VerificationResult>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Instance of a connected KYC registry
|
|
21
|
+
*/
|
|
22
|
+
export declare class KYCRegistryInstance {
|
|
23
|
+
private readonly _contract;
|
|
24
|
+
private readonly _retries;
|
|
25
|
+
private readonly _retryDelay;
|
|
26
|
+
/** Registry contract address */
|
|
27
|
+
readonly address: string;
|
|
28
|
+
constructor(address: string, provider: Provider, signer: Signer | null, retries: number, retryDelay: number);
|
|
29
|
+
/**
|
|
30
|
+
* Check if an investor is verified
|
|
31
|
+
*/
|
|
32
|
+
isVerified(investor: string): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if an investor is accredited
|
|
35
|
+
*/
|
|
36
|
+
isAccredited(investor: string): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Get investor information
|
|
39
|
+
*/
|
|
40
|
+
getInvestorInfo(investor: string): Promise<InvestorData>;
|
|
41
|
+
/**
|
|
42
|
+
* Add an investor to the registry
|
|
43
|
+
*/
|
|
44
|
+
addInvestor(investor: string, tier: AccreditationTier, expiryDate: Date, identityHash: string, options?: TransactionOptions): Promise<TransactionResult>;
|
|
45
|
+
/**
|
|
46
|
+
* Update an investor's information
|
|
47
|
+
*/
|
|
48
|
+
updateInvestor(investor: string, tier: AccreditationTier, expiryDate: Date, options?: TransactionOptions): Promise<TransactionResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Remove an investor from the registry
|
|
51
|
+
*/
|
|
52
|
+
removeInvestor(investor: string, options?: TransactionOptions): Promise<TransactionResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Batch add investors
|
|
55
|
+
*/
|
|
56
|
+
batchAddInvestors(investors: Array<{
|
|
57
|
+
address: string;
|
|
58
|
+
tier: AccreditationTier;
|
|
59
|
+
expiryDate: Date;
|
|
60
|
+
identityHash: string;
|
|
61
|
+
}>, options?: TransactionOptions): Promise<TransactionResult>;
|
|
62
|
+
/**
|
|
63
|
+
* Listen for InvestorVerified events
|
|
64
|
+
*/
|
|
65
|
+
onInvestorVerified(callback: (investor: string, tier: AccreditationTier, expiry: bigint) => void): () => void;
|
|
66
|
+
/**
|
|
67
|
+
* Listen for InvestorRemoved events
|
|
68
|
+
*/
|
|
69
|
+
onInvestorRemoved(callback: (investor: string) => void): () => void;
|
|
70
|
+
/**
|
|
71
|
+
* Listen for InvestorUpdated events
|
|
72
|
+
*/
|
|
73
|
+
onInvestorUpdated(callback: (investor: string, newTier: AccreditationTier, newExpiry: bigint) => void): () => void;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Module for KYC operations
|
|
77
|
+
*/
|
|
78
|
+
export declare class KYCModule {
|
|
79
|
+
private readonly _provider;
|
|
80
|
+
private readonly _signer;
|
|
81
|
+
private readonly _retries;
|
|
82
|
+
private readonly _retryDelay;
|
|
83
|
+
private _kycProvider;
|
|
84
|
+
constructor(provider: Provider, signer: Signer | null, retries: number, retryDelay: number);
|
|
85
|
+
/**
|
|
86
|
+
* Connect to an existing KYC registry
|
|
87
|
+
*/
|
|
88
|
+
connect(address: string): KYCRegistryInstance;
|
|
89
|
+
/**
|
|
90
|
+
* Set the KYC provider
|
|
91
|
+
*/
|
|
92
|
+
setProvider(provider: 'persona' | 'synaps' | 'jumio' | KYCProvider): void;
|
|
93
|
+
/**
|
|
94
|
+
* Get the current KYC provider
|
|
95
|
+
*/
|
|
96
|
+
get provider(): KYCProvider | null;
|
|
97
|
+
/**
|
|
98
|
+
* Initiate verification for an investor
|
|
99
|
+
*/
|
|
100
|
+
verifyInvestor(investorAddress: string, options?: unknown): Promise<VerificationSession>;
|
|
101
|
+
/**
|
|
102
|
+
* Check accreditation status
|
|
103
|
+
*/
|
|
104
|
+
checkAccreditation(registryAddress: string, investorAddress: string): Promise<AccreditationTier>;
|
|
105
|
+
/**
|
|
106
|
+
* Update registry with verification result
|
|
107
|
+
*/
|
|
108
|
+
updateRegistry(registryAddress: string, investorAddress: string, result: VerificationResult): Promise<TransactionResult>;
|
|
109
|
+
/**
|
|
110
|
+
* Batch update registry with multiple verification results
|
|
111
|
+
*/
|
|
112
|
+
batchUpdateRegistry(registryAddress: string, results: Array<{
|
|
113
|
+
address: string;
|
|
114
|
+
result: VerificationResult;
|
|
115
|
+
}>): Promise<TransactionResult>;
|
|
116
|
+
/**
|
|
117
|
+
* Generate identity hash from data
|
|
118
|
+
*/
|
|
119
|
+
generateIdentityHash(data: {
|
|
120
|
+
firstName?: string;
|
|
121
|
+
lastName?: string;
|
|
122
|
+
dateOfBirth?: string;
|
|
123
|
+
documentNumber?: string;
|
|
124
|
+
country?: string;
|
|
125
|
+
}): string;
|
|
126
|
+
/**
|
|
127
|
+
* Create a built-in provider stub
|
|
128
|
+
*/
|
|
129
|
+
private _createBuiltInProvider;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=kyc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kyc.d.ts","sourceRoot":"","sources":["../../../src/modules/kyc.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,KAAK,EACR,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,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/**
|
|
2
|
+
* TokenModule - Handles RWA token deployment and interactions
|
|
3
|
+
*/
|
|
4
|
+
import { type Provider, type Signer } from 'ethers';
|
|
5
|
+
import type { TokenDeployConfig, TokenInfo, TransactionResult, TransactionOptions } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Instance of a connected RWA token
|
|
8
|
+
*/
|
|
9
|
+
export declare class TokenInstance {
|
|
10
|
+
private readonly _contract;
|
|
11
|
+
private readonly _retries;
|
|
12
|
+
private readonly _retryDelay;
|
|
13
|
+
/** Token contract address */
|
|
14
|
+
readonly address: string;
|
|
15
|
+
constructor(address: string, provider: Provider, signer: Signer | null, retries: number, retryDelay: number);
|
|
16
|
+
/**
|
|
17
|
+
* Get token name
|
|
18
|
+
*/
|
|
19
|
+
name(): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Get token symbol
|
|
22
|
+
*/
|
|
23
|
+
symbol(): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Get token decimals
|
|
26
|
+
*/
|
|
27
|
+
decimals(): Promise<number>;
|
|
28
|
+
/**
|
|
29
|
+
* Get total supply
|
|
30
|
+
*/
|
|
31
|
+
totalSupply(): Promise<bigint>;
|
|
32
|
+
/**
|
|
33
|
+
* Get balance of an account
|
|
34
|
+
*/
|
|
35
|
+
balanceOf(account: string): Promise<bigint>;
|
|
36
|
+
/**
|
|
37
|
+
* Check if token is paused
|
|
38
|
+
*/
|
|
39
|
+
paused(): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* Get the KYC registry address
|
|
42
|
+
*/
|
|
43
|
+
kycRegistry(): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Get all compliance modules
|
|
46
|
+
*/
|
|
47
|
+
getComplianceModules(): Promise<string[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Check if an address is a compliance module
|
|
50
|
+
*/
|
|
51
|
+
isComplianceModule(module: string): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Check if a transfer is allowed
|
|
54
|
+
*/
|
|
55
|
+
isTransferAllowed(from: string, to: string, amount: string): Promise<{
|
|
56
|
+
allowed: boolean;
|
|
57
|
+
reason: string;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Get token info
|
|
61
|
+
*/
|
|
62
|
+
getInfo(): Promise<TokenInfo>;
|
|
63
|
+
/**
|
|
64
|
+
* Get balance at a specific snapshot
|
|
65
|
+
*/
|
|
66
|
+
balanceOfAt(account: string, snapshotId: bigint): Promise<bigint>;
|
|
67
|
+
/**
|
|
68
|
+
* Get total supply at a specific snapshot
|
|
69
|
+
*/
|
|
70
|
+
totalSupplyAt(snapshotId: bigint): Promise<bigint>;
|
|
71
|
+
/**
|
|
72
|
+
* Mint tokens to an address
|
|
73
|
+
*/
|
|
74
|
+
mint(to: string, amount: string, options?: TransactionOptions): Promise<TransactionResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Burn tokens from an address
|
|
77
|
+
*/
|
|
78
|
+
burn(from: string, amount: string, options?: TransactionOptions): Promise<TransactionResult>;
|
|
79
|
+
/**
|
|
80
|
+
* Transfer tokens
|
|
81
|
+
*/
|
|
82
|
+
transfer(to: string, amount: string, options?: TransactionOptions): Promise<TransactionResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Pause token transfers
|
|
85
|
+
*/
|
|
86
|
+
pause(options?: TransactionOptions): Promise<TransactionResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Unpause token transfers
|
|
89
|
+
*/
|
|
90
|
+
unpause(options?: TransactionOptions): Promise<TransactionResult>;
|
|
91
|
+
/**
|
|
92
|
+
* Create a snapshot
|
|
93
|
+
*/
|
|
94
|
+
snapshot(options?: TransactionOptions): Promise<{
|
|
95
|
+
result: TransactionResult;
|
|
96
|
+
snapshotId: bigint;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Set the KYC registry
|
|
100
|
+
*/
|
|
101
|
+
setKYCRegistry(registry: string, options?: TransactionOptions): Promise<TransactionResult>;
|
|
102
|
+
/**
|
|
103
|
+
* Add a compliance module
|
|
104
|
+
*/
|
|
105
|
+
addComplianceModule(module: string, options?: TransactionOptions): Promise<TransactionResult>;
|
|
106
|
+
/**
|
|
107
|
+
* Remove a compliance module
|
|
108
|
+
*/
|
|
109
|
+
removeComplianceModule(module: string, options?: TransactionOptions): Promise<TransactionResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Listen for Transfer events
|
|
112
|
+
*/
|
|
113
|
+
onTransfer(callback: (from: string, to: string, amount: bigint) => void): () => void;
|
|
114
|
+
/**
|
|
115
|
+
* Listen for TransferRestricted events
|
|
116
|
+
*/
|
|
117
|
+
onTransferRestricted(callback: (from: string, to: string, amount: bigint, reason: string) => void): () => void;
|
|
118
|
+
/**
|
|
119
|
+
* Listen for Paused events
|
|
120
|
+
*/
|
|
121
|
+
onPaused(callback: (by: string) => void): () => void;
|
|
122
|
+
/**
|
|
123
|
+
* Listen for Unpaused events
|
|
124
|
+
*/
|
|
125
|
+
onUnpaused(callback: (by: string) => void): () => void;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Module for token operations
|
|
129
|
+
*/
|
|
130
|
+
export declare class TokenModule {
|
|
131
|
+
private readonly _provider;
|
|
132
|
+
private readonly _signer;
|
|
133
|
+
private readonly _retries;
|
|
134
|
+
private readonly _retryDelay;
|
|
135
|
+
constructor(provider: Provider, signer: Signer | null, retries: number, retryDelay: number);
|
|
136
|
+
/**
|
|
137
|
+
* Connect to an existing token contract
|
|
138
|
+
*/
|
|
139
|
+
connect(address: string): TokenInstance;
|
|
140
|
+
/**
|
|
141
|
+
* Estimate gas for deploying a token
|
|
142
|
+
*/
|
|
143
|
+
estimateDeployGas(_config: TokenDeployConfig): Promise<bigint>;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/modules/token.ts"],"names":[],"mappings":"AAA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