@frontiertower/frontier-sdk 0.9.0 → 0.11.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/README.md +9 -0
- package/dist/index.d.mts +77 -12
- package/dist/index.d.ts +77 -12
- package/dist/index.js +64 -9
- package/dist/index.mjs +64 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,7 +28,14 @@ if (!isInFrontierApp()) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// Access wallet information
|
|
31
|
+
/**
|
|
32
|
+
* The wallet balance is split into two types:
|
|
33
|
+
* - Frontier Dollar (FTD): Freely convertible to fiat currency.
|
|
34
|
+
* - Internal Frontier Dollar: Only convertible by Frontier Tower representatives;
|
|
35
|
+
* designed for circulation within the Network Society.
|
|
36
|
+
*/
|
|
31
37
|
const balance = await sdk.getWallet().getBalance();
|
|
38
|
+
console.log('Total FTD:', balance.total.toString());
|
|
32
39
|
const address = await sdk.getWallet().getAddress();
|
|
33
40
|
|
|
34
41
|
// Use persistent storage
|
|
@@ -50,6 +57,8 @@ Your app must declare required permissions in the Frontier app registry:
|
|
|
50
57
|
- `wallet:approveERC20` - Approve ERC20 token spending
|
|
51
58
|
- `wallet:transferNative` - Transfer native currency (ETH)
|
|
52
59
|
- `wallet:transferFrontierDollar` - Transfer Frontier Dollars
|
|
60
|
+
- `wallet:transferInternalFrontierDollar` - Transfer Internal Frontier Dollars
|
|
61
|
+
- `wallet:transferOverallFrontierDollar` - Transfer Frontier Dollars with iFTD preferred
|
|
53
62
|
- `wallet:executeCall` - Execute arbitrary contract calls
|
|
54
63
|
- `wallet:executeBatchCall` - Execute multiple contract calls atomically
|
|
55
64
|
- `wallet:getSupportedTokens` - Get list of supported tokens for swaps
|
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,28 @@ interface SmartAccount {
|
|
|
19
19
|
/** Creation timestamp */
|
|
20
20
|
createdAt: string;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Wallet balance breakdown
|
|
24
|
+
*/
|
|
25
|
+
interface WalletBalance {
|
|
26
|
+
/** Total balance including both native and internal FTD */
|
|
27
|
+
total: bigint;
|
|
28
|
+
/** Native Frontier Dollar balance */
|
|
29
|
+
ftd: bigint;
|
|
30
|
+
/** Internal Frontier Dollar balance (for Network Society) */
|
|
31
|
+
internalFtd: bigint;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Formatted wallet balance breakdown
|
|
35
|
+
*/
|
|
36
|
+
interface WalletBalanceFormatted {
|
|
37
|
+
/** Total balance formatted with currency symbol */
|
|
38
|
+
total: string;
|
|
39
|
+
/** Native Frontier Dollar balance formatted with currency symbol */
|
|
40
|
+
ftd: string;
|
|
41
|
+
/** Internal Frontier Dollar balance formatted with currency symbol */
|
|
42
|
+
internalFtd: string;
|
|
43
|
+
}
|
|
22
44
|
/**
|
|
23
45
|
* Transaction receipt from a user operation
|
|
24
46
|
*/
|
|
@@ -124,37 +146,38 @@ declare class WalletAccess {
|
|
|
124
146
|
private sdk;
|
|
125
147
|
constructor(sdk: FrontierSDK);
|
|
126
148
|
/**
|
|
127
|
-
* Get the current wallet balance
|
|
149
|
+
* Get the current wallet balance breakdown
|
|
128
150
|
*
|
|
129
|
-
* Returns the
|
|
130
|
-
*
|
|
151
|
+
* Returns the balance breakdown including total, native FTD,
|
|
152
|
+
* and internal FTD amounts.
|
|
131
153
|
*
|
|
132
|
-
* @returns Balance
|
|
154
|
+
* @returns Balance breakdown object
|
|
133
155
|
* @throws {Error} If no wallet exists
|
|
134
156
|
*
|
|
135
157
|
* @example
|
|
136
158
|
* ```typescript
|
|
137
159
|
* const balance = await sdk.getWallet().getBalance();
|
|
138
|
-
* console.log('Balance:', balance.toString());
|
|
160
|
+
* console.log('Total Balance:', balance.total.toString());
|
|
161
|
+
* console.log('FTD Balance:', balance.ftd.toString());
|
|
139
162
|
* ```
|
|
140
163
|
*/
|
|
141
|
-
getBalance(): Promise<
|
|
164
|
+
getBalance(): Promise<WalletBalance>;
|
|
142
165
|
/**
|
|
143
166
|
* Get the current wallet balance formatted for display
|
|
144
167
|
*
|
|
145
|
-
* Returns the
|
|
146
|
-
* with currency symbol (e.g., '$10.50').
|
|
168
|
+
* Returns the balance breakdown as formatted strings
|
|
169
|
+
* with currency symbol (e.g., { total: '$10.50', ... }).
|
|
147
170
|
*
|
|
148
|
-
* @returns Formatted balance
|
|
171
|
+
* @returns Formatted balance breakdown object
|
|
149
172
|
* @throws {Error} If no wallet exists
|
|
150
173
|
*
|
|
151
174
|
* @example
|
|
152
175
|
* ```typescript
|
|
153
176
|
* const balance = await sdk.getWallet().getBalanceFormatted();
|
|
154
|
-
* console.log('
|
|
177
|
+
* console.log('Total:', balance.total); // '$10.50'
|
|
155
178
|
* ```
|
|
156
179
|
*/
|
|
157
|
-
getBalanceFormatted(): Promise<
|
|
180
|
+
getBalanceFormatted(): Promise<WalletBalanceFormatted>;
|
|
158
181
|
/**
|
|
159
182
|
* Get the wallet address for the current network
|
|
160
183
|
*
|
|
@@ -310,6 +333,48 @@ declare class WalletAccess {
|
|
|
310
333
|
* ```
|
|
311
334
|
*/
|
|
312
335
|
transferFrontierDollar(to: string, amount: string, overrides?: GasOverrides): Promise<UserOperationReceipt>;
|
|
336
|
+
/**
|
|
337
|
+
* Transfer Internal Frontier Dollars to another address
|
|
338
|
+
*
|
|
339
|
+
* Sends Internal Frontier Dollars (for Network Society spending) to a recipient address.
|
|
340
|
+
* Requires biometric authentication and sufficient balance.
|
|
341
|
+
*
|
|
342
|
+
* @param to - Recipient address
|
|
343
|
+
* @param amount - Amount to send (as string, e.g., '10.5' for 10.5 Frontier Dollars)
|
|
344
|
+
* @param overrides - Optional gas overrides
|
|
345
|
+
* @returns User operation receipt with transaction details
|
|
346
|
+
* @throws {Error} If insufficient balance or transaction fails
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```typescript
|
|
350
|
+
* const receipt = await sdk.getWallet().transferInternalFrontierDollar(
|
|
351
|
+
* '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
|
|
352
|
+
* '10.5' // 10.5 Internal Frontier Dollars
|
|
353
|
+
* );
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
transferInternalFrontierDollar(to: string, amount: string, overrides?: GasOverrides): Promise<UserOperationReceipt>;
|
|
357
|
+
/**
|
|
358
|
+
* Transfer Frontier Dollars with Internal Frontier Dollars (iFTD) preferred
|
|
359
|
+
*
|
|
360
|
+
* This method will use Internal Frontier Dollars first, and if insufficient,
|
|
361
|
+
* it will use regular Frontier Dollars to complete the transfer.
|
|
362
|
+
*
|
|
363
|
+
* @param to - Recipient address
|
|
364
|
+
* @param amount - Amount to send (as string, e.g., '10.5')
|
|
365
|
+
* @param overrides - Optional gas overrides
|
|
366
|
+
* @returns User operation receipt with transaction details
|
|
367
|
+
* @throws {Error} If insufficient total balance or transaction fails
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* const receipt = await sdk.getWallet().transferOverallFrontierDollar(
|
|
372
|
+
* '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
|
|
373
|
+
* '10.5'
|
|
374
|
+
* );
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
transferOverallFrontierDollar(to: string, amount: string, overrides?: GasOverrides): Promise<UserOperationReceipt>;
|
|
313
378
|
/**
|
|
314
379
|
* Execute multiple calls atomically with a single signature
|
|
315
380
|
*
|
|
@@ -1501,4 +1566,4 @@ interface SDKResponse {
|
|
|
1501
1566
|
error?: string;
|
|
1502
1567
|
}
|
|
1503
1568
|
|
|
1504
|
-
export { type App, type AppPermission, type AppStatus, ChainAccess, type ChainConfig, type CreateAppRequest, type CreateSponsorPassRequest, type CreateWebhookRequest, type Developer, type ExecuteCall, FrontierSDK, type GasOverrides, type ListParams, type ListSponsorsParams, type PaginatedResponse, PartnershipsAccess, type ReferralDetails, type ReferralOverview, type RotateKeyResponse, type RotateWebhookKeyResponse, type SDKRequest, type SDKResponse, type SmartAccount, type Sponsor, type SponsorPass, StorageAccess, type SwapParams, type SwapQuote, type SwapResult, SwapResultStatus, ThirdPartyAccess, type UpdateAppRequest, type UpdateDeveloperRequest, type UpdateWebhookRequest, type User, UserAccess, type UserContact, type UserContactPayload, type UserOperationReceipt, type UserProfile, WalletAccess, type Webhook, type WebhookConfig, type WebhookEvent, type WebhookScope, type WebhookStatus };
|
|
1569
|
+
export { type App, type AppPermission, type AppStatus, ChainAccess, type ChainConfig, type CreateAppRequest, type CreateSponsorPassRequest, type CreateWebhookRequest, type Developer, type ExecuteCall, FrontierSDK, type GasOverrides, type ListParams, type ListSponsorsParams, type PaginatedResponse, PartnershipsAccess, type ReferralDetails, type ReferralOverview, type RotateKeyResponse, type RotateWebhookKeyResponse, type SDKRequest, type SDKResponse, type SmartAccount, type Sponsor, type SponsorPass, StorageAccess, type SwapParams, type SwapQuote, type SwapResult, SwapResultStatus, ThirdPartyAccess, type UpdateAppRequest, type UpdateDeveloperRequest, type UpdateWebhookRequest, type User, UserAccess, type UserContact, type UserContactPayload, type UserOperationReceipt, type UserProfile, WalletAccess, type WalletBalance, type WalletBalanceFormatted, type Webhook, type WebhookConfig, type WebhookEvent, type WebhookScope, type WebhookStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,28 @@ interface SmartAccount {
|
|
|
19
19
|
/** Creation timestamp */
|
|
20
20
|
createdAt: string;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Wallet balance breakdown
|
|
24
|
+
*/
|
|
25
|
+
interface WalletBalance {
|
|
26
|
+
/** Total balance including both native and internal FTD */
|
|
27
|
+
total: bigint;
|
|
28
|
+
/** Native Frontier Dollar balance */
|
|
29
|
+
ftd: bigint;
|
|
30
|
+
/** Internal Frontier Dollar balance (for Network Society) */
|
|
31
|
+
internalFtd: bigint;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Formatted wallet balance breakdown
|
|
35
|
+
*/
|
|
36
|
+
interface WalletBalanceFormatted {
|
|
37
|
+
/** Total balance formatted with currency symbol */
|
|
38
|
+
total: string;
|
|
39
|
+
/** Native Frontier Dollar balance formatted with currency symbol */
|
|
40
|
+
ftd: string;
|
|
41
|
+
/** Internal Frontier Dollar balance formatted with currency symbol */
|
|
42
|
+
internalFtd: string;
|
|
43
|
+
}
|
|
22
44
|
/**
|
|
23
45
|
* Transaction receipt from a user operation
|
|
24
46
|
*/
|
|
@@ -124,37 +146,38 @@ declare class WalletAccess {
|
|
|
124
146
|
private sdk;
|
|
125
147
|
constructor(sdk: FrontierSDK);
|
|
126
148
|
/**
|
|
127
|
-
* Get the current wallet balance
|
|
149
|
+
* Get the current wallet balance breakdown
|
|
128
150
|
*
|
|
129
|
-
* Returns the
|
|
130
|
-
*
|
|
151
|
+
* Returns the balance breakdown including total, native FTD,
|
|
152
|
+
* and internal FTD amounts.
|
|
131
153
|
*
|
|
132
|
-
* @returns Balance
|
|
154
|
+
* @returns Balance breakdown object
|
|
133
155
|
* @throws {Error} If no wallet exists
|
|
134
156
|
*
|
|
135
157
|
* @example
|
|
136
158
|
* ```typescript
|
|
137
159
|
* const balance = await sdk.getWallet().getBalance();
|
|
138
|
-
* console.log('Balance:', balance.toString());
|
|
160
|
+
* console.log('Total Balance:', balance.total.toString());
|
|
161
|
+
* console.log('FTD Balance:', balance.ftd.toString());
|
|
139
162
|
* ```
|
|
140
163
|
*/
|
|
141
|
-
getBalance(): Promise<
|
|
164
|
+
getBalance(): Promise<WalletBalance>;
|
|
142
165
|
/**
|
|
143
166
|
* Get the current wallet balance formatted for display
|
|
144
167
|
*
|
|
145
|
-
* Returns the
|
|
146
|
-
* with currency symbol (e.g., '$10.50').
|
|
168
|
+
* Returns the balance breakdown as formatted strings
|
|
169
|
+
* with currency symbol (e.g., { total: '$10.50', ... }).
|
|
147
170
|
*
|
|
148
|
-
* @returns Formatted balance
|
|
171
|
+
* @returns Formatted balance breakdown object
|
|
149
172
|
* @throws {Error} If no wallet exists
|
|
150
173
|
*
|
|
151
174
|
* @example
|
|
152
175
|
* ```typescript
|
|
153
176
|
* const balance = await sdk.getWallet().getBalanceFormatted();
|
|
154
|
-
* console.log('
|
|
177
|
+
* console.log('Total:', balance.total); // '$10.50'
|
|
155
178
|
* ```
|
|
156
179
|
*/
|
|
157
|
-
getBalanceFormatted(): Promise<
|
|
180
|
+
getBalanceFormatted(): Promise<WalletBalanceFormatted>;
|
|
158
181
|
/**
|
|
159
182
|
* Get the wallet address for the current network
|
|
160
183
|
*
|
|
@@ -310,6 +333,48 @@ declare class WalletAccess {
|
|
|
310
333
|
* ```
|
|
311
334
|
*/
|
|
312
335
|
transferFrontierDollar(to: string, amount: string, overrides?: GasOverrides): Promise<UserOperationReceipt>;
|
|
336
|
+
/**
|
|
337
|
+
* Transfer Internal Frontier Dollars to another address
|
|
338
|
+
*
|
|
339
|
+
* Sends Internal Frontier Dollars (for Network Society spending) to a recipient address.
|
|
340
|
+
* Requires biometric authentication and sufficient balance.
|
|
341
|
+
*
|
|
342
|
+
* @param to - Recipient address
|
|
343
|
+
* @param amount - Amount to send (as string, e.g., '10.5' for 10.5 Frontier Dollars)
|
|
344
|
+
* @param overrides - Optional gas overrides
|
|
345
|
+
* @returns User operation receipt with transaction details
|
|
346
|
+
* @throws {Error} If insufficient balance or transaction fails
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```typescript
|
|
350
|
+
* const receipt = await sdk.getWallet().transferInternalFrontierDollar(
|
|
351
|
+
* '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
|
|
352
|
+
* '10.5' // 10.5 Internal Frontier Dollars
|
|
353
|
+
* );
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
transferInternalFrontierDollar(to: string, amount: string, overrides?: GasOverrides): Promise<UserOperationReceipt>;
|
|
357
|
+
/**
|
|
358
|
+
* Transfer Frontier Dollars with Internal Frontier Dollars (iFTD) preferred
|
|
359
|
+
*
|
|
360
|
+
* This method will use Internal Frontier Dollars first, and if insufficient,
|
|
361
|
+
* it will use regular Frontier Dollars to complete the transfer.
|
|
362
|
+
*
|
|
363
|
+
* @param to - Recipient address
|
|
364
|
+
* @param amount - Amount to send (as string, e.g., '10.5')
|
|
365
|
+
* @param overrides - Optional gas overrides
|
|
366
|
+
* @returns User operation receipt with transaction details
|
|
367
|
+
* @throws {Error} If insufficient total balance or transaction fails
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* const receipt = await sdk.getWallet().transferOverallFrontierDollar(
|
|
372
|
+
* '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
|
|
373
|
+
* '10.5'
|
|
374
|
+
* );
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
transferOverallFrontierDollar(to: string, amount: string, overrides?: GasOverrides): Promise<UserOperationReceipt>;
|
|
313
378
|
/**
|
|
314
379
|
* Execute multiple calls atomically with a single signature
|
|
315
380
|
*
|
|
@@ -1501,4 +1566,4 @@ interface SDKResponse {
|
|
|
1501
1566
|
error?: string;
|
|
1502
1567
|
}
|
|
1503
1568
|
|
|
1504
|
-
export { type App, type AppPermission, type AppStatus, ChainAccess, type ChainConfig, type CreateAppRequest, type CreateSponsorPassRequest, type CreateWebhookRequest, type Developer, type ExecuteCall, FrontierSDK, type GasOverrides, type ListParams, type ListSponsorsParams, type PaginatedResponse, PartnershipsAccess, type ReferralDetails, type ReferralOverview, type RotateKeyResponse, type RotateWebhookKeyResponse, type SDKRequest, type SDKResponse, type SmartAccount, type Sponsor, type SponsorPass, StorageAccess, type SwapParams, type SwapQuote, type SwapResult, SwapResultStatus, ThirdPartyAccess, type UpdateAppRequest, type UpdateDeveloperRequest, type UpdateWebhookRequest, type User, UserAccess, type UserContact, type UserContactPayload, type UserOperationReceipt, type UserProfile, WalletAccess, type Webhook, type WebhookConfig, type WebhookEvent, type WebhookScope, type WebhookStatus };
|
|
1569
|
+
export { type App, type AppPermission, type AppStatus, ChainAccess, type ChainConfig, type CreateAppRequest, type CreateSponsorPassRequest, type CreateWebhookRequest, type Developer, type ExecuteCall, FrontierSDK, type GasOverrides, type ListParams, type ListSponsorsParams, type PaginatedResponse, PartnershipsAccess, type ReferralDetails, type ReferralOverview, type RotateKeyResponse, type RotateWebhookKeyResponse, type SDKRequest, type SDKResponse, type SmartAccount, type Sponsor, type SponsorPass, StorageAccess, type SwapParams, type SwapQuote, type SwapResult, SwapResultStatus, ThirdPartyAccess, type UpdateAppRequest, type UpdateDeveloperRequest, type UpdateWebhookRequest, type User, UserAccess, type UserContact, type UserContactPayload, type UserOperationReceipt, type UserProfile, WalletAccess, type WalletBalance, type WalletBalanceFormatted, type Webhook, type WebhookConfig, type WebhookEvent, type WebhookScope, type WebhookStatus };
|
package/dist/index.js
CHANGED
|
@@ -46,18 +46,19 @@ var WalletAccess = class {
|
|
|
46
46
|
this.sdk = sdk;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* Get the current wallet balance
|
|
49
|
+
* Get the current wallet balance breakdown
|
|
50
50
|
*
|
|
51
|
-
* Returns the
|
|
52
|
-
*
|
|
51
|
+
* Returns the balance breakdown including total, native FTD,
|
|
52
|
+
* and internal FTD amounts.
|
|
53
53
|
*
|
|
54
|
-
* @returns Balance
|
|
54
|
+
* @returns Balance breakdown object
|
|
55
55
|
* @throws {Error} If no wallet exists
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
58
|
* ```typescript
|
|
59
59
|
* const balance = await sdk.getWallet().getBalance();
|
|
60
|
-
* console.log('Balance:', balance.toString());
|
|
60
|
+
* console.log('Total Balance:', balance.total.toString());
|
|
61
|
+
* console.log('FTD Balance:', balance.ftd.toString());
|
|
61
62
|
* ```
|
|
62
63
|
*/
|
|
63
64
|
async getBalance() {
|
|
@@ -66,16 +67,16 @@ var WalletAccess = class {
|
|
|
66
67
|
/**
|
|
67
68
|
* Get the current wallet balance formatted for display
|
|
68
69
|
*
|
|
69
|
-
* Returns the
|
|
70
|
-
* with currency symbol (e.g., '$10.50').
|
|
70
|
+
* Returns the balance breakdown as formatted strings
|
|
71
|
+
* with currency symbol (e.g., { total: '$10.50', ... }).
|
|
71
72
|
*
|
|
72
|
-
* @returns Formatted balance
|
|
73
|
+
* @returns Formatted balance breakdown object
|
|
73
74
|
* @throws {Error} If no wallet exists
|
|
74
75
|
*
|
|
75
76
|
* @example
|
|
76
77
|
* ```typescript
|
|
77
78
|
* const balance = await sdk.getWallet().getBalanceFormatted();
|
|
78
|
-
* console.log('
|
|
79
|
+
* console.log('Total:', balance.total); // '$10.50'
|
|
79
80
|
* ```
|
|
80
81
|
*/
|
|
81
82
|
async getBalanceFormatted() {
|
|
@@ -271,6 +272,60 @@ var WalletAccess = class {
|
|
|
271
272
|
overrides
|
|
272
273
|
});
|
|
273
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* Transfer Internal Frontier Dollars to another address
|
|
277
|
+
*
|
|
278
|
+
* Sends Internal Frontier Dollars (for Network Society spending) to a recipient address.
|
|
279
|
+
* Requires biometric authentication and sufficient balance.
|
|
280
|
+
*
|
|
281
|
+
* @param to - Recipient address
|
|
282
|
+
* @param amount - Amount to send (as string, e.g., '10.5' for 10.5 Frontier Dollars)
|
|
283
|
+
* @param overrides - Optional gas overrides
|
|
284
|
+
* @returns User operation receipt with transaction details
|
|
285
|
+
* @throws {Error} If insufficient balance or transaction fails
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* const receipt = await sdk.getWallet().transferInternalFrontierDollar(
|
|
290
|
+
* '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
|
|
291
|
+
* '10.5' // 10.5 Internal Frontier Dollars
|
|
292
|
+
* );
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
async transferInternalFrontierDollar(to, amount, overrides) {
|
|
296
|
+
return this.sdk.request("wallet:transferInternalFrontierDollar", {
|
|
297
|
+
to,
|
|
298
|
+
amount,
|
|
299
|
+
overrides
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Transfer Frontier Dollars with Internal Frontier Dollars (iFTD) preferred
|
|
304
|
+
*
|
|
305
|
+
* This method will use Internal Frontier Dollars first, and if insufficient,
|
|
306
|
+
* it will use regular Frontier Dollars to complete the transfer.
|
|
307
|
+
*
|
|
308
|
+
* @param to - Recipient address
|
|
309
|
+
* @param amount - Amount to send (as string, e.g., '10.5')
|
|
310
|
+
* @param overrides - Optional gas overrides
|
|
311
|
+
* @returns User operation receipt with transaction details
|
|
312
|
+
* @throws {Error} If insufficient total balance or transaction fails
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* ```typescript
|
|
316
|
+
* const receipt = await sdk.getWallet().transferOverallFrontierDollar(
|
|
317
|
+
* '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
|
|
318
|
+
* '10.5'
|
|
319
|
+
* );
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
async transferOverallFrontierDollar(to, amount, overrides) {
|
|
323
|
+
return this.sdk.request("wallet:transferOverallFrontierDollar", {
|
|
324
|
+
to,
|
|
325
|
+
amount,
|
|
326
|
+
overrides
|
|
327
|
+
});
|
|
328
|
+
}
|
|
274
329
|
/**
|
|
275
330
|
* Execute multiple calls atomically with a single signature
|
|
276
331
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -16,18 +16,19 @@ var WalletAccess = class {
|
|
|
16
16
|
this.sdk = sdk;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Get the current wallet balance
|
|
19
|
+
* Get the current wallet balance breakdown
|
|
20
20
|
*
|
|
21
|
-
* Returns the
|
|
22
|
-
*
|
|
21
|
+
* Returns the balance breakdown including total, native FTD,
|
|
22
|
+
* and internal FTD amounts.
|
|
23
23
|
*
|
|
24
|
-
* @returns Balance
|
|
24
|
+
* @returns Balance breakdown object
|
|
25
25
|
* @throws {Error} If no wallet exists
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* ```typescript
|
|
29
29
|
* const balance = await sdk.getWallet().getBalance();
|
|
30
|
-
* console.log('Balance:', balance.toString());
|
|
30
|
+
* console.log('Total Balance:', balance.total.toString());
|
|
31
|
+
* console.log('FTD Balance:', balance.ftd.toString());
|
|
31
32
|
* ```
|
|
32
33
|
*/
|
|
33
34
|
async getBalance() {
|
|
@@ -36,16 +37,16 @@ var WalletAccess = class {
|
|
|
36
37
|
/**
|
|
37
38
|
* Get the current wallet balance formatted for display
|
|
38
39
|
*
|
|
39
|
-
* Returns the
|
|
40
|
-
* with currency symbol (e.g., '$10.50').
|
|
40
|
+
* Returns the balance breakdown as formatted strings
|
|
41
|
+
* with currency symbol (e.g., { total: '$10.50', ... }).
|
|
41
42
|
*
|
|
42
|
-
* @returns Formatted balance
|
|
43
|
+
* @returns Formatted balance breakdown object
|
|
43
44
|
* @throws {Error} If no wallet exists
|
|
44
45
|
*
|
|
45
46
|
* @example
|
|
46
47
|
* ```typescript
|
|
47
48
|
* const balance = await sdk.getWallet().getBalanceFormatted();
|
|
48
|
-
* console.log('
|
|
49
|
+
* console.log('Total:', balance.total); // '$10.50'
|
|
49
50
|
* ```
|
|
50
51
|
*/
|
|
51
52
|
async getBalanceFormatted() {
|
|
@@ -241,6 +242,60 @@ var WalletAccess = class {
|
|
|
241
242
|
overrides
|
|
242
243
|
});
|
|
243
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Transfer Internal Frontier Dollars to another address
|
|
247
|
+
*
|
|
248
|
+
* Sends Internal Frontier Dollars (for Network Society spending) to a recipient address.
|
|
249
|
+
* Requires biometric authentication and sufficient balance.
|
|
250
|
+
*
|
|
251
|
+
* @param to - Recipient address
|
|
252
|
+
* @param amount - Amount to send (as string, e.g., '10.5' for 10.5 Frontier Dollars)
|
|
253
|
+
* @param overrides - Optional gas overrides
|
|
254
|
+
* @returns User operation receipt with transaction details
|
|
255
|
+
* @throws {Error} If insufficient balance or transaction fails
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```typescript
|
|
259
|
+
* const receipt = await sdk.getWallet().transferInternalFrontierDollar(
|
|
260
|
+
* '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
|
|
261
|
+
* '10.5' // 10.5 Internal Frontier Dollars
|
|
262
|
+
* );
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
async transferInternalFrontierDollar(to, amount, overrides) {
|
|
266
|
+
return this.sdk.request("wallet:transferInternalFrontierDollar", {
|
|
267
|
+
to,
|
|
268
|
+
amount,
|
|
269
|
+
overrides
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Transfer Frontier Dollars with Internal Frontier Dollars (iFTD) preferred
|
|
274
|
+
*
|
|
275
|
+
* This method will use Internal Frontier Dollars first, and if insufficient,
|
|
276
|
+
* it will use regular Frontier Dollars to complete the transfer.
|
|
277
|
+
*
|
|
278
|
+
* @param to - Recipient address
|
|
279
|
+
* @param amount - Amount to send (as string, e.g., '10.5')
|
|
280
|
+
* @param overrides - Optional gas overrides
|
|
281
|
+
* @returns User operation receipt with transaction details
|
|
282
|
+
* @throws {Error} If insufficient total balance or transaction fails
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```typescript
|
|
286
|
+
* const receipt = await sdk.getWallet().transferOverallFrontierDollar(
|
|
287
|
+
* '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
|
|
288
|
+
* '10.5'
|
|
289
|
+
* );
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
async transferOverallFrontierDollar(to, amount, overrides) {
|
|
293
|
+
return this.sdk.request("wallet:transferOverallFrontierDollar", {
|
|
294
|
+
to,
|
|
295
|
+
amount,
|
|
296
|
+
overrides
|
|
297
|
+
});
|
|
298
|
+
}
|
|
244
299
|
/**
|
|
245
300
|
* Execute multiple calls atomically with a single signature
|
|
246
301
|
*
|