Skip to content

Commit

Permalink
feat: bump starknetjs to 6.7.0 (#219)
Browse files Browse the repository at this point in the history
* feat: bump starknetjs to 6.6.0

* chore: remove unuse script

* chore: add default config

* chore: remove patching

* chore: update library version

* chore: update getStarkName
  • Loading branch information
stanleyyconsensys authored Apr 30, 2024
1 parent bb92d2d commit a07c3f1
Show file tree
Hide file tree
Showing 16 changed files with 272 additions and 193 deletions.
4 changes: 2 additions & 2 deletions packages/starknet-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"chai-as-promised": "^7.1.1",
"concurrently": "^7.1.0",
"cross-env": "^7.0.3",
"envify": "^4.1.0",
"eslint": "^8.13.0",
"mocha": "^9.2.2",
"nyc": "^15.1.0",
Expand All @@ -54,9 +53,10 @@
"dependencies": {
"@metamask/snaps-sdk": "3.0.1",
"async-mutex": "^0.3.2",
"dotenv": "^16.4.5",
"ethereum-unit-converter": "^0.0.17",
"ethers": "^5.5.1",
"starknet": "^5.14.0",
"starknet": "6.7.0",
"starknet_v4.22.0": "npm:[email protected]"
},
"publishConfig": {
Expand Down
28 changes: 13 additions & 15 deletions packages/starknet-snap/snap.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import envify from "envify/custom";
import * as dotenv from "dotenv";
dotenv.config();

module.exports = {
cliOptions: {
dist: 'dist',
outfileName: 'bundle.js',
src: './src/index.ts',
},
bundlerCustomizer: (bundler) => {
bundler.transform(
envify({
SNAP_ENV: process.env.SNAP_ENV,
VOYAGER_API_KEY: process.env.VOYAGER_API_KEY,
}),
);
},
};
bundler: "webpack",
environment: {
SNAP_ENV: process.env.SNAP_ENV ?? "prod",
VOYAGER_API_KEY: process.env.VOYAGER_API_KEY ?? "",
},
input: "./src/index.ts",
server: {
port: 8081,
},
polyfills: true
};
2 changes: 1 addition & 1 deletion packages/starknet-snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/ConsenSys/starknet-snap.git"
},
"source": {
"shasum": "jWBDYBstwiVhsHmuaSyCGfe8CIjvXZOSBTPbEJLd6T0=",
"shasum": "trDDU4ANftSs6SE0RJK3uXaxRnCBq7fvgptzA280SPA=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
13 changes: 4 additions & 9 deletions packages/starknet-snap/src/createAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export async function createAccount(params: ApiParams, silentMode = false) {
privateKey,
);
logger.log(`createAccount:\nestimateDeployFee: ${toJson(estimateDeployFee)}`);
if (Number(getBalanceResp.result[0]) < Number(estimateDeployFee.suggestedMaxFee)) {
if (Number(getBalanceResp[0]) < Number(estimateDeployFee.suggestedMaxFee)) {
const gasFeeStr = ethers.utils.formatUnits(estimateDeployFee.suggestedMaxFee.toString(10), 18);
const gasFeeFloat = parseFloat(gasFeeStr).toFixed(6); // 6 decimal places for ether
const gasFeeInEther = Number(gasFeeFloat) === 0 ? '0.000001' : gasFeeFloat;
Expand All @@ -110,14 +110,9 @@ export async function createAccount(params: ApiParams, silentMode = false) {
}
}

const deployResp = await deployAccount(
network,
contractAddress,
contractCallData,
publicKey,
privateKey,
estimateDeployFee?.suggestedMaxFee,
);
const deployResp = await deployAccount(network, contractAddress, contractCallData, publicKey, privateKey, {
maxFee: estimateDeployFee?.suggestedMaxFee,
});

if (deployResp.contract_address && deployResp.transaction_hash) {
const userAccount: AccContract = {
Expand Down
2 changes: 1 addition & 1 deletion packages/starknet-snap/src/getErc20TokenBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function getErc20TokenBalance(params: ApiParams) {

logger.log(`getErc20Balance:\nresp: ${toJson(resp)}`);

return resp.result[0];
return resp[0];
} catch (err) {
logger.error(`Problem found: ${err}`);
throw err;
Expand Down
2 changes: 1 addition & 1 deletion packages/starknet-snap/src/getValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function getValue(params: ApiParams) {

logger.log(`getValue:\nresp: ${toJson(resp)}`);

return resp.result;
return resp;
} catch (err) {
logger.error(`Problem found: ${err}`);
throw err;
Expand Down
1 change: 0 additions & 1 deletion packages/starknet-snap/src/signTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export async function signTransaction(params: ApiParams): Promise<Signature | bo
privateKey,
requestParamsObj.transactions,
requestParamsObj.transactionsDetail,
requestParamsObj.abis,
);

return signatures;
Expand Down
1 change: 0 additions & 1 deletion packages/starknet-snap/src/types/snapApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ export interface SignRequestParams {
export interface SignTransactionRequestParams extends Authorizable, SignRequestParams, BaseRequestParams {
transactions: Call[];
transactionsDetail: InvocationsSignerDetails;
abis?: Abi[];
}

export interface SignDeployAccountTransactionRequestParams extends Authorizable, SignRequestParams, BaseRequestParams {
Expand Down
Loading

0 comments on commit a07c3f1

Please sign in to comment.