@weblock-wallet/sdk 0.1.50 → 0.1.52
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/index.cjs +576 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -1
- package/dist/index.d.ts +87 -1
- package/dist/index.js +576 -72
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -36,6 +36,62 @@ declare class SDKError extends Error {
|
|
|
36
36
|
constructor(message: string, code: SDKErrorCode, details?: unknown | undefined);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
interface GetOfferingParams {
|
|
40
|
+
networkId: string;
|
|
41
|
+
saleRouterAddress: string;
|
|
42
|
+
offeringId: bigint | number | string;
|
|
43
|
+
}
|
|
44
|
+
interface OfferingView {
|
|
45
|
+
asset: string;
|
|
46
|
+
seriesId: bigint;
|
|
47
|
+
unitPrice: bigint;
|
|
48
|
+
remainingUnits: bigint;
|
|
49
|
+
startAt: bigint;
|
|
50
|
+
endAt: bigint;
|
|
51
|
+
treasury: string;
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
}
|
|
54
|
+
interface InvestRbtParams {
|
|
55
|
+
networkId: string;
|
|
56
|
+
usdrAddress: string;
|
|
57
|
+
saleRouterAddress: string;
|
|
58
|
+
offeringId: bigint | number | string;
|
|
59
|
+
units: bigint | number | string;
|
|
60
|
+
/**
|
|
61
|
+
* 보호용 상한(슬리피지 개념). 미지정 시 cost == maxCost로 처리.
|
|
62
|
+
*/
|
|
63
|
+
maxCostWei?: string;
|
|
64
|
+
/**
|
|
65
|
+
* true면 allowance 확인 후 부족 시 approve까지 자동 수행
|
|
66
|
+
*/
|
|
67
|
+
autoApprove?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* autoApprove일 때 approve를 MaxUint로 할지(cost만 할지)
|
|
70
|
+
*/
|
|
71
|
+
approveMax?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* autoApprove에서 approve tx 영수증을 기다릴지(기본 true 권장)
|
|
74
|
+
*/
|
|
75
|
+
waitForApprovalReceipt?: boolean;
|
|
76
|
+
gasLimitApprove?: string;
|
|
77
|
+
gasLimitBuy?: string;
|
|
78
|
+
}
|
|
79
|
+
interface InvestRbtResult {
|
|
80
|
+
offering: OfferingView;
|
|
81
|
+
costWei: string;
|
|
82
|
+
approvalTxHash?: string;
|
|
83
|
+
purchaseTxHash: string;
|
|
84
|
+
}
|
|
85
|
+
interface ClaimRbtRevenueParams {
|
|
86
|
+
networkId: string;
|
|
87
|
+
rbtAssetAddress: string;
|
|
88
|
+
seriesId: bigint | number | string;
|
|
89
|
+
gasLimit?: string;
|
|
90
|
+
}
|
|
91
|
+
interface ClaimRbtRevenueResult {
|
|
92
|
+
txHash: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
39
95
|
/**
|
|
40
96
|
* SDK 초기화 옵션
|
|
41
97
|
*/
|
|
@@ -412,6 +468,7 @@ declare class WeBlockSDK {
|
|
|
412
468
|
private readonly walletModule;
|
|
413
469
|
private readonly assetModule;
|
|
414
470
|
private readonly networkModule;
|
|
471
|
+
private readonly investmentModule;
|
|
415
472
|
private initialized;
|
|
416
473
|
constructor(options: SDKOptions);
|
|
417
474
|
private validateOptions;
|
|
@@ -474,7 +531,36 @@ declare class WeBlockSDK {
|
|
|
474
531
|
tokenAddress: string;
|
|
475
532
|
walletAddress: string;
|
|
476
533
|
}) => Promise<TokenInfo>;
|
|
534
|
+
/**
|
|
535
|
+
* ✅ ERC20 잔액 조회 (주의: 현재 AssetModule 구현은 raw balance string을 반환)
|
|
536
|
+
* - TokenBalance(객체)가 아니라 string(wei) 입니다.
|
|
537
|
+
*/
|
|
538
|
+
getTokenBalance: (params: TokenBalanceParams) => Promise<string>;
|
|
539
|
+
approveToken: (params: TokenApprovalParams) => Promise<string>;
|
|
540
|
+
getAllowance: (params: TokenAllowanceParams) => Promise<string>;
|
|
541
|
+
};
|
|
542
|
+
/**
|
|
543
|
+
* ✅ NEW: Investment API Surface
|
|
544
|
+
*/
|
|
545
|
+
readonly invest: {
|
|
546
|
+
getOffering: (params: GetOfferingParams) => Promise<OfferingView>;
|
|
547
|
+
investRbtWithUsdr: (params: InvestRbtParams) => Promise<InvestRbtResult>;
|
|
548
|
+
claimRbtRevenue: (params: ClaimRbtRevenueParams) => Promise<ClaimRbtRevenueResult>;
|
|
549
|
+
getClaimable: (params: {
|
|
550
|
+
networkId: string;
|
|
551
|
+
rbtAssetAddress: string;
|
|
552
|
+
seriesId: bigint | number | string;
|
|
553
|
+
account?: string;
|
|
554
|
+
}) => Promise<string>;
|
|
555
|
+
getRbtBalance: (params: {
|
|
556
|
+
networkId: string;
|
|
557
|
+
rbtAssetAddress: string;
|
|
558
|
+
seriesId: bigint | number | string;
|
|
559
|
+
account?: string;
|
|
560
|
+
}) => Promise<string>;
|
|
561
|
+
on: (event: string, listener: (...args: any[]) => void) => void;
|
|
562
|
+
off: (event: string, listener: (...args: any[]) => void) => void;
|
|
477
563
|
};
|
|
478
564
|
}
|
|
479
565
|
|
|
480
|
-
export { type AddNetworkRequest, DECIMALS, type NFTCollection, type NetworkInfo, SDKError, SDKErrorCode, type SDKOptions, type SecurityTokenInfo, type SendTransactionParams, type SignInResponse, SignInStatus, type SwitchNetworkResponse, type TokenAllowanceParams, TokenAmount, type TokenApprovalParams, type TokenBalance, type TokenBalanceParams, type TokenInfo, type TokenInfoParams, type TokenMetadata, TokenType, type Transaction, type TransactionReceipt, TransactionStatus, type TransactionStatusEvent, TransactionType, type TransferRequest, type TransferResponse, type WalletInfo, type WalletResponse, WeBlockSDK, WeBlockSDK as default };
|
|
566
|
+
export { type AddNetworkRequest, type ClaimRbtRevenueParams, type ClaimRbtRevenueResult, DECIMALS, type GetOfferingParams, type InvestRbtParams, type InvestRbtResult, type NFTCollection, type NetworkInfo, type OfferingView, SDKError, SDKErrorCode, type SDKOptions, type SecurityTokenInfo, type SendTransactionParams, type SignInResponse, SignInStatus, type SwitchNetworkResponse, type TokenAllowanceParams, TokenAmount, type TokenApprovalParams, type TokenBalance, type TokenBalanceParams, type TokenInfo, type TokenInfoParams, type TokenMetadata, TokenType, type Transaction, type TransactionReceipt, TransactionStatus, type TransactionStatusEvent, TransactionType, type TransferRequest, type TransferResponse, type WalletInfo, type WalletResponse, WeBlockSDK, WeBlockSDK as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,62 @@ declare class SDKError extends Error {
|
|
|
36
36
|
constructor(message: string, code: SDKErrorCode, details?: unknown | undefined);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
interface GetOfferingParams {
|
|
40
|
+
networkId: string;
|
|
41
|
+
saleRouterAddress: string;
|
|
42
|
+
offeringId: bigint | number | string;
|
|
43
|
+
}
|
|
44
|
+
interface OfferingView {
|
|
45
|
+
asset: string;
|
|
46
|
+
seriesId: bigint;
|
|
47
|
+
unitPrice: bigint;
|
|
48
|
+
remainingUnits: bigint;
|
|
49
|
+
startAt: bigint;
|
|
50
|
+
endAt: bigint;
|
|
51
|
+
treasury: string;
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
}
|
|
54
|
+
interface InvestRbtParams {
|
|
55
|
+
networkId: string;
|
|
56
|
+
usdrAddress: string;
|
|
57
|
+
saleRouterAddress: string;
|
|
58
|
+
offeringId: bigint | number | string;
|
|
59
|
+
units: bigint | number | string;
|
|
60
|
+
/**
|
|
61
|
+
* 보호용 상한(슬리피지 개념). 미지정 시 cost == maxCost로 처리.
|
|
62
|
+
*/
|
|
63
|
+
maxCostWei?: string;
|
|
64
|
+
/**
|
|
65
|
+
* true면 allowance 확인 후 부족 시 approve까지 자동 수행
|
|
66
|
+
*/
|
|
67
|
+
autoApprove?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* autoApprove일 때 approve를 MaxUint로 할지(cost만 할지)
|
|
70
|
+
*/
|
|
71
|
+
approveMax?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* autoApprove에서 approve tx 영수증을 기다릴지(기본 true 권장)
|
|
74
|
+
*/
|
|
75
|
+
waitForApprovalReceipt?: boolean;
|
|
76
|
+
gasLimitApprove?: string;
|
|
77
|
+
gasLimitBuy?: string;
|
|
78
|
+
}
|
|
79
|
+
interface InvestRbtResult {
|
|
80
|
+
offering: OfferingView;
|
|
81
|
+
costWei: string;
|
|
82
|
+
approvalTxHash?: string;
|
|
83
|
+
purchaseTxHash: string;
|
|
84
|
+
}
|
|
85
|
+
interface ClaimRbtRevenueParams {
|
|
86
|
+
networkId: string;
|
|
87
|
+
rbtAssetAddress: string;
|
|
88
|
+
seriesId: bigint | number | string;
|
|
89
|
+
gasLimit?: string;
|
|
90
|
+
}
|
|
91
|
+
interface ClaimRbtRevenueResult {
|
|
92
|
+
txHash: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
39
95
|
/**
|
|
40
96
|
* SDK 초기화 옵션
|
|
41
97
|
*/
|
|
@@ -412,6 +468,7 @@ declare class WeBlockSDK {
|
|
|
412
468
|
private readonly walletModule;
|
|
413
469
|
private readonly assetModule;
|
|
414
470
|
private readonly networkModule;
|
|
471
|
+
private readonly investmentModule;
|
|
415
472
|
private initialized;
|
|
416
473
|
constructor(options: SDKOptions);
|
|
417
474
|
private validateOptions;
|
|
@@ -474,7 +531,36 @@ declare class WeBlockSDK {
|
|
|
474
531
|
tokenAddress: string;
|
|
475
532
|
walletAddress: string;
|
|
476
533
|
}) => Promise<TokenInfo>;
|
|
534
|
+
/**
|
|
535
|
+
* ✅ ERC20 잔액 조회 (주의: 현재 AssetModule 구현은 raw balance string을 반환)
|
|
536
|
+
* - TokenBalance(객체)가 아니라 string(wei) 입니다.
|
|
537
|
+
*/
|
|
538
|
+
getTokenBalance: (params: TokenBalanceParams) => Promise<string>;
|
|
539
|
+
approveToken: (params: TokenApprovalParams) => Promise<string>;
|
|
540
|
+
getAllowance: (params: TokenAllowanceParams) => Promise<string>;
|
|
541
|
+
};
|
|
542
|
+
/**
|
|
543
|
+
* ✅ NEW: Investment API Surface
|
|
544
|
+
*/
|
|
545
|
+
readonly invest: {
|
|
546
|
+
getOffering: (params: GetOfferingParams) => Promise<OfferingView>;
|
|
547
|
+
investRbtWithUsdr: (params: InvestRbtParams) => Promise<InvestRbtResult>;
|
|
548
|
+
claimRbtRevenue: (params: ClaimRbtRevenueParams) => Promise<ClaimRbtRevenueResult>;
|
|
549
|
+
getClaimable: (params: {
|
|
550
|
+
networkId: string;
|
|
551
|
+
rbtAssetAddress: string;
|
|
552
|
+
seriesId: bigint | number | string;
|
|
553
|
+
account?: string;
|
|
554
|
+
}) => Promise<string>;
|
|
555
|
+
getRbtBalance: (params: {
|
|
556
|
+
networkId: string;
|
|
557
|
+
rbtAssetAddress: string;
|
|
558
|
+
seriesId: bigint | number | string;
|
|
559
|
+
account?: string;
|
|
560
|
+
}) => Promise<string>;
|
|
561
|
+
on: (event: string, listener: (...args: any[]) => void) => void;
|
|
562
|
+
off: (event: string, listener: (...args: any[]) => void) => void;
|
|
477
563
|
};
|
|
478
564
|
}
|
|
479
565
|
|
|
480
|
-
export { type AddNetworkRequest, DECIMALS, type NFTCollection, type NetworkInfo, SDKError, SDKErrorCode, type SDKOptions, type SecurityTokenInfo, type SendTransactionParams, type SignInResponse, SignInStatus, type SwitchNetworkResponse, type TokenAllowanceParams, TokenAmount, type TokenApprovalParams, type TokenBalance, type TokenBalanceParams, type TokenInfo, type TokenInfoParams, type TokenMetadata, TokenType, type Transaction, type TransactionReceipt, TransactionStatus, type TransactionStatusEvent, TransactionType, type TransferRequest, type TransferResponse, type WalletInfo, type WalletResponse, WeBlockSDK, WeBlockSDK as default };
|
|
566
|
+
export { type AddNetworkRequest, type ClaimRbtRevenueParams, type ClaimRbtRevenueResult, DECIMALS, type GetOfferingParams, type InvestRbtParams, type InvestRbtResult, type NFTCollection, type NetworkInfo, type OfferingView, SDKError, SDKErrorCode, type SDKOptions, type SecurityTokenInfo, type SendTransactionParams, type SignInResponse, SignInStatus, type SwitchNetworkResponse, type TokenAllowanceParams, TokenAmount, type TokenApprovalParams, type TokenBalance, type TokenBalanceParams, type TokenInfo, type TokenInfoParams, type TokenMetadata, TokenType, type Transaction, type TransactionReceipt, TransactionStatus, type TransactionStatusEvent, TransactionType, type TransferRequest, type TransferResponse, type WalletInfo, type WalletResponse, WeBlockSDK, WeBlockSDK as default };
|