Skip to content
This repository was archived by the owner on Jun 12, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"devDependencies": {
"@chainsafe/filsnap-types": "workspace:^",
"@metamask/providers": "^9.0.0",
"@metamask/snaps-cli": "^0.18.1",
"@metamask/snaps-cli": "^0.32.2",
"@types/bn.js": "^4.11.6",
"@types/chai": "^4.2.10",
"@types/mocha": "^9.1.1",
Expand All @@ -62,6 +62,7 @@
"mocha": "^10.0.0",
"sinon": "^9.0.1",
"sinon-chai": "^3.5.0",
"through2": "^4.0.2",
"ts-node": "^10.8.0",
"typescript": "4.3.5"
},
Expand All @@ -74,6 +75,7 @@
"@metamask/snaps-types": "^0.26.2",
"@zondax/filecoin-signing-tools": "^0.20.0",
"bn.js": "^5.1.2",
"buffer": "^6.0.3",
"deepmerge": "^4.2.2"
}
}
4 changes: 2 additions & 2 deletions packages/snap/post-process.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const fs = require('fs');
const pathUtils = require('path');
const snapConfig = require('./snap.config.json');
const snapConfig = require('./snap.config.js');

const bundlePath = pathUtils.join(snapConfig.dist, snapConfig.outfileName);
const bundlePath = pathUtils.join(snapConfig.cliOptions.dist, snapConfig.cliOptions.outfileName);

let bundleString = fs.readFileSync(bundlePath, 'utf8');

Expand Down
26 changes: 26 additions & 0 deletions packages/snap/snap.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const through = require('through2');

module.exports = {
cliOptions: {
src: './src/index.ts',
port: 8081,
dist: "dist",
outfileName: "bundle.js",
},
bundlerCustomizer: (bundler) => {
bundler.transform(function () {
let data = '';
return through(
function (buffer, _encoding, callback) {
data += buffer;
callback();
},
function (callback) {
this.push("globalThis.Buffer = require('buffer/').Buffer;");
this.push(data);
callback();
},
);
});
},
}
6 changes: 0 additions & 6 deletions packages/snap/snap.config.json

This file was deleted.

4 changes: 2 additions & 2 deletions packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"version": "2.3.13",
"proposedName": "Filsnap",
"description": "The Filecoin snap.",
"proposedName": "Filsnap",
"repository": {
"type": "git",
"url": "https://github.com/Chainsafe/filsnap.git"
},
"source": {
"shasum": "Z7lh6iD1yjfKES/WutUyxepg5Dgp8Xjo3kivsz9vpwc=",
"shasum": "TKr8aBDxh5BWDFTO+iTOTO2Yzg5eSAIwslGAtDAiuWw=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Loading