@manahippo/aptos-wallet-adapter 0.1.17 → 0.1.20
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 +16 -16
- package/dist/WalletAdapters/AptosWallet.d.ts +8 -5
- package/dist/WalletAdapters/AptosWallet.d.ts.map +1 -1
- package/dist/WalletAdapters/AptosWallet.js +24 -27
- package/dist/WalletAdapters/AptosWallet.js.map +1 -1
- package/dist/WalletAdapters/BaseAdapter.d.ts +7 -3
- package/dist/WalletAdapters/BaseAdapter.d.ts.map +1 -1
- package/dist/WalletAdapters/BaseAdapter.js.map +1 -1
- package/dist/WalletAdapters/FewchaWallet.d.ts +4 -2
- package/dist/WalletAdapters/FewchaWallet.d.ts.map +1 -1
- package/dist/WalletAdapters/FewchaWallet.js +56 -54
- package/dist/WalletAdapters/FewchaWallet.js.map +1 -1
- package/dist/WalletAdapters/HippoExtensionWallet.d.ts +4 -2
- package/dist/WalletAdapters/HippoExtensionWallet.d.ts.map +1 -1
- package/dist/WalletAdapters/HippoExtensionWallet.js +1 -1
- package/dist/WalletAdapters/HippoExtensionWallet.js.map +1 -1
- package/dist/WalletAdapters/HippoWallet.d.ts +4 -2
- package/dist/WalletAdapters/HippoWallet.d.ts.map +1 -1
- package/dist/WalletAdapters/HippoWallet.js +2 -1
- package/dist/WalletAdapters/HippoWallet.js.map +1 -1
- package/dist/WalletAdapters/MartianWallet.d.ts +7 -4
- package/dist/WalletAdapters/MartianWallet.d.ts.map +1 -1
- package/dist/WalletAdapters/MartianWallet.js +23 -28
- package/dist/WalletAdapters/MartianWallet.js.map +1 -1
- package/dist/WalletAdapters/MultiMaskWallet.d.ts +4 -2
- package/dist/WalletAdapters/MultiMaskWallet.d.ts.map +1 -1
- package/dist/WalletAdapters/MultiMaskWallet.js +1 -1
- package/dist/WalletAdapters/MultiMaskWallet.js.map +1 -1
- package/dist/WalletAdapters/NightlyWallet.d.ts +0 -41
- package/dist/WalletAdapters/NightlyWallet.d.ts.map +1 -1
- package/dist/WalletAdapters/NightlyWallet.js +229 -199
- package/dist/WalletAdapters/NightlyWallet.js.map +1 -1
- package/dist/WalletAdapters/index.d.ts +0 -1
- package/dist/WalletAdapters/index.d.ts.map +1 -1
- package/dist/WalletAdapters/index.js +1 -1
- package/dist/WalletAdapters/index.js.map +1 -1
- package/dist/WalletProviders/WalletProvider.d.ts.map +1 -1
- package/dist/WalletProviders/WalletProvider.js.map +1 -1
- package/dist/WalletProviders/useWallet.d.ts +4 -2
- package/dist/WalletProviders/useWallet.d.ts.map +1 -1
- package/dist/WalletProviders/useWallet.js.map +1 -1
- package/dist/config/aptosConstants.d.ts +2 -2
- package/dist/config/aptosConstants.d.ts.map +1 -1
- package/dist/config/aptosConstants.js +1 -1
- package/dist/config/aptosConstants.js.map +1 -1
- package/dist/utilities/util.d.ts +8 -0
- package/dist/utilities/util.d.ts.map +1 -0
- package/dist/utilities/util.js +14 -0
- package/dist/utilities/util.js.map +1 -0
- package/package.json +3 -3
- package/src/WalletAdapters/AptosWallet.ts +31 -32
- package/src/WalletAdapters/BaseAdapter.ts +7 -5
- package/src/WalletAdapters/FewchaWallet.ts +67 -69
- package/src/WalletAdapters/HippoExtensionWallet.ts +7 -5
- package/src/WalletAdapters/HippoWallet.ts +8 -6
- package/src/WalletAdapters/MartianWallet.ts +36 -35
- package/src/WalletAdapters/MultiMaskWallet.ts +9 -7
- package/src/WalletAdapters/NightlyWallet.ts +229 -229
- package/src/WalletAdapters/index.ts +1 -1
- package/src/WalletProviders/WalletProvider.tsx +1 -2
- package/src/WalletProviders/useWallet.ts +4 -5
- package/src/config/aptosConstants.ts +1 -1
- package/src/utilities/util.ts +11 -0
@@ -1,260 +1,260 @@
|
|
1
|
-
import { TxnBuilderTypes, BCS } from 'aptos';
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
} from 'aptos/dist/api/data-contracts';
|
8
|
-
import {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
} from 'aptos/dist/transaction_builder/aptos_types';
|
14
|
-
import { bcsSerializeUint64, bcsToBytes, Seq } from 'aptos/dist/transaction_builder/bcs';
|
15
|
-
import { aptosClient } from '../config/aptosConstants';
|
16
|
-
import {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
} from '../WalletProviders/errors';
|
22
|
-
import {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
} from './BaseAdapter';
|
1
|
+
// import { TxnBuilderTypes, BCS } from 'aptos';
|
2
|
+
// import {
|
3
|
+
// PendingTransaction,
|
4
|
+
// ScriptFunctionPayload,
|
5
|
+
// SubmitTransactionRequest,
|
6
|
+
// TransactionPayload
|
7
|
+
// } from 'aptos/dist/api/data-contracts';
|
8
|
+
// import {
|
9
|
+
// ScriptFunction,
|
10
|
+
// StructTag,
|
11
|
+
// TransactionPayloadScriptFunction,
|
12
|
+
// TypeTagStruct
|
13
|
+
// } from 'aptos/dist/transaction_builder/aptos_types';
|
14
|
+
// import { bcsSerializeUint64, bcsToBytes, Seq } from 'aptos/dist/transaction_builder/bcs';
|
15
|
+
// import { aptosClient } from '../config/aptosConstants';
|
16
|
+
// import {
|
17
|
+
// WalletDisconnectionError,
|
18
|
+
// WalletNotConnectedError,
|
19
|
+
// WalletNotReadyError,
|
20
|
+
// WalletSignTransactionError
|
21
|
+
// } from '../WalletProviders/errors';
|
22
|
+
// import {
|
23
|
+
// AccountKeys,
|
24
|
+
// Address,
|
25
|
+
// AuthKey,
|
26
|
+
// BaseWalletAdapter,
|
27
|
+
// PublicKey,
|
28
|
+
// scopePollingDetectionStrategy,
|
29
|
+
// WalletName,
|
30
|
+
// WalletReadyState
|
31
|
+
// } from './BaseAdapter';
|
32
32
|
|
33
|
-
interface INightlyWallet {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
33
|
+
// interface INightlyWallet {
|
34
|
+
// requestId: number;
|
35
|
+
// connect: (onDisconnect?: () => void, eager?: boolean) => Promise<any>;
|
36
|
+
// account: () => Promise<string>;
|
37
|
+
// isConnected: () => Promise<boolean>;
|
38
|
+
// signAndSubmitTransaction(transaction: any): Promise<void>;
|
39
|
+
// signTransaction(transaction: any): Promise<any>;
|
40
|
+
// disconnect(): Promise<void>;
|
41
|
+
// }
|
42
42
|
|
43
|
-
interface NightlyWindow extends Window {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}
|
43
|
+
// interface NightlyWindow extends Window {
|
44
|
+
// nightly?: {
|
45
|
+
// aptos: INightlyWallet;
|
46
|
+
// };
|
47
|
+
// }
|
48
48
|
|
49
|
-
declare const window: NightlyWindow;
|
49
|
+
// declare const window: NightlyWindow;
|
50
50
|
|
51
|
-
export const NightlyWalletName = 'Nightly Wallet' as WalletName<'Nightly Wallet'>;
|
51
|
+
// export const NightlyWalletName = 'Nightly Wallet' as WalletName<'Nightly Wallet'>;
|
52
52
|
|
53
|
-
export interface NightlyWalletAdapterConfig {
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
53
|
+
// export interface NightlyWalletAdapterConfig {
|
54
|
+
// provider?: INightlyWallet;
|
55
|
+
// // network?: WalletAdapterNetwork;
|
56
|
+
// timeout?: number;
|
57
|
+
// }
|
58
58
|
|
59
|
-
export class NightlyWalletAdapter extends BaseWalletAdapter {
|
60
|
-
|
59
|
+
// export class NightlyWalletAdapter extends BaseWalletAdapter {
|
60
|
+
// name = NightlyWalletName;
|
61
61
|
|
62
|
-
|
63
|
-
|
62
|
+
// url =
|
63
|
+
// 'https://chrome.google.com/webstore/detail/nightly/injggoambcadlfkkjcgdfbejanmgfgfm/related?hl=en&authuser=0';
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
// icon =
|
66
|
+
// 'https://lh3.googleusercontent.com/Ha38j09tA-70EiZ17pculpj1KUKDP07ytX4DJx_fumDfod_X2nRTiUg2Y9tDwRBs5jDj-gu52hwaPYVPgq1xAuFA1Q=w128-h128-e365-rj-sc0x00ffffff';
|
67
67
|
|
68
|
-
|
68
|
+
// protected _provider: INightlyWallet | undefined;
|
69
69
|
|
70
|
-
|
71
|
-
|
70
|
+
// // protected _network: WalletAdapterNetwork;
|
71
|
+
// protected _timeout: number;
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
// protected _readyState: WalletReadyState =
|
74
|
+
// typeof window === 'undefined' || typeof document === 'undefined'
|
75
|
+
// ? WalletReadyState.Unsupported
|
76
|
+
// : WalletReadyState.NotDetected;
|
77
77
|
|
78
|
-
|
78
|
+
// protected _connecting: boolean;
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
80
|
+
// protected _wallet: {
|
81
|
+
// publicKey?: string;
|
82
|
+
// address?: string;
|
83
|
+
// authKey?: string;
|
84
|
+
// isConnected: boolean;
|
85
|
+
// } | null;
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
87
|
+
// constructor({
|
88
|
+
// // provider,
|
89
|
+
// // network = WalletAdapterNetwork.Mainnet,
|
90
|
+
// timeout = 10000
|
91
|
+
// }: NightlyWalletAdapterConfig = {}) {
|
92
|
+
// super();
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
94
|
+
// this._provider = window.nightly?.aptos;
|
95
|
+
// // this._network = network;
|
96
|
+
// this._timeout = timeout;
|
97
|
+
// this._connecting = false;
|
98
|
+
// this._wallet = null;
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
100
|
+
// if (this._readyState !== WalletReadyState.Unsupported) {
|
101
|
+
// scopePollingDetectionStrategy(() => {
|
102
|
+
// if (window.nightly?.aptos) {
|
103
|
+
// this._readyState = WalletReadyState.Installed;
|
104
|
+
// this.emit('readyStateChange', this._readyState);
|
105
|
+
// return true;
|
106
|
+
// }
|
107
|
+
// return false;
|
108
|
+
// });
|
109
|
+
// }
|
110
|
+
// }
|
111
111
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
112
|
+
// get publicAccount(): AccountKeys {
|
113
|
+
// return {
|
114
|
+
// publicKey: this._wallet?.publicKey || null,
|
115
|
+
// address: this._wallet?.address || null,
|
116
|
+
// authKey: this._wallet?.authKey || null
|
117
|
+
// };
|
118
|
+
// }
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
// get connecting(): boolean {
|
121
|
+
// return this._connecting;
|
122
|
+
// }
|
123
123
|
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
// get connected(): boolean {
|
125
|
+
// return !!this._wallet?.isConnected;
|
126
|
+
// }
|
127
127
|
|
128
|
-
|
129
|
-
|
130
|
-
|
128
|
+
// get readyState(): WalletReadyState {
|
129
|
+
// return this._readyState;
|
130
|
+
// }
|
131
131
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
132
|
+
// async connect(): Promise<void> {
|
133
|
+
// try {
|
134
|
+
// if (this.connected || this.connecting) return;
|
135
|
+
// if (
|
136
|
+
// !(
|
137
|
+
// this._readyState === WalletReadyState.Loadable ||
|
138
|
+
// this._readyState === WalletReadyState.Installed
|
139
|
+
// )
|
140
|
+
// )
|
141
|
+
// throw new WalletNotReadyError();
|
142
|
+
// this._connecting = true;
|
143
143
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
144
|
+
// const provider = this._provider || window.nightly?.aptos;
|
145
|
+
// const publicKey = await provider?.connect(() => {
|
146
|
+
// console.log('Trigger disconnect Aptos');
|
147
|
+
// });
|
148
|
+
// this._wallet = {
|
149
|
+
// publicKey: publicKey?.asString(),
|
150
|
+
// address: publicKey?.address(),
|
151
|
+
// isConnected: true
|
152
|
+
// };
|
153
153
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
154
|
+
// this.emit('connect', this._wallet.publicKey || '');
|
155
|
+
// } catch (error: any) {
|
156
|
+
// this.emit('error', error);
|
157
|
+
// throw error;
|
158
|
+
// } finally {
|
159
|
+
// this._connecting = false;
|
160
|
+
// }
|
161
|
+
// }
|
162
162
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
163
|
+
// async disconnect(): Promise<void> {
|
164
|
+
// const wallet = this._wallet;
|
165
|
+
// if (wallet) {
|
166
|
+
// this._wallet = null;
|
167
167
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
168
|
+
// try {
|
169
|
+
// const provider = this._provider || window.nightly?.aptos;
|
170
|
+
// await provider?.disconnect();
|
171
|
+
// } catch (error: any) {
|
172
|
+
// this.emit('error', new WalletDisconnectionError(error?.message, error));
|
173
|
+
// }
|
174
|
+
// }
|
175
175
|
|
176
|
-
|
177
|
-
|
176
|
+
// this.emit('disconnect');
|
177
|
+
// }
|
178
178
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
179
|
+
// async signTransaction(transaction: TransactionPayload): Promise<SubmitTransactionRequest> {
|
180
|
+
// try {
|
181
|
+
// const wallet = this._wallet;
|
182
|
+
// if (!wallet) throw new WalletNotConnectedError();
|
183
183
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
184
|
+
// try {
|
185
|
+
// const provider = this._provider || window.nightly?.aptos;
|
186
|
+
// const response = await provider?.signTransaction(transaction);
|
187
|
+
// if (response) {
|
188
|
+
// return response;
|
189
|
+
// } else {
|
190
|
+
// throw new Error('Transaction failed');
|
191
|
+
// }
|
192
|
+
// } catch (error: any) {
|
193
|
+
// throw new WalletSignTransactionError(error?.message, error);
|
194
|
+
// }
|
195
|
+
// } catch (error: any) {
|
196
|
+
// this.emit('error', error);
|
197
|
+
// throw error;
|
198
|
+
// }
|
199
|
+
// }
|
200
200
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
201
|
+
// async signAndSubmitTransaction(tempTransaction: TransactionPayload): Promise<PendingTransaction> {
|
202
|
+
// try {
|
203
|
+
// const wallet = this._wallet;
|
204
|
+
// if (!wallet) throw new WalletNotConnectedError();
|
205
205
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
206
|
+
// try {
|
207
|
+
// const provider = this._provider || window.nightly?.aptos;
|
208
|
+
// const client = aptosClient;
|
209
|
+
// const [{ sequence_number: sequnceNumber }, chainId] = await Promise.all([
|
210
|
+
// client.getAccount(wallet.address || ''),
|
211
|
+
// client.getChainId()
|
212
|
+
// ]);
|
213
|
+
// const transaction = tempTransaction as ScriptFunctionPayload;
|
214
|
+
// const [txAddress, module, funcName] = transaction.function.split('::');
|
215
|
+
// const token = new TypeTagStruct(StructTag.fromString(transaction.type_arguments[0]));
|
216
|
+
// const argts = transaction.arguments.map((arg) => {
|
217
|
+
// if (typeof arg === 'string') {
|
218
|
+
// return bcsSerializeUint64(parseInt(arg));
|
219
|
+
// } else if (typeof arg === 'boolean') {
|
220
|
+
// const serializer = new BCS.Serializer();
|
221
|
+
// serializer.serializeBool(arg);
|
222
|
+
// return serializer.getBytes();
|
223
|
+
// } else if (typeof arg === 'number') {
|
224
|
+
// return bcsSerializeUint64(arg);
|
225
|
+
// } else {
|
226
|
+
// return arg;
|
227
|
+
// }
|
228
|
+
// });
|
229
|
+
// console.log('txnpayload>>', transaction.arguments, argts);
|
230
|
+
// const txnPayload = new TransactionPayloadScriptFunction(
|
231
|
+
// ScriptFunction.natural(`${txAddress}::${module}`, funcName, [token], [...argts])
|
232
|
+
// );
|
233
233
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
}
|
234
|
+
// const rawTxn = new TxnBuilderTypes.RawTransaction(
|
235
|
+
// TxnBuilderTypes.AccountAddress.fromHex(wallet.address || ''),
|
236
|
+
// BigInt(sequnceNumber),
|
237
|
+
// txnPayload,
|
238
|
+
// BigInt(1000),
|
239
|
+
// BigInt(1),
|
240
|
+
// BigInt(Math.floor(Date.now() / 1000) + 10),
|
241
|
+
// new TxnBuilderTypes.ChainId(chainId)
|
242
|
+
// );
|
243
|
+
// const bcsTxn = await provider?.signTransaction(rawTxn);
|
244
|
+
// const response = await aptosClient.submitSignedBCSTransaction(bcsTxn);
|
245
|
+
// if (response) {
|
246
|
+
// console.log('tx response>>>', response);
|
247
|
+
// return response;
|
248
|
+
// } else {
|
249
|
+
// throw new Error('Transaction failed');
|
250
|
+
// }
|
251
|
+
// } catch (error: any) {
|
252
|
+
// const errMsg = error instanceof Error ? error.message : error.response.data.message;
|
253
|
+
// throw new WalletSignTransactionError(errMsg);
|
254
|
+
// }
|
255
|
+
// } catch (error: any) {
|
256
|
+
// this.emit('error', error);
|
257
|
+
// throw error;
|
258
|
+
// }
|
259
|
+
// }
|
260
|
+
// }
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { TransactionPayload } from 'aptos/dist/api/data-contracts';
|
2
1
|
import { useLocalStorage } from '../hooks/useLocalStorage';
|
3
2
|
import { FC, ReactNode, useCallback, useEffect, useRef, useState } from 'react';
|
4
3
|
import {
|
@@ -9,12 +8,12 @@ import {
|
|
9
8
|
} from './errors';
|
10
9
|
import {
|
11
10
|
AccountKeys,
|
12
|
-
PublicKey,
|
13
11
|
WalletAdapter,
|
14
12
|
WalletName,
|
15
13
|
WalletReadyState
|
16
14
|
} from '../WalletAdapters/BaseAdapter';
|
17
15
|
import { Wallet, WalletContext } from './useWallet';
|
16
|
+
import { TransactionPayload } from 'aptos/dist/generated';
|
18
17
|
|
19
18
|
export interface WalletProviderProps {
|
20
19
|
children: ReactNode;
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import {
|
2
|
-
|
2
|
+
TransactionPayload,
|
3
3
|
SubmitTransactionRequest,
|
4
|
-
|
5
|
-
} from 'aptos/dist/
|
4
|
+
HexEncodedBytes
|
5
|
+
} from 'aptos/dist/generated';
|
6
6
|
import { createContext, useContext } from 'react';
|
7
7
|
import {
|
8
8
|
AccountKeys,
|
9
|
-
PublicKey,
|
10
9
|
WalletAdapter,
|
11
10
|
WalletName,
|
12
11
|
WalletReadyState
|
@@ -32,7 +31,7 @@ export interface WalletContextState {
|
|
32
31
|
transaction: TransactionPayload
|
33
32
|
// connection: Connection,
|
34
33
|
// options?: SendTransactionOptions
|
35
|
-
): Promise<
|
34
|
+
): Promise<{ hash: HexEncodedBytes }>;
|
36
35
|
|
37
36
|
signTransaction(transaction: TransactionPayload): Promise<SubmitTransactionRequest>;
|
38
37
|
// signAllTransactions: SignerWalletAdapterProps['signAllTransactions'] | undefined;
|
@@ -4,7 +4,7 @@ export const WEBWALLET_URL = 'https://hippo-wallet-test.web.app';
|
|
4
4
|
// export const WEBWALLET_URL = 'http://localhost:3030';
|
5
5
|
|
6
6
|
export const LOCAL_NODE_URL = 'http://127.0.0.1:8080';
|
7
|
-
export const DEVNET_NODE_URL = 'https://fullnode.devnet.aptoslabs.com';
|
7
|
+
export const DEVNET_NODE_URL = 'https://fullnode.devnet.aptoslabs.com/v1';
|
8
8
|
export const LOCAL_FAUCET_URL = 'http://127.0.0.1:8000';
|
9
9
|
export const DEVNET_FAUCET_URL = 'https://faucet.devnet.aptoslabs.com';
|
10
10
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { TransactionPayload, TransactionPayload_ScriptFunctionPayload } from 'aptos/dist/generated';
|
2
|
+
|
3
|
+
export const payloadV1ToV0 = (payload: TransactionPayload) => {
|
4
|
+
const v1 = payload as TransactionPayload_ScriptFunctionPayload;
|
5
|
+
return {
|
6
|
+
type: 'script_function_payload',
|
7
|
+
function: v1.function,
|
8
|
+
type_arguments: v1.type_arguments,
|
9
|
+
arguments: v1.arguments
|
10
|
+
};
|
11
|
+
};
|