@megaeth-labs/wallet-sdk 0.1.5 → 0.1.7

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 CHANGED
@@ -61,6 +61,8 @@ var getWalletUrl = (config) => {
61
61
  const params = [
62
62
  `network=${config.network}`,
63
63
  ...config.sponsorUrl ? [`sponsorUrl=${config.sponsorUrl}`] : [],
64
+ ...config.sponsorMode ? [`sponsorMode=${config.sponsorMode}`] : [],
65
+ ...config.sponsorToken ? [`sponsorToken=${config.sponsorToken}`] : [],
64
66
  ...config.debug ? [`debug=${config.debug}`] : [],
65
67
  ...config.logging ? [`logging=${config.logging}`] : []
66
68
  ];
@@ -158,6 +160,11 @@ var _Logger = class _Logger {
158
160
  _Logger.logLevel = "error";
159
161
  var Logger = _Logger;
160
162
 
163
+ // src/outbound-methods/authenticate.ts
164
+ var authenticate = async () => {
165
+ return state_default.remote.authenticate();
166
+ };
167
+
161
168
  // src/outbound-methods/balances.ts
162
169
  var balances = async (request) => {
163
170
  return state_default.remote.balances(request);
@@ -250,7 +257,8 @@ var outboundMethods = {
250
257
  balances,
251
258
  open,
252
259
  signData,
253
- getFromContract
260
+ getFromContract,
261
+ authenticate
254
262
  };
255
263
 
256
264
  // src/wallet.ts
package/dist/index.d.cts CHANGED
@@ -1,11 +1,15 @@
1
1
  type Network = 'mainnet' | 'testnet';
2
2
  type LogLevel = 'debug' | 'info' | 'warn' | 'error';
3
+ type SponsorMode = 'everything' | 'app-only' | 'explicit';
4
+ type SponsorToken = 'native' | 'usdm';
3
5
  interface Config {
4
6
  network: Network;
5
7
  logging?: LogLevel;
6
8
  devMode?: boolean;
7
9
  debug?: boolean;
8
10
  sponsorUrl?: string;
11
+ sponsorMode?: SponsorMode;
12
+ sponsorToken?: SponsorToken;
9
13
  }
10
14
  type ConnectionStatus = {
11
15
  status: 'connected' | 'disconnected' | 'cancelled';
@@ -17,6 +21,7 @@ interface TransferRequest {
17
21
  type: 'native' | 'erc20' | 'erc721' | 'erc1155';
18
22
  contractAddress?: string;
19
23
  tokenId?: number;
24
+ sponsor?: boolean;
20
25
  }
21
26
  interface CallContractRequest {
22
27
  address: `0x${string}`;
@@ -26,6 +31,7 @@ interface CallContractRequest {
26
31
  data?: `0x${string}`;
27
32
  silent?: boolean;
28
33
  value?: bigint | string;
34
+ sponsor?: boolean;
29
35
  }
30
36
  interface GetFromContractRequest {
31
37
  address: `0x${string}`;
@@ -45,6 +51,11 @@ interface SignMessageResponse {
45
51
  error?: string;
46
52
  signature?: `0x${string}`;
47
53
  }
54
+ interface AuthenticateResponse {
55
+ status: 'success' | 'cancelled' | 'error';
56
+ error?: string;
57
+ jwt?: string;
58
+ }
48
59
  interface GetPermissionsResponse {
49
60
  permissions?: {
50
61
  expiry: number;
@@ -76,6 +87,7 @@ interface RemoteAPI {
76
87
  balances: (request: BalancesRequest) => Promise<OwnedTokenResponse[]>;
77
88
  signData: (request: SignDataRequest) => Promise<SignDataResponse>;
78
89
  open: () => Promise<void>;
90
+ authenticate: () => Promise<AuthenticateResponse>;
79
91
  [key: string]: any;
80
92
  }
81
93
  interface Permission {
@@ -100,6 +112,7 @@ interface Permission {
100
112
  interface GrantPermissionsRequest {
101
113
  permissions: Permission;
102
114
  externalAddress?: `0x${string}`;
115
+ sponsor?: boolean;
103
116
  }
104
117
  type GrantPermissionsResponse = {
105
118
  status: 'approved' | 'cancelled';
@@ -149,10 +162,11 @@ declare const mega: {
149
162
  open: () => Promise<void>;
150
163
  signData: (request: SignDataRequest) => Promise<SignDataResponse>;
151
164
  getFromContract: <T>(request: GetFromContractRequest) => Promise<T>;
165
+ authenticate: () => Promise<AuthenticateResponse>;
152
166
  initialise: (config: Config) => Promise<ConnectionStatus | undefined>;
153
167
  events: {
154
168
  onStatusChange: (callback: (status: ConnectionStatus) => void) => void;
155
169
  };
156
170
  };
157
171
 
158
- export { type BalancesRequest, type BaseTokenResponse, type CallContractRequest, type Config, type ConnectionStatus, type GetFromContractRequest, type GetPermissionsResponse, type GrantPermissionsRequest, type GrantPermissionsResponse, type LogLevel, type Network, type OwnedTokenResponse, type Permission, type RemoteAPI, type SignDataRequest, type SignDataResponse, type SignMessageResponse, type TransactionResult, type TransferRequest, mega };
172
+ export { type AuthenticateResponse, type BalancesRequest, type BaseTokenResponse, type CallContractRequest, type Config, type ConnectionStatus, type GetFromContractRequest, type GetPermissionsResponse, type GrantPermissionsRequest, type GrantPermissionsResponse, type LogLevel, type Network, type OwnedTokenResponse, type Permission, type RemoteAPI, type SignDataRequest, type SignDataResponse, type SignMessageResponse, type SponsorMode, type SponsorToken, type TransactionResult, type TransferRequest, mega };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,15 @@
1
1
  type Network = 'mainnet' | 'testnet';
2
2
  type LogLevel = 'debug' | 'info' | 'warn' | 'error';
3
+ type SponsorMode = 'everything' | 'app-only' | 'explicit';
4
+ type SponsorToken = 'native' | 'usdm';
3
5
  interface Config {
4
6
  network: Network;
5
7
  logging?: LogLevel;
6
8
  devMode?: boolean;
7
9
  debug?: boolean;
8
10
  sponsorUrl?: string;
11
+ sponsorMode?: SponsorMode;
12
+ sponsorToken?: SponsorToken;
9
13
  }
10
14
  type ConnectionStatus = {
11
15
  status: 'connected' | 'disconnected' | 'cancelled';
@@ -17,6 +21,7 @@ interface TransferRequest {
17
21
  type: 'native' | 'erc20' | 'erc721' | 'erc1155';
18
22
  contractAddress?: string;
19
23
  tokenId?: number;
24
+ sponsor?: boolean;
20
25
  }
21
26
  interface CallContractRequest {
22
27
  address: `0x${string}`;
@@ -26,6 +31,7 @@ interface CallContractRequest {
26
31
  data?: `0x${string}`;
27
32
  silent?: boolean;
28
33
  value?: bigint | string;
34
+ sponsor?: boolean;
29
35
  }
30
36
  interface GetFromContractRequest {
31
37
  address: `0x${string}`;
@@ -45,6 +51,11 @@ interface SignMessageResponse {
45
51
  error?: string;
46
52
  signature?: `0x${string}`;
47
53
  }
54
+ interface AuthenticateResponse {
55
+ status: 'success' | 'cancelled' | 'error';
56
+ error?: string;
57
+ jwt?: string;
58
+ }
48
59
  interface GetPermissionsResponse {
49
60
  permissions?: {
50
61
  expiry: number;
@@ -76,6 +87,7 @@ interface RemoteAPI {
76
87
  balances: (request: BalancesRequest) => Promise<OwnedTokenResponse[]>;
77
88
  signData: (request: SignDataRequest) => Promise<SignDataResponse>;
78
89
  open: () => Promise<void>;
90
+ authenticate: () => Promise<AuthenticateResponse>;
79
91
  [key: string]: any;
80
92
  }
81
93
  interface Permission {
@@ -100,6 +112,7 @@ interface Permission {
100
112
  interface GrantPermissionsRequest {
101
113
  permissions: Permission;
102
114
  externalAddress?: `0x${string}`;
115
+ sponsor?: boolean;
103
116
  }
104
117
  type GrantPermissionsResponse = {
105
118
  status: 'approved' | 'cancelled';
@@ -149,10 +162,11 @@ declare const mega: {
149
162
  open: () => Promise<void>;
150
163
  signData: (request: SignDataRequest) => Promise<SignDataResponse>;
151
164
  getFromContract: <T>(request: GetFromContractRequest) => Promise<T>;
165
+ authenticate: () => Promise<AuthenticateResponse>;
152
166
  initialise: (config: Config) => Promise<ConnectionStatus | undefined>;
153
167
  events: {
154
168
  onStatusChange: (callback: (status: ConnectionStatus) => void) => void;
155
169
  };
156
170
  };
157
171
 
158
- export { type BalancesRequest, type BaseTokenResponse, type CallContractRequest, type Config, type ConnectionStatus, type GetFromContractRequest, type GetPermissionsResponse, type GrantPermissionsRequest, type GrantPermissionsResponse, type LogLevel, type Network, type OwnedTokenResponse, type Permission, type RemoteAPI, type SignDataRequest, type SignDataResponse, type SignMessageResponse, type TransactionResult, type TransferRequest, mega };
172
+ export { type AuthenticateResponse, type BalancesRequest, type BaseTokenResponse, type CallContractRequest, type Config, type ConnectionStatus, type GetFromContractRequest, type GetPermissionsResponse, type GrantPermissionsRequest, type GrantPermissionsResponse, type LogLevel, type Network, type OwnedTokenResponse, type Permission, type RemoteAPI, type SignDataRequest, type SignDataResponse, type SignMessageResponse, type SponsorMode, type SponsorToken, type TransactionResult, type TransferRequest, mega };
package/dist/index.js CHANGED
@@ -25,6 +25,8 @@ var getWalletUrl = (config) => {
25
25
  const params = [
26
26
  `network=${config.network}`,
27
27
  ...config.sponsorUrl ? [`sponsorUrl=${config.sponsorUrl}`] : [],
28
+ ...config.sponsorMode ? [`sponsorMode=${config.sponsorMode}`] : [],
29
+ ...config.sponsorToken ? [`sponsorToken=${config.sponsorToken}`] : [],
28
30
  ...config.debug ? [`debug=${config.debug}`] : [],
29
31
  ...config.logging ? [`logging=${config.logging}`] : []
30
32
  ];
@@ -122,6 +124,11 @@ var _Logger = class _Logger {
122
124
  _Logger.logLevel = "error";
123
125
  var Logger = _Logger;
124
126
 
127
+ // src/outbound-methods/authenticate.ts
128
+ var authenticate = async () => {
129
+ return state_default.remote.authenticate();
130
+ };
131
+
125
132
  // src/outbound-methods/balances.ts
126
133
  var balances = async (request) => {
127
134
  return state_default.remote.balances(request);
@@ -214,7 +221,8 @@ var outboundMethods = {
214
221
  balances,
215
222
  open,
216
223
  signData,
217
- getFromContract
224
+ getFromContract,
225
+ authenticate
218
226
  };
219
227
 
220
228
  // src/wallet.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megaeth-labs/wallet-sdk",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "MegaETH Wallet SDK for web applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",