@frontiertower/frontier-sdk 0.7.0 → 0.10.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 +12 -4
- package/dist/{chunk-7VB6TETG.mjs → chunk-HCHF3YXU.mjs} +12 -4
- package/dist/index.d.mts +56 -12
- package/dist/index.d.ts +56 -12
- package/dist/index.js +41 -13
- package/dist/index.mjs +38 -10
- package/dist/ui-utils/index.d.mts +5 -1
- package/dist/ui-utils/index.d.ts +5 -1
- package/dist/ui-utils/index.js +13 -4
- package/dist/ui-utils/index.mjs +3 -1
- 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,7 @@ 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
|
|
53
61
|
- `wallet:executeCall` - Execute arbitrary contract calls
|
|
54
62
|
- `wallet:executeBatchCall` - Execute multiple contract calls atomically
|
|
55
63
|
- `wallet:getSupportedTokens` - Get list of supported tokens for swaps
|
|
@@ -106,10 +114,10 @@ Your app must declare required permissions in the Frontier app registry:
|
|
|
106
114
|
The SDK verifies that apps are running in legitimate Frontier Wallet instances. Allowed origins:
|
|
107
115
|
|
|
108
116
|
- `http://localhost:5173` (development)
|
|
109
|
-
- `https://sandbox.
|
|
110
|
-
- `https://alpha.
|
|
111
|
-
- `https://beta.
|
|
112
|
-
- `https://
|
|
117
|
+
- `https://sandbox.os.frontiertower.io`
|
|
118
|
+
- `https://alpha.os.frontiertower.io`
|
|
119
|
+
- `https://beta.os.frontiertower.io`
|
|
120
|
+
- `https://os.frontiertower.io` (production)
|
|
113
121
|
|
|
114
122
|
## Development
|
|
115
123
|
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
// src/ui-utils/detection.ts
|
|
2
|
+
var ALLOWED_ORIGINS = [
|
|
3
|
+
"http://localhost:5173",
|
|
4
|
+
"https://sandbox.os.frontiertower.io",
|
|
5
|
+
"https://alpha.os.frontiertower.io",
|
|
6
|
+
"https://beta.os.frontiertower.io",
|
|
7
|
+
"https://os.frontiertower.io"
|
|
8
|
+
];
|
|
2
9
|
function isInFrontierApp() {
|
|
3
10
|
return window.self !== window.top;
|
|
4
11
|
}
|
|
@@ -79,7 +86,7 @@ function renderStandaloneMessage(container, appName = "Frontier App") {
|
|
|
79
86
|
color: #4a5568;
|
|
80
87
|
line-height: 1.8;
|
|
81
88
|
">
|
|
82
|
-
<li>Visit <a href="https://
|
|
89
|
+
<li>Visit <a href="https://os.frontiertower.io" style="color: #667eea; text-decoration: underline; font-weight: 500;">os.frontiertower.io</a></li>
|
|
83
90
|
<li>Go to the App Store</li>
|
|
84
91
|
<li>Install this app</li>
|
|
85
92
|
</ol>
|
|
@@ -91,7 +98,7 @@ function renderStandaloneMessage(container, appName = "Frontier App") {
|
|
|
91
98
|
border-top: 1px solid #e2e8f0;
|
|
92
99
|
">
|
|
93
100
|
<a
|
|
94
|
-
href="https://
|
|
101
|
+
href="https://os.frontiertower.io"
|
|
95
102
|
style="
|
|
96
103
|
display: inline-block;
|
|
97
104
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
@@ -173,7 +180,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
173
180
|
color: #4a5568;
|
|
174
181
|
line-height: 1.8;
|
|
175
182
|
">
|
|
176
|
-
<li>Visit <a href="https://
|
|
183
|
+
<li>Visit <a href="https://os.frontiertower.io" style="color: #667eea; text-decoration: underline; font-weight: 500;">os.frontiertower.io</a></li>
|
|
177
184
|
<li>Go to the App Store</li>
|
|
178
185
|
<li>Install this app</li>
|
|
179
186
|
</ol>
|
|
@@ -185,7 +192,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
185
192
|
border-top: 1px solid #e2e8f0;
|
|
186
193
|
">
|
|
187
194
|
<a
|
|
188
|
-
href="https://
|
|
195
|
+
href="https://os.frontiertower.io"
|
|
189
196
|
style="
|
|
190
197
|
display: inline-block;
|
|
191
198
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
@@ -208,6 +215,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
208
215
|
}
|
|
209
216
|
|
|
210
217
|
export {
|
|
218
|
+
ALLOWED_ORIGINS,
|
|
211
219
|
isInFrontierApp,
|
|
212
220
|
getParentOrigin,
|
|
213
221
|
renderStandaloneMessage,
|
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,27 @@ 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>;
|
|
313
357
|
/**
|
|
314
358
|
* Execute multiple calls atomically with a single signature
|
|
315
359
|
*
|
|
@@ -1501,4 +1545,4 @@ interface SDKResponse {
|
|
|
1501
1545
|
error?: string;
|
|
1502
1546
|
}
|
|
1503
1547
|
|
|
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 };
|
|
1548
|
+
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,27 @@ 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>;
|
|
313
357
|
/**
|
|
314
358
|
* Execute multiple calls atomically with a single signature
|
|
315
359
|
*
|
|
@@ -1501,4 +1545,4 @@ interface SDKResponse {
|
|
|
1501
1545
|
error?: string;
|
|
1502
1546
|
}
|
|
1503
1547
|
|
|
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 };
|
|
1548
|
+
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,33 @@ 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
|
+
}
|
|
274
302
|
/**
|
|
275
303
|
* Execute multiple calls atomically with a single signature
|
|
276
304
|
*
|
|
@@ -1179,7 +1207,7 @@ function renderStandaloneMessage(container, appName = "Frontier App") {
|
|
|
1179
1207
|
color: #4a5568;
|
|
1180
1208
|
line-height: 1.8;
|
|
1181
1209
|
">
|
|
1182
|
-
<li>Visit <a href="https://
|
|
1210
|
+
<li>Visit <a href="https://os.frontiertower.io" style="color: #667eea; text-decoration: underline; font-weight: 500;">os.frontiertower.io</a></li>
|
|
1183
1211
|
<li>Go to the App Store</li>
|
|
1184
1212
|
<li>Install this app</li>
|
|
1185
1213
|
</ol>
|
|
@@ -1191,7 +1219,7 @@ function renderStandaloneMessage(container, appName = "Frontier App") {
|
|
|
1191
1219
|
border-top: 1px solid #e2e8f0;
|
|
1192
1220
|
">
|
|
1193
1221
|
<a
|
|
1194
|
-
href="https://
|
|
1222
|
+
href="https://os.frontiertower.io"
|
|
1195
1223
|
style="
|
|
1196
1224
|
display: inline-block;
|
|
1197
1225
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
@@ -1273,7 +1301,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
1273
1301
|
color: #4a5568;
|
|
1274
1302
|
line-height: 1.8;
|
|
1275
1303
|
">
|
|
1276
|
-
<li>Visit <a href="https://
|
|
1304
|
+
<li>Visit <a href="https://os.frontiertower.io" style="color: #667eea; text-decoration: underline; font-weight: 500;">os.frontiertower.io</a></li>
|
|
1277
1305
|
<li>Go to the App Store</li>
|
|
1278
1306
|
<li>Install this app</li>
|
|
1279
1307
|
</ol>
|
|
@@ -1285,7 +1313,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
1285
1313
|
border-top: 1px solid #e2e8f0;
|
|
1286
1314
|
">
|
|
1287
1315
|
<a
|
|
1288
|
-
href="https://
|
|
1316
|
+
href="https://os.frontiertower.io"
|
|
1289
1317
|
style="
|
|
1290
1318
|
display: inline-block;
|
|
1291
1319
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getParentOrigin,
|
|
4
4
|
isInFrontierApp,
|
|
5
5
|
renderStandaloneMessage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HCHF3YXU.mjs";
|
|
7
7
|
|
|
8
8
|
// src/access/wallet.ts
|
|
9
9
|
var SwapResultStatus = /* @__PURE__ */ ((SwapResultStatus2) => {
|
|
@@ -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,33 @@ 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
|
+
}
|
|
244
272
|
/**
|
|
245
273
|
* Execute multiple calls atomically with a single signature
|
|
246
274
|
*
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of allowed Frontier Wallet origins
|
|
3
|
+
*/
|
|
4
|
+
declare const ALLOWED_ORIGINS: string[];
|
|
1
5
|
/**
|
|
2
6
|
* Check if the app is running inside a Frontier Wallet iframe
|
|
3
7
|
* Simply checks if the window is embedded in an iframe
|
|
@@ -20,4 +24,4 @@ declare function renderStandaloneMessage(container: HTMLElement, appName?: strin
|
|
|
20
24
|
*/
|
|
21
25
|
declare function createStandaloneHTML(appName?: string): string;
|
|
22
26
|
|
|
23
|
-
export { createStandaloneHTML, getParentOrigin, isInFrontierApp, renderStandaloneMessage };
|
|
27
|
+
export { ALLOWED_ORIGINS, createStandaloneHTML, getParentOrigin, isInFrontierApp, renderStandaloneMessage };
|
package/dist/ui-utils/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of allowed Frontier Wallet origins
|
|
3
|
+
*/
|
|
4
|
+
declare const ALLOWED_ORIGINS: string[];
|
|
1
5
|
/**
|
|
2
6
|
* Check if the app is running inside a Frontier Wallet iframe
|
|
3
7
|
* Simply checks if the window is embedded in an iframe
|
|
@@ -20,4 +24,4 @@ declare function renderStandaloneMessage(container: HTMLElement, appName?: strin
|
|
|
20
24
|
*/
|
|
21
25
|
declare function createStandaloneHTML(appName?: string): string;
|
|
22
26
|
|
|
23
|
-
export { createStandaloneHTML, getParentOrigin, isInFrontierApp, renderStandaloneMessage };
|
|
27
|
+
export { ALLOWED_ORIGINS, createStandaloneHTML, getParentOrigin, isInFrontierApp, renderStandaloneMessage };
|
package/dist/ui-utils/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/ui-utils/index.ts
|
|
21
21
|
var ui_utils_exports = {};
|
|
22
22
|
__export(ui_utils_exports, {
|
|
23
|
+
ALLOWED_ORIGINS: () => ALLOWED_ORIGINS,
|
|
23
24
|
createStandaloneHTML: () => createStandaloneHTML,
|
|
24
25
|
getParentOrigin: () => getParentOrigin,
|
|
25
26
|
isInFrontierApp: () => isInFrontierApp,
|
|
@@ -28,6 +29,13 @@ __export(ui_utils_exports, {
|
|
|
28
29
|
module.exports = __toCommonJS(ui_utils_exports);
|
|
29
30
|
|
|
30
31
|
// src/ui-utils/detection.ts
|
|
32
|
+
var ALLOWED_ORIGINS = [
|
|
33
|
+
"http://localhost:5173",
|
|
34
|
+
"https://sandbox.os.frontiertower.io",
|
|
35
|
+
"https://alpha.os.frontiertower.io",
|
|
36
|
+
"https://beta.os.frontiertower.io",
|
|
37
|
+
"https://os.frontiertower.io"
|
|
38
|
+
];
|
|
31
39
|
function isInFrontierApp() {
|
|
32
40
|
return window.self !== window.top;
|
|
33
41
|
}
|
|
@@ -108,7 +116,7 @@ function renderStandaloneMessage(container, appName = "Frontier App") {
|
|
|
108
116
|
color: #4a5568;
|
|
109
117
|
line-height: 1.8;
|
|
110
118
|
">
|
|
111
|
-
<li>Visit <a href="https://
|
|
119
|
+
<li>Visit <a href="https://os.frontiertower.io" style="color: #667eea; text-decoration: underline; font-weight: 500;">os.frontiertower.io</a></li>
|
|
112
120
|
<li>Go to the App Store</li>
|
|
113
121
|
<li>Install this app</li>
|
|
114
122
|
</ol>
|
|
@@ -120,7 +128,7 @@ function renderStandaloneMessage(container, appName = "Frontier App") {
|
|
|
120
128
|
border-top: 1px solid #e2e8f0;
|
|
121
129
|
">
|
|
122
130
|
<a
|
|
123
|
-
href="https://
|
|
131
|
+
href="https://os.frontiertower.io"
|
|
124
132
|
style="
|
|
125
133
|
display: inline-block;
|
|
126
134
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
@@ -202,7 +210,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
202
210
|
color: #4a5568;
|
|
203
211
|
line-height: 1.8;
|
|
204
212
|
">
|
|
205
|
-
<li>Visit <a href="https://
|
|
213
|
+
<li>Visit <a href="https://os.frontiertower.io" style="color: #667eea; text-decoration: underline; font-weight: 500;">os.frontiertower.io</a></li>
|
|
206
214
|
<li>Go to the App Store</li>
|
|
207
215
|
<li>Install this app</li>
|
|
208
216
|
</ol>
|
|
@@ -214,7 +222,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
214
222
|
border-top: 1px solid #e2e8f0;
|
|
215
223
|
">
|
|
216
224
|
<a
|
|
217
|
-
href="https://
|
|
225
|
+
href="https://os.frontiertower.io"
|
|
218
226
|
style="
|
|
219
227
|
display: inline-block;
|
|
220
228
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
@@ -237,6 +245,7 @@ function createStandaloneHTML(appName = "Frontier App") {
|
|
|
237
245
|
}
|
|
238
246
|
// Annotate the CommonJS export names for ESM import in node:
|
|
239
247
|
0 && (module.exports = {
|
|
248
|
+
ALLOWED_ORIGINS,
|
|
240
249
|
createStandaloneHTML,
|
|
241
250
|
getParentOrigin,
|
|
242
251
|
isInFrontierApp,
|
package/dist/ui-utils/index.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ALLOWED_ORIGINS,
|
|
2
3
|
createStandaloneHTML,
|
|
3
4
|
getParentOrigin,
|
|
4
5
|
isInFrontierApp,
|
|
5
6
|
renderStandaloneMessage
|
|
6
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-HCHF3YXU.mjs";
|
|
7
8
|
export {
|
|
9
|
+
ALLOWED_ORIGINS,
|
|
8
10
|
createStandaloneHTML,
|
|
9
11
|
getParentOrigin,
|
|
10
12
|
isInFrontierApp,
|