Skip to content

Commit 1e074af

Browse files
authored
Merge pull request #699 from LIT-Protocol/feat/convert-wrapped-keys-lit-actions-to-ts
feat: add types and convert lit actions to typescripts
2 parents c2cfb89 + 73c25e2 commit 1e074af

File tree

47 files changed

+1126
-482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1126
-482
lines changed

packages/wrapped-keys-lit-actions/esbuild.config.js

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const wrapIIFEInStringPlugin = {
2424

2525
result.outputFiles.forEach((outputFile) => {
2626
let content = outputFile.text;
27-
2827
// Use JSON.stringify to safely encode the content
2928
const wrappedContent = `/**
3029
* DO NOT EDIT THIS FILE. IT IS GENERATED ON BUILD. RUN \`yarn generate-lit-actions\` IN THE ROOT DIRECTORY TO UPDATE THIS FILE.
@@ -48,24 +47,45 @@ module.exports = {
4847
};
4948

5049
(async () => {
51-
await esbuild.build({
52-
entryPoints: [
53-
'./src/lib/self-executing-actions/solana/signTransactionWithEncryptedSolanaKey.js',
54-
'./src/lib/self-executing-actions/solana/signMessageWithEncryptedSolanaKey.js',
55-
'./src/lib/self-executing-actions/solana/generateEncryptedSolanaPrivateKey.js',
56-
'./src/lib/self-executing-actions/ethereum/signTransactionWithEncryptedEthereumKey.js',
57-
'./src/lib/self-executing-actions/ethereum/signMessageWithEncryptedEthereumKey.js',
58-
'./src/lib/self-executing-actions/ethereum/generateEncryptedEthereumPrivateKey.js',
59-
'./src/lib/self-executing-actions/common/exportPrivateKey.js',
60-
'./src/lib/self-executing-actions/common/batchGenerateEncryptedKeys.js',
61-
],
62-
bundle: true,
63-
minify: true,
64-
sourcemap: false,
65-
treeShaking: true,
66-
outdir: './src/generated/',
67-
inject: ['./buffer.shim.js'],
68-
plugins: [wrapIIFEInStringPlugin],
69-
platform: 'browser',
70-
});
50+
try {
51+
await esbuild
52+
.build({
53+
entryPoints: [
54+
'./src/lib/self-executing-actions/solana/signTransactionWithEncryptedSolanaKey.ts',
55+
'./src/lib/self-executing-actions/solana/signMessageWithEncryptedSolanaKey.ts',
56+
'./src/lib/self-executing-actions/solana/generateEncryptedSolanaPrivateKey.ts',
57+
'./src/lib/self-executing-actions/ethereum/signTransactionWithEncryptedEthereumKey.ts',
58+
'./src/lib/self-executing-actions/ethereum/signMessageWithEncryptedEthereumKey.ts',
59+
'./src/lib/self-executing-actions/ethereum/generateEncryptedEthereumPrivateKey.ts',
60+
'./src/lib/self-executing-actions/common/exportPrivateKey.ts',
61+
'./src/lib/self-executing-actions/common/batchGenerateEncryptedKeys.ts',
62+
],
63+
bundle: true,
64+
minify: true,
65+
sourcemap: false,
66+
treeShaking: true,
67+
outdir: './src/generated/',
68+
inject: ['./buffer.shim.js'],
69+
external: ['ethers'],
70+
plugins: [wrapIIFEInStringPlugin],
71+
platform: 'browser',
72+
})
73+
.then((result) => {
74+
result.outputFiles.forEach((file) => {
75+
const bytes = file.text.length;
76+
const mbInBinary = (bytes / (1024 * 1024)).toFixed(4);
77+
const mbInDecimal = (bytes / 1_000_000).toFixed(4);
78+
79+
console.log(
80+
`✅ ${file.path
81+
.split('/')
82+
.pop()}\n- ${mbInDecimal} MB (in decimal)\n- ${mbInBinary} MB (in binary)`
83+
);
84+
});
85+
});
86+
console.log('✅ Lit actions built successfully');
87+
} catch (e) {
88+
console.error('❌ Error building lit actions: ', e);
89+
process.exit(1);
90+
}
7191
})();

0 commit comments

Comments
 (0)