@wormhole-foundation/sdk-algorand-core 0.5.0-alpha.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/dist/cjs/core.d.ts +57 -0
- package/dist/cjs/core.d.ts.map +1 -0
- package/dist/cjs/core.js +292 -0
- package/dist/cjs/core.js.map +1 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +22 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/storage.d.ts +56 -0
- package/dist/cjs/storage.d.ts.map +1 -0
- package/dist/cjs/storage.js +237 -0
- package/dist/cjs/storage.js.map +1 -0
- package/dist/esm/core.d.ts +57 -0
- package/dist/esm/core.d.ts.map +1 -0
- package/dist/esm/core.js +288 -0
- package/dist/esm/core.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/storage.d.ts +56 -0
- package/dist/esm/storage.d.ts.map +1 -0
- package/dist/esm/storage.js +234 -0
- package/dist/esm/storage.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Chain, TokenId, WormholeMessageId } from "@wormhole-foundation/sdk-connect";
|
|
2
|
+
import { Algodv2, LogicSigAccount } from "algosdk";
|
|
3
|
+
export declare const SEED_AMT: number;
|
|
4
|
+
export declare const MAX_KEYS: number;
|
|
5
|
+
export declare const MAX_BYTES_PER_KEY: number;
|
|
6
|
+
export declare const BITS_PER_BYTE: number;
|
|
7
|
+
export declare const BITS_PER_KEY: number;
|
|
8
|
+
export declare const MAX_BYTES: number;
|
|
9
|
+
export declare const MAX_BITS: number;
|
|
10
|
+
export interface PopulateData {
|
|
11
|
+
appId: bigint;
|
|
12
|
+
appAddress: Uint8Array;
|
|
13
|
+
address: Uint8Array;
|
|
14
|
+
idx: bigint;
|
|
15
|
+
}
|
|
16
|
+
export declare const varint: {
|
|
17
|
+
_limit: number;
|
|
18
|
+
encodingLength: (value: number) => number;
|
|
19
|
+
encode: (i: bigint | number, buffer?: ArrayBuffer, byteOffset?: number) => Uint8Array;
|
|
20
|
+
decode: (data: Uint8Array, offset?: number) => number;
|
|
21
|
+
};
|
|
22
|
+
export declare const StorageLogicSig: {
|
|
23
|
+
forMessageId: (appId: bigint, whm: WormholeMessageId) => LogicSigAccount;
|
|
24
|
+
forWrappedAsset: (appId: bigint, token: TokenId<Chain>) => LogicSigAccount;
|
|
25
|
+
forNativeAsset: (appId: bigint, tokenId: bigint) => LogicSigAccount;
|
|
26
|
+
forGuardianSet: (appId: bigint, idx: bigint | number) => LogicSigAccount;
|
|
27
|
+
forEmitter: (appId: bigint, emitter: Uint8Array) => LogicSigAccount;
|
|
28
|
+
_encode: (data: bigint | Uint8Array) => string[];
|
|
29
|
+
fromData: (data: PopulateData) => LogicSigAccount;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the local data for an application ID
|
|
32
|
+
* @param client Algodv2 client
|
|
33
|
+
* @param appId Application ID of interest
|
|
34
|
+
* @param address Address of the account
|
|
35
|
+
* @returns Promise with Uint8Array of data squirreled away
|
|
36
|
+
*/
|
|
37
|
+
decodeLocalState: (client: Algodv2, appId: bigint, address: string) => Promise<Uint8Array>;
|
|
38
|
+
/**
|
|
39
|
+
* This function is used to check if a VAA has been redeemed by looking at a specific bit
|
|
40
|
+
* @param client AlgodV2 client
|
|
41
|
+
* @param appId Application Id
|
|
42
|
+
* @param addr Wallet address. Someone has to pay for this
|
|
43
|
+
* @param seq The sequence number of the redemption
|
|
44
|
+
* @returns True, if the bit was set and VAA was redeemed, False otherwise
|
|
45
|
+
*/
|
|
46
|
+
checkBitsSet: (client: Algodv2, appId: bigint, addr: string, seq: bigint) => Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Checks to see if the account exists for the application
|
|
49
|
+
* @param client An Algodv2 client
|
|
50
|
+
* @param appId Application ID
|
|
51
|
+
* @param acctAddr Account address to check
|
|
52
|
+
* @returns True, if account exists for application, False otherwise
|
|
53
|
+
*/
|
|
54
|
+
storageAccountExists: (client: Algodv2, address: string, appId: bigint) => Promise<boolean>;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,iBAAiB,EAIlB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,eAAe,EAAkD,MAAM,SAAS,CAAC;AAGnG,eAAO,MAAM,QAAQ,EAAE,MAAgB,CAAC;AACxC,eAAO,MAAM,QAAQ,EAAE,MAAW,CAAC;AACnC,eAAO,MAAM,iBAAiB,EAAE,MAAY,CAAC;AAC7C,eAAO,MAAM,aAAa,EAAE,MAAU,CAAC;AACvC,eAAO,MAAM,YAAY,EAAE,MAA0C,CAAC;AACtE,eAAO,MAAM,SAAS,EAAE,MAAqC,CAAC;AAC9D,eAAO,MAAM,QAAQ,EAAE,MAAkC,CAAC;AAE1D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,UAAU,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAGD,eAAO,MAAM,MAAM;;4BAGO,MAAM;gBAKlB,MAAM,GAAG,MAAM,WAAW,WAAW,eAAe,MAAM;mBAsBvD,UAAU;CAa1B,CAAC;AAEF,eAAO,MAAM,eAAe;0BAEJ,MAAM,OAAO,iBAAiB;6BAc3B,MAAM,SAAS,QAAQ,KAAK,CAAC;4BAW9B,MAAM,WAAW,MAAM;4BAUvB,MAAM,OAAO,MAAM,GAAG,MAAM;wBAShC,MAAM,WAAW,UAAU;oBAS/B,MAAM,GAAG,UAAU;qBAIlB,YAAY;IAoB7B;;;;;;OAMG;+BAC8B,OAAO,SAAS,MAAM,WAAW,MAAM;IAqCxE;;;;;;;OAOG;2BAC0B,OAAO,SAAS,MAAM,QAAQ,MAAM,OAAO,MAAM;IAuC9E;;;;;;OAMG;mCACkC,OAAO,WAAW,MAAM,SAAS,MAAM;CAS7E,CAAC"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { encoding, isNative, toChainId, } from "@wormhole-foundation/sdk-connect";
|
|
2
|
+
import { LogicSigAccount, decodeAddress, getApplicationAddress, modelsv2 } from "algosdk";
|
|
3
|
+
import { safeBigIntToNumber } from "@wormhole-foundation/sdk-algorand";
|
|
4
|
+
export const SEED_AMT = 1002000;
|
|
5
|
+
export const MAX_KEYS = 15;
|
|
6
|
+
export const MAX_BYTES_PER_KEY = 127;
|
|
7
|
+
export const BITS_PER_BYTE = 8;
|
|
8
|
+
export const BITS_PER_KEY = MAX_BYTES_PER_KEY * BITS_PER_BYTE;
|
|
9
|
+
export const MAX_BYTES = MAX_BYTES_PER_KEY * MAX_KEYS;
|
|
10
|
+
export const MAX_BITS = BITS_PER_BYTE * MAX_BYTES;
|
|
11
|
+
// Useful for encoding numbers as varints to patch TEAL binary
|
|
12
|
+
export const varint = {
|
|
13
|
+
// Forever grateful to https://github.com/joeltg/big-varint/blob/main/src/unsigned.ts
|
|
14
|
+
_limit: 0x7f,
|
|
15
|
+
encodingLength: (value) => {
|
|
16
|
+
let i = 0;
|
|
17
|
+
for (; value >= 0x80; i++)
|
|
18
|
+
value >>= 7;
|
|
19
|
+
return i + 1;
|
|
20
|
+
},
|
|
21
|
+
encode: (i, buffer, byteOffset) => {
|
|
22
|
+
if (typeof i === "bigint")
|
|
23
|
+
i = safeBigIntToNumber(i);
|
|
24
|
+
if (i < 0)
|
|
25
|
+
throw new RangeError("value must be unsigned");
|
|
26
|
+
const byteLength = varint.encodingLength(i);
|
|
27
|
+
buffer = buffer || new ArrayBuffer(byteLength);
|
|
28
|
+
byteOffset = byteOffset || 0;
|
|
29
|
+
if (buffer.byteLength < byteOffset + byteLength)
|
|
30
|
+
throw new RangeError("the buffer is too small to encode the number at the offset");
|
|
31
|
+
const array = new Uint8Array(buffer, byteOffset);
|
|
32
|
+
let offset = 0;
|
|
33
|
+
while (varint._limit < i) {
|
|
34
|
+
array[offset++] = (i & varint._limit) | 0x80;
|
|
35
|
+
i >>= 7;
|
|
36
|
+
}
|
|
37
|
+
array[offset] = Number(i);
|
|
38
|
+
return array;
|
|
39
|
+
},
|
|
40
|
+
decode: (data, offset = 0) => {
|
|
41
|
+
let i = 0;
|
|
42
|
+
let n = 0;
|
|
43
|
+
let b;
|
|
44
|
+
do {
|
|
45
|
+
b = data[offset + n];
|
|
46
|
+
if (b === undefined)
|
|
47
|
+
throw new RangeError("offset out of range");
|
|
48
|
+
i += (b & varint._limit) << (n * 7);
|
|
49
|
+
n++;
|
|
50
|
+
} while (0x80 <= b);
|
|
51
|
+
return i;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
export const StorageLogicSig = {
|
|
55
|
+
// Get the storage lsig for a Wormhole message ID
|
|
56
|
+
forMessageId: (appId, whm) => {
|
|
57
|
+
const appAddress = decodeAddress(getApplicationAddress(appId)).publicKey;
|
|
58
|
+
const emitterAddr = whm.emitter.toUniversalAddress().toUint8Array();
|
|
59
|
+
const chainIdBytes = encoding.bignum.toBytes(BigInt(toChainId(whm.chain)), 2);
|
|
60
|
+
const address = encoding.bytes.concat(chainIdBytes, emitterAddr);
|
|
61
|
+
return StorageLogicSig.fromData({
|
|
62
|
+
appId,
|
|
63
|
+
appAddress,
|
|
64
|
+
idx: whm.sequence / BigInt(MAX_BITS),
|
|
65
|
+
address,
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
// Get the storage lsig for a wrapped asset
|
|
69
|
+
forWrappedAsset: (appId, token) => {
|
|
70
|
+
if (isNative(token.address))
|
|
71
|
+
throw new Error("native asset cannot be a wrapped asset");
|
|
72
|
+
const appAddress = decodeAddress(getApplicationAddress(appId)).publicKey;
|
|
73
|
+
return StorageLogicSig.fromData({
|
|
74
|
+
appId,
|
|
75
|
+
appAddress,
|
|
76
|
+
idx: BigInt(toChainId(token.chain)),
|
|
77
|
+
address: token.address.toUniversalAddress().toUint8Array(),
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
// Get the storage lsig for a native asset
|
|
81
|
+
forNativeAsset: (appId, tokenId) => {
|
|
82
|
+
const appAddress = decodeAddress(getApplicationAddress(appId)).publicKey;
|
|
83
|
+
return StorageLogicSig.fromData({
|
|
84
|
+
appId,
|
|
85
|
+
appAddress,
|
|
86
|
+
idx: tokenId,
|
|
87
|
+
address: encoding.bytes.encode("native"),
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
// Get the storage lsig for the guardian set
|
|
91
|
+
forGuardianSet: (appId, idx) => {
|
|
92
|
+
const appAddress = decodeAddress(getApplicationAddress(appId)).publicKey;
|
|
93
|
+
return StorageLogicSig.fromData({
|
|
94
|
+
appId,
|
|
95
|
+
appAddress,
|
|
96
|
+
idx: BigInt(idx),
|
|
97
|
+
address: encoding.bytes.encode("guardian"),
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
forEmitter: (appId, emitter) => {
|
|
101
|
+
const appAddress = decodeAddress(getApplicationAddress(appId)).publicKey;
|
|
102
|
+
return StorageLogicSig.fromData({
|
|
103
|
+
appId,
|
|
104
|
+
appAddress,
|
|
105
|
+
idx: 0n,
|
|
106
|
+
address: emitter,
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
_encode: (data) => {
|
|
110
|
+
if (typeof data === "bigint")
|
|
111
|
+
return [encoding.hex.encode(varint.encode(data))];
|
|
112
|
+
return [encoding.hex.encode(varint.encode(data.length)), encoding.hex.encode(data)];
|
|
113
|
+
},
|
|
114
|
+
fromData: (data) => {
|
|
115
|
+
// This patches the binary of the TEAL program used to store data
|
|
116
|
+
// to produce a logic sig that can be used to sign transactions
|
|
117
|
+
// to store data in the its account local state for a given app
|
|
118
|
+
const byteStrings = [
|
|
119
|
+
"0620010181",
|
|
120
|
+
...StorageLogicSig._encode(data.idx),
|
|
121
|
+
"4880",
|
|
122
|
+
...StorageLogicSig._encode(data.address),
|
|
123
|
+
"483110810612443119221244311881",
|
|
124
|
+
...StorageLogicSig._encode(data.appId),
|
|
125
|
+
"1244312080",
|
|
126
|
+
...StorageLogicSig._encode(data.appAddress),
|
|
127
|
+
"124431018100124431093203124431153203124422",
|
|
128
|
+
];
|
|
129
|
+
const bytecode = encoding.hex.decode(byteStrings.join(""));
|
|
130
|
+
return new LogicSigAccount(bytecode);
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
* Returns the local data for an application ID
|
|
134
|
+
* @param client Algodv2 client
|
|
135
|
+
* @param appId Application ID of interest
|
|
136
|
+
* @param address Address of the account
|
|
137
|
+
* @returns Promise with Uint8Array of data squirreled away
|
|
138
|
+
*/
|
|
139
|
+
decodeLocalState: async (client, appId, address) => {
|
|
140
|
+
let appState;
|
|
141
|
+
try {
|
|
142
|
+
const ai = await client
|
|
143
|
+
.accountApplicationInformation(address, safeBigIntToNumber(appId))
|
|
144
|
+
.do();
|
|
145
|
+
const acctAppInfo = modelsv2.AccountApplicationResponse.from_obj_for_encoding(ai);
|
|
146
|
+
appState = acctAppInfo.appLocalState;
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
return new Uint8Array();
|
|
150
|
+
}
|
|
151
|
+
const metaKey = encoding.b64.encode("meta");
|
|
152
|
+
// We don't want the data in the `meta` key
|
|
153
|
+
// and we want to make sure the sequences come back in order
|
|
154
|
+
// so first put them in a map by numeric key
|
|
155
|
+
// then iterate over keys to concat them in the right order
|
|
156
|
+
let vals = new Map();
|
|
157
|
+
for (const kv of appState.keyValue) {
|
|
158
|
+
if (kv.key === metaKey)
|
|
159
|
+
continue;
|
|
160
|
+
// Take the first byte off the key to be the
|
|
161
|
+
// numeric index
|
|
162
|
+
const key = encoding.b64.decode(kv.key)[0];
|
|
163
|
+
const value = encoding.b64.decode(kv.value.bytes);
|
|
164
|
+
vals.set(key, value);
|
|
165
|
+
}
|
|
166
|
+
const byteArrays = [];
|
|
167
|
+
for (let i = 0; i < MAX_KEYS; i++) {
|
|
168
|
+
if (vals.has(i))
|
|
169
|
+
byteArrays.push(vals.get(i));
|
|
170
|
+
}
|
|
171
|
+
return encoding.bytes.concat(...byteArrays);
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* This function is used to check if a VAA has been redeemed by looking at a specific bit
|
|
175
|
+
* @param client AlgodV2 client
|
|
176
|
+
* @param appId Application Id
|
|
177
|
+
* @param addr Wallet address. Someone has to pay for this
|
|
178
|
+
* @param seq The sequence number of the redemption
|
|
179
|
+
* @returns True, if the bit was set and VAA was redeemed, False otherwise
|
|
180
|
+
*/
|
|
181
|
+
checkBitsSet: async (client, appId, addr, seq) => {
|
|
182
|
+
let retval = false;
|
|
183
|
+
let appState;
|
|
184
|
+
const acctInfoResp = await client.accountInformation(addr).do();
|
|
185
|
+
const acctInfo = modelsv2.Account.from_obj_for_encoding(acctInfoResp);
|
|
186
|
+
const als = acctInfo.appsLocalState;
|
|
187
|
+
als &&
|
|
188
|
+
als.forEach((app) => {
|
|
189
|
+
if (BigInt(app.id) === appId) {
|
|
190
|
+
appState = app.keyValue;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
if (appState?.length === 0) {
|
|
194
|
+
return retval;
|
|
195
|
+
}
|
|
196
|
+
const BIG_MAX_BITS = BigInt(MAX_BITS);
|
|
197
|
+
const BIG_EIGHT = BigInt(8);
|
|
198
|
+
// Start on a MAX_BITS boundary
|
|
199
|
+
const start = (seq / BIG_MAX_BITS) * BIG_MAX_BITS;
|
|
200
|
+
// beg should be in the range [0..MAX_BITS]
|
|
201
|
+
const beg = safeBigIntToNumber(seq - start);
|
|
202
|
+
// s should be in the range [0..15]
|
|
203
|
+
const s = Math.floor(beg / BITS_PER_KEY);
|
|
204
|
+
const b = Math.floor((beg - s * BITS_PER_KEY) / 8);
|
|
205
|
+
const key = encoding.b64.encode(encoding.bignum.toBytes(s, 1));
|
|
206
|
+
appState?.forEach((kv) => {
|
|
207
|
+
if (kv.key === key) {
|
|
208
|
+
const v = Buffer.from(kv.value.bytes, "base64");
|
|
209
|
+
const bt = 1 << safeBigIntToNumber(seq % BIG_EIGHT);
|
|
210
|
+
retval = (v[b] & bt) != 0; // Added non-null assertion
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
return retval;
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* Checks to see if the account exists for the application
|
|
218
|
+
* @param client An Algodv2 client
|
|
219
|
+
* @param appId Application ID
|
|
220
|
+
* @param acctAddr Account address to check
|
|
221
|
+
* @returns True, if account exists for application, False otherwise
|
|
222
|
+
*/
|
|
223
|
+
storageAccountExists: async (client, address, appId) => {
|
|
224
|
+
try {
|
|
225
|
+
const acctAppInfo = await client
|
|
226
|
+
.accountApplicationInformation(address, safeBigIntToNumber(appId))
|
|
227
|
+
.do();
|
|
228
|
+
return Object.keys(acctAppInfo).length > 0;
|
|
229
|
+
}
|
|
230
|
+
catch { }
|
|
231
|
+
return false;
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAW,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,CAAC,MAAM,QAAQ,GAAW,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,QAAQ,GAAW,EAAE,C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GAAG,CAAC,CAAC;SAC5C;QAAC,MAAM,GAAE;QACV,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wormhole-foundation/sdk-algorand-core",
|
|
3
|
+
"version": "0.5.0-alpha.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/wormhole-foundation/connect-sdk.git"
|
|
7
|
+
},
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/wormhole-foundation/connect-sdk/issues"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/wormhole-foundation/connect-sdk#readme",
|
|
12
|
+
"directories": {
|
|
13
|
+
"test": "tests"
|
|
14
|
+
},
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"main": "./dist/cjs/index.js",
|
|
17
|
+
"module": "./dist/esm/index.js",
|
|
18
|
+
"types": "./dist/cjs/index.d.ts",
|
|
19
|
+
"author": "",
|
|
20
|
+
"description": "SDK for Algorand, used in conjunction with @wormhole-foundation/sdk",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/cjs",
|
|
23
|
+
"dist/esm"
|
|
24
|
+
],
|
|
25
|
+
"keywords": [
|
|
26
|
+
"wormhole",
|
|
27
|
+
"sdk",
|
|
28
|
+
"typescript",
|
|
29
|
+
"connect",
|
|
30
|
+
"algorand"
|
|
31
|
+
],
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=16"
|
|
34
|
+
},
|
|
35
|
+
"sideEffects": true,
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build:cjs": "tsc -p ./tsconfig.cjs.json",
|
|
38
|
+
"build:esm": "tsc -p ./tsconfig.esm.json",
|
|
39
|
+
"build": "npm run build:cjs && npm run build:esm",
|
|
40
|
+
"rebuild": "npm run clean && npm run build",
|
|
41
|
+
"clean": "rm -rf ./dist && rm -rf ./.turbo",
|
|
42
|
+
"lint": "npm run prettier && eslint --fix",
|
|
43
|
+
"prettier": "prettier --write ./src"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@wormhole-foundation/sdk-connect": "0.5.0-alpha.0",
|
|
47
|
+
"@wormhole-foundation/sdk-algorand": "0.5.0-alpha.0"
|
|
48
|
+
}
|
|
49
|
+
}
|