From 4ee193b8e6784ece1c425f39f7090df94c2922a2 Mon Sep 17 00:00:00 2001 From: stanleyyuen <102275989+stanleyyconsensys@users.noreply.github.com> Date: Thu, 21 Mar 2024 19:19:56 +0800 Subject: [PATCH 1/6] feat: bump starknetjs to 6.6.0 --- package.json | 9 +- packages/starknet-snap/package.json | 7 +- packages/starknet-snap/snap.config.js | 24 +- packages/starknet-snap/snap.manifest.json | 2 +- packages/starknet-snap/src/createAccount.ts | 13 +- .../starknet-snap/src/getErc20TokenBalance.ts | 2 +- packages/starknet-snap/src/getValue.ts | 2 +- .../starknet-snap/src/utils/starknetUtils.ts | 114 +++-- packages/starknet-snap/test/constants.test.ts | 22 +- .../test/src/getErc20TokenBalance.test.ts | 10 +- .../starknet-snap/test/src/getValue.test.ts | 2 +- .../test/src/signDeclareTransaction.test.ts | 20 +- .../src/signDeployAccountTransaction.test.ts | 24 +- .../test/utils/starknetUtils.test.ts | 2 +- patches/starknet+6.6.0.patch | 28 ++ yarn.lock | 402 ++++++++++++++---- 16 files changed, 492 insertions(+), 191 deletions(-) create mode 100644 patches/starknet+6.6.0.patch diff --git a/package.json b/package.json index 8bc025bf..b8f10e55 100644 --- a/package.json +++ b/package.json @@ -9,17 +9,20 @@ "packages/*" ], "scripts": { - "setup": "yarn workspaces foreach run setup", + "setup": "yarn workspaces foreach run setup && yarn postinstall", "build": "yarn workspaces foreach run build", "test": "yarn workspace @consensys/starknet-snap run test", "lint": "yarn workspaces foreach run lint", "clean": "yarn workspaces foreach run clean", - "prepare": "husky install" + "prepare": "husky install", + "postinstall": "patch-package" }, "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "husky": "^8.0.0" + "husky": "^8.0.0", + "patch-package": "^8.0.0", + "postinstall-postinstall": "^2.1.0" }, "resolutions": { "luxon@^3.2.1": "patch:luxon@npm%3A3.3.0#./.yarn/patches/luxon-npm-3.3.0-bdbae9bfd5.patch" diff --git a/packages/starknet-snap/package.json b/packages/starknet-snap/package.json index 3a691581..a069e75f 100644 --- a/packages/starknet-snap/package.json +++ b/packages/starknet-snap/package.json @@ -20,7 +20,8 @@ "lint:fix": "eslint '**/*.{js,ts,tsx}' --fix", "test": "yarn run test:unit && yarn run cover:report", "test:unit": "nyc --check-coverage --statements 80 --branches 80 --functions 80 --lines 80 mocha --colors -r ts-node/register \"test/**/*.test.ts\"", - "cover:report": "nyc report --reporter=lcov --reporter=text" + "cover:report": "nyc report --reporter=lcov --reporter=text", + "postinstall": "patch-package" }, "keywords": [], "author": "", @@ -39,7 +40,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", @@ -54,9 +54,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.6.0", "starknet_v4.22.0": "npm:starknet@4.22.0" }, "publishConfig": { diff --git a/packages/starknet-snap/snap.config.js b/packages/starknet-snap/snap.config.js index 1e6bb254..1a3ea7f1 100644 --- a/packages/starknet-snap/snap.config.js +++ b/packages/starknet-snap/snap.config.js @@ -1,16 +1,14 @@ -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({ + bundler: "webpack", + environment: { SNAP_ENV: process.env.SNAP_ENV, - }), - ); - }, -}; \ No newline at end of file + }, + input: "./src/index.ts", + server: { + port: 8081, + }, + polyfills: true +}; diff --git a/packages/starknet-snap/snap.manifest.json b/packages/starknet-snap/snap.manifest.json index 5a73fd31..232f8020 100644 --- a/packages/starknet-snap/snap.manifest.json +++ b/packages/starknet-snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/ConsenSys/starknet-snap.git" }, "source": { - "shasum": "A3cyal6PKAzEQQ3ptdBUK106XMp5jQVh4kydh87u7AA=", + "shasum": "MZqJ3vs3WpVx0cflacDwaqUeAdsZELDONCo0LbR84UI=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/starknet-snap/src/createAccount.ts b/packages/starknet-snap/src/createAccount.ts index 535a893e..033bba30 100644 --- a/packages/starknet-snap/src/createAccount.ts +++ b/packages/starknet-snap/src/createAccount.ts @@ -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; @@ -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 = { diff --git a/packages/starknet-snap/src/getErc20TokenBalance.ts b/packages/starknet-snap/src/getErc20TokenBalance.ts index aed4a349..5cadb9d0 100644 --- a/packages/starknet-snap/src/getErc20TokenBalance.ts +++ b/packages/starknet-snap/src/getErc20TokenBalance.ts @@ -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; diff --git a/packages/starknet-snap/src/getValue.ts b/packages/starknet-snap/src/getValue.ts index a113c018..145f9395 100644 --- a/packages/starknet-snap/src/getValue.ts +++ b/packages/starknet-snap/src/getValue.ts @@ -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; diff --git a/packages/starknet-snap/src/utils/starknetUtils.ts b/packages/starknet-snap/src/utils/starknetUtils.ts index 7e52561b..4d509ece 100644 --- a/packages/starknet-snap/src/utils/starknetUtils.ts +++ b/packages/starknet-snap/src/utils/starknetUtils.ts @@ -21,19 +21,18 @@ import { GetTransactionResponse, Invocations, validateAndParseAddress as _validateAndParseAddress, - EstimateFeeDetails, DeclareContractPayload, DeclareContractResponse, - InvocationsDetails, Signer, Signature, stark, - InvocationsSignerDetails, Abi, + UniversalDetails, DeclareSignerDetails, DeployAccountSignerDetails, + InvocationsSignerDetails, + ProviderInterface, } from 'starknet'; -import type { Hex } from '@noble/curves/abstract/utils'; import { Network, SnapState, Transaction, TransactionType } from '../types/snapState'; import { ACCOUNT_CLASS_HASH_V0, PROXY_CONTRACT_HASH, TRANSFER_SELECTOR_HEX } from './constants'; import { getAddressKey } from './keyPair'; @@ -48,23 +47,14 @@ export const getCallDataArray = (callDataStr: string): string[] => { .filter((x) => x.length > 0); }; -export const getProvider = (network: Network, forceSequencer = false): Provider => { +export const getProvider = (network: Network): ProviderInterface => { let providerParam: ProviderOptions = {}; - // same precedence as defined in starknet.js Provider class constructor - if (network.nodeUrl && !forceSequencer) { - providerParam = { - rpc: { - nodeUrl: network.nodeUrl, - }, - }; - } else if (network.baseUrl) { - providerParam = { - sequencer: { - baseUrl: network.baseUrl, - }, - }; - } - return new Provider(providerParam); + providerParam = { + nodeUrl: network.nodeUrl, + }; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + return new Provider(providerParam) as unknown as ProviderInterface; }; export const callContract = async ( @@ -89,11 +79,11 @@ export const declareContract = async ( senderAddress: string, privateKey: string | Uint8Array, contractPayload: DeclareContractPayload, - transactionsDetail?: InvocationsDetails, + invocationsDetails?: UniversalDetails, ): Promise => { const provider = getProvider(network); - const account = new Account(provider, senderAddress, privateKey); - return account.declare(contractPayload, transactionsDetail); + const account = new Account(provider, senderAddress, privateKey, '0'); + return account.declare(contractPayload, { ...invocationsDetails, skipValidate: false, blockIdentifier: 'latest' }); }; export const estimateFee = async ( @@ -101,10 +91,15 @@ export const estimateFee = async ( senderAddress: string, privateKey: string | Uint8Array, txnInvocation: Call | Call[], + invocationsDetails?: UniversalDetails, ): Promise => { const provider = getProvider(network); - const account = new Account(provider, senderAddress, privateKey); - return account.estimateInvokeFee(txnInvocation, { blockIdentifier: 'latest' }); + const account = new Account(provider, senderAddress, privateKey, '0'); + return account.estimateInvokeFee(txnInvocation, { + ...invocationsDetails, + skipValidate: false, + blockIdentifier: 'latest', + }); }; export const estimateFeeBulk = async ( @@ -112,13 +107,15 @@ export const estimateFeeBulk = async ( senderAddress: string, privateKey: string | Uint8Array, txnInvocation: Invocations, - invocationsDetails: EstimateFeeDetails = { blockIdentifier: 'latest' }, + invocationsDetails?: UniversalDetails, ): Promise => { - // ensure always calling the sequencer endpoint since the rpc endpoint and - // starknet.js are not supported yet. const provider = getProvider(network); - const account = new Account(provider, senderAddress, privateKey); - return account.estimateFeeBulk(txnInvocation, invocationsDetails); + const account = new Account(provider, senderAddress, privateKey, '0'); + return account.estimateFeeBulk(txnInvocation, { + ...invocationsDetails, + skipValidate: false, + blockIdentifier: 'latest', + }); }; export const executeTxn = async ( @@ -127,11 +124,15 @@ export const executeTxn = async ( privateKey: string | Uint8Array, txnInvocation: Call | Call[], abis?: Abi[], - invocationsDetails?: InvocationsDetails, + invocationsDetails?: UniversalDetails, ): Promise => { const provider = getProvider(network); - const account = new Account(provider, senderAddress, privateKey); - return account.execute(txnInvocation, abis, invocationsDetails); + const account = new Account(provider, senderAddress, privateKey, '0'); + return account.execute(txnInvocation, abis, { + ...invocationsDetails, + skipValidate: false, + blockIdentifier: 'latest', + }); }; export const deployAccount = async ( @@ -140,17 +141,21 @@ export const deployAccount = async ( contractCallData: RawCalldata, addressSalt: num.BigNumberish, privateKey: string | Uint8Array, - maxFee: num.BigNumberish, + invocationsDetails?: UniversalDetails, ): Promise => { const provider = getProvider(network); - const account = new Account(provider, contractAddress, privateKey); + const account = new Account(provider, contractAddress, privateKey, '0'); const deployAccountPayload = { classHash: PROXY_CONTRACT_HASH, contractAddress: contractAddress, constructorCalldata: contractCallData, addressSalt, }; - return account.deployAccount(deployAccountPayload, { maxFee }); + return account.deployAccount(deployAccountPayload, { + ...invocationsDetails, + skipValidate: false, + blockIdentifier: 'latest', + }); }; export const estimateAccountDeployFee = async ( @@ -159,21 +164,26 @@ export const estimateAccountDeployFee = async ( contractCallData: RawCalldata, addressSalt: num.BigNumberish, privateKey: string | Uint8Array, + invocationsDetails?: UniversalDetails, ): Promise => { const provider = getProvider(network); - const account = new Account(provider, contractAddress, privateKey); + const account = new Account(provider, contractAddress, privateKey, '0'); const deployAccountPayload = { classHash: PROXY_CONTRACT_HASH, contractAddress: contractAddress, constructorCalldata: contractCallData, addressSalt, }; - return account.estimateAccountDeployFee(deployAccountPayload); + return account.estimateAccountDeployFee(deployAccountPayload, { + ...invocationsDetails, + skipValidate: false, + blockIdentifier: 'latest', + }); }; export const getSigner = async (userAccAddress: string, network: Network): Promise => { const resp = await callContract(network, userAccAddress, 'getSigner'); - return resp.result[0]; + return resp[0]; }; export const getTransactionStatus = async (transactionHash: num.BigNumberish, network: Network) => { @@ -304,9 +314,17 @@ export const getMassagedTransactions = async ( txnHash: txnResp.transaction_hash || txn.hash, txnType: txn.type?.toLowerCase(), chainId: network.chainId, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore senderAddress: txnResp.sender_address || txnResp.contract_address || txn.contract_address || '', + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore contractAddress: txnResp.calldata?.[1] || txnResp.contract_address || txn.contract_address || '', + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore contractFuncName: num.toBigInt(txnResp.calldata?.[2] || '') === bigIntTransferSelectorHex ? 'transfer' : '', + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore contractCallData: txnResp.calldata?.slice(6, txnResp.calldata?.length - 1) || [], timestamp: txn.timestamp, status: '', //DEPRECATION @@ -361,12 +379,12 @@ export const postData = async (url = '', data = {}) => { return response.json(); // parses JSON response into native JavaScript objects }; -export function getFullPublicKeyPairFromPrivateKey(privateKey: Hex) { +export function getFullPublicKeyPairFromPrivateKey(privateKey: string) { return encode.addHexPrefix(encode.buf2hex(ec.starkCurve.getPublicKey(privateKey, false))); } export const getTypedDataMessageSignature = ( - privateKey: Hex, + privateKey: string, typedDataMessage: typedData.TypedData, signerUserAddress: string, ) => { @@ -374,15 +392,15 @@ export const getTypedDataMessageSignature = ( return ec.starkCurve.sign(msgHash, privateKey); }; -export const getSignatureBySignatureString = (signatureStr: Hex) => { +export const getSignatureBySignatureString = (signatureStr: string) => { return ec.starkCurve.Signature.fromDER(signatureStr); }; export const verifyTypedDataMessageSignature = ( - fullPublicKey: Hex, + fullPublicKey: string, typedDataMessage: typedData.TypedData, signerUserAddress: num.BigNumberish, - signatureStr: Hex, + signatureStr: string, ) => { const signature = getSignatureBySignatureString(signatureStr); const msgHash = typedData.getMessageHash(typedDataMessage, signerUserAddress); @@ -483,7 +501,7 @@ export const isAccountDeployed = async (network: Network, publicKey: string) => return accountDeployed; }; -export const addFeesFromAllTransactions = (fees: EstimateFee[]): EstimateFee => { +export const addFeesFromAllTransactions = (fees: EstimateFee[]): Partial => { let overall_fee_bn = num.toBigInt(0); let suggestedMaxFee_bn = num.toBigInt(0); @@ -513,6 +531,8 @@ export const signTransactions = async ( abis: Abi[], ): Promise => { const signer = new Signer(privateKey); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore const signatures = await signer.signTransaction(transactions, transactionsDetail, abis); return stark.signatureToDecimalArray(signatures); }; @@ -536,7 +556,7 @@ export const signDeclareTransaction = async ( }; export const signMessage = async ( - privateKey: Hex, + privateKey: string, typedDataMessage: typedData.TypedData, signerUserAddress: string, ) => { @@ -547,5 +567,7 @@ export const signMessage = async ( export const getStarkNameUtil = async (network: Network, userAddress: string) => { const provider = getProvider(network); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore return provider.getStarkName(userAddress); }; diff --git a/packages/starknet-snap/test/constants.test.ts b/packages/starknet-snap/test/constants.test.ts index 1b8b430b..780f579c 100644 --- a/packages/starknet-snap/test/constants.test.ts +++ b/packages/starknet-snap/test/constants.test.ts @@ -1,5 +1,5 @@ import { JsonBIP44CoinTypeNode } from '@metamask/key-tree'; -import { constants, num } from 'starknet'; +import { EstimateFee, GetTransactionResponse, constants, num } from 'starknet'; import { AccContract, Erc20Token, @@ -341,45 +341,43 @@ export const mainnetTxn1: Transaction = { eventIds: [], }; -export const getBalanceResp = { - result: ['0x0', '0x0'], -}; +export const getBalanceResp = ['0x0', '0x0']; export const estimateDeployFeeResp = { overall_fee: num.toBigInt('0x0'), gas_consumed: num.toBigInt('0x0'), suggestedMaxFee: num.toBigInt('0x0'), gas_price: num.toBigInt('0x0'), -}; +} as EstimateFee; export const estimateDeployFeeResp2 = { overall_fee: num.toBigInt('0xaff3f0a7'), gas_consumed: num.toBigInt('0x18e1'), suggestedMaxFee: num.toBigInt('0x0107ede8fa'), gas_price: num.toBigInt('0x071287'), -}; +} as EstimateFee; export const estimateDeployFeeResp3 = { overall_fee: num.toBigInt('0x1160f77b2edd'), gas_consumed: num.toBigInt('0x18e1'), suggestedMaxFee: num.toBigInt('0x1a117338c64b'), gas_price: num.toBigInt('0xb2d3297d'), -}; +} as EstimateFee; export const estimateDeployFeeResp4 = { overall_fee: num.toBigInt('0x1160f77b2edd'), suggestedMaxFee: num.toBigInt('0x1a117338c64b'), -}; +} as EstimateFee; export const estimateFeeResp = { overall_fee: num.toBigInt('0x0dc3e44d89e6'), suggestedMaxFee: num.toBigInt('0x14a5d6744ed9'), -}; +} as EstimateFee; export const estimateFeeResp2 = { overall_fee: num.toBigInt('0x0dc3e44d89e6'), suggestedMaxFee: num.toBigInt('0x14a5d6744ed9'), -}; +} as EstimateFee; export const unfoundUserAddress = '0x018dfa1955a0154524203f81c5668d6a78c708375ee8908dcb55a49c6ec87190'; export const unfoundUserPrivateKey = '0x610d87a5c02459f8643f9ad6a9bc70597d1a8a0ab4d645346b7eadc5266ad4d'; @@ -654,7 +652,7 @@ export const getTxnFromSequencerResp1 = { ], transaction_hash: '0x1366c2f9f46b1a86ba0c28b5a08fa0aa3750c4d1cbe06e97e72bd46ae2ac1f9', version: '0x0', -}; +} as unknown as GetTransactionResponse; export const getTxnFromSequencerResp2 = { status: 'ACCEPTED_ON_L1', @@ -680,7 +678,7 @@ export const getTxnFromSequencerResp2 = { contract_address: '0x5a98ec74a40383cf99896bfea2ec5e6aad16c7eed50025a5f569d585ebb13a2', transaction_hash: '0x6beceb86579dc78749bdaaf441501edc21e218e020236e2ebea1b6a96d0bac7', version: '0x0', -}; +} as unknown as GetTransactionResponse; export const expectedMassagedTxn4: Transaction = { chainId: '0x534e5f474f45524c49', diff --git a/packages/starknet-snap/test/src/getErc20TokenBalance.test.ts b/packages/starknet-snap/test/src/getErc20TokenBalance.test.ts index ef75e4e0..841977bd 100644 --- a/packages/starknet-snap/test/src/getErc20TokenBalance.test.ts +++ b/packages/starknet-snap/test/src/getErc20TokenBalance.test.ts @@ -34,7 +34,7 @@ describe('Test function: getErc20TokenBalance', function () { it('should get the ERC-20 token balance correctly', async function () { sandbox.stub(utils, 'callContract').callsFake(async () => { - return { result: ['0x64a'] }; //1610 in decimal + return ['0x64a']; //1610 in decimal }); const requestObject: GetErc20TokenBalanceRequestParams = { tokenAddress: '0x07394cbe418daa16e42b87ba67372d4ab4a5df0b05c6e554d158458ce245bc10', @@ -65,7 +65,7 @@ describe('Test function: getErc20TokenBalance', function () { it('should throw error if userAddress is empty', async function () { sandbox.stub(utils, 'callContract').callsFake(async () => { - return { result: ['0x64a'] }; //1610 in decimal + return ['0x64a']; //1610 in decimal }); const requestObject: GetErc20TokenBalanceRequestParams = { tokenAddress: '0x07394cbe418daa16e42b87ba67372d4ab4a5df0b05c6e554d158458ce245bc10', @@ -85,7 +85,7 @@ describe('Test function: getErc20TokenBalance', function () { it('should throw error if tokenAddress is empty', async function () { sandbox.stub(utils, 'callContract').callsFake(async () => { - return { result: ['0x64a'] }; //1610 in decimal + return ['0x64a']; //1610 in decimal }); const requestObject: GetErc20TokenBalanceRequestParams = { tokenAddress: '', @@ -105,7 +105,7 @@ describe('Test function: getErc20TokenBalance', function () { it('should throw error if userAddress is invalid', async function () { sandbox.stub(utils, 'callContract').callsFake(async () => { - return { result: ['0x64a'] }; //1610 in decimal + return ['0x64a']; //1610 in decimal }); const requestObject: GetErc20TokenBalanceRequestParams = { tokenAddress: '0x07394cbe418daa16e42b87ba67372d4ab4a5df0b05c6e554d158458ce245bc10', @@ -125,7 +125,7 @@ describe('Test function: getErc20TokenBalance', function () { it('should throw error if tokenAddress is invalid', async function () { sandbox.stub(utils, 'callContract').callsFake(async () => { - return { result: ['0x64a'] }; //1610 in decimal + return ['0x64a']; //1610 in decimal }); const requestObject: GetErc20TokenBalanceRequestParams = { tokenAddress: 'wrongAddress', diff --git a/packages/starknet-snap/test/src/getValue.test.ts b/packages/starknet-snap/test/src/getValue.test.ts index bc55a7d4..a46001e2 100644 --- a/packages/starknet-snap/test/src/getValue.test.ts +++ b/packages/starknet-snap/test/src/getValue.test.ts @@ -34,7 +34,7 @@ describe('Test function: getValue', function () { it('should call the contract correctly', async function () { sandbox.stub(utils, 'callContract').callsFake(async () => { - return { result: ['1'] }; + return ['1']; }); const requestObject: GetValueRequestParams = { contractAddress: '0x07394cbe418daa16e42b87ba67372d4ab4a5df0b05c6e554d158458ce245bc10', diff --git a/packages/starknet-snap/test/src/signDeclareTransaction.test.ts b/packages/starknet-snap/test/src/signDeclareTransaction.test.ts index 8dc2986b..24686331 100644 --- a/packages/starknet-snap/test/src/signDeclareTransaction.test.ts +++ b/packages/starknet-snap/test/src/signDeclareTransaction.test.ts @@ -13,7 +13,7 @@ import { createAccountProxyTxn, getBip44EntropyStub, account1, signature3 } from import { getAddressKeyDeriver } from '../../src/utils/keyPair'; import { Mutex } from 'async-mutex'; import { ApiParams, SignDeclareTransactionRequestParams } from '../../src/types/snapApi'; -import { constants } from 'starknet'; +import { DeclareSignerDetails, constants } from 'starknet'; import * as utils from '../../src/utils/starknetUtils'; chai.use(sinonChai); @@ -35,17 +35,19 @@ describe('Test function: signDeclareTransaction', function () { saveMutex: new Mutex(), }; + const declarePayload = { + classHash: '0x025ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918', + senderAddress: account1.address, + chainId: constants.StarknetChainId.SN_MAIN, + nonce: '0x1', + version: '0x0', + maxFee: 100, + } as unknown as DeclareSignerDetails; + const requestObject: SignDeclareTransactionRequestParams = { chainId: STARKNET_MAINNET_NETWORK.chainId, signerAddress: account1.address, - transaction: { - classHash: '0x025ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918', - senderAddress: account1.address, - chainId: constants.StarknetChainId.SN_MAIN, - nonce: '0x1', - version: '0x0', - maxFee: 100, - }, + transaction: declarePayload, enableAutherize: true, }; diff --git a/packages/starknet-snap/test/src/signDeployAccountTransaction.test.ts b/packages/starknet-snap/test/src/signDeployAccountTransaction.test.ts index ee9fc7fa..e7b5302a 100644 --- a/packages/starknet-snap/test/src/signDeployAccountTransaction.test.ts +++ b/packages/starknet-snap/test/src/signDeployAccountTransaction.test.ts @@ -13,7 +13,7 @@ import { createAccountProxyTxn, getBip44EntropyStub, account1, signature3 } from import { getAddressKeyDeriver } from '../../src/utils/keyPair'; import { Mutex } from 'async-mutex'; import { ApiParams, SignDeployAccountTransactionRequestParams } from '../../src/types/snapApi'; -import { constants } from 'starknet'; +import { DeployAccountSignerDetails, constants } from 'starknet'; import * as utils from '../../src/utils/starknetUtils'; chai.use(sinonChai); @@ -35,19 +35,21 @@ describe('Test function: signDeployAccountTransaction', function () { saveMutex: new Mutex(), }; + const declareNDeployPayload = { + classHash: '0x025ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918', + contractAddress: account1.address, + constructorCalldata: [], + addressSalt: '0x025ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918', + chainId: constants.StarknetChainId.SN_MAIN, + nonce: '0x1', + version: '0x0', + maxFee: 100, + } as unknown as DeployAccountSignerDetails; + const requestObject: SignDeployAccountTransactionRequestParams = { chainId: STARKNET_MAINNET_NETWORK.chainId, signerAddress: account1.address, - transaction: { - classHash: '0x025ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918', - contractAddress: account1.address, - constructorCalldata: [], - addressSalt: '0x025ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918', - chainId: constants.StarknetChainId.SN_MAIN, - nonce: '0x1', - version: '0x0', - maxFee: 100, - }, + transaction: declareNDeployPayload, enableAutherize: true, }; diff --git a/packages/starknet-snap/test/utils/starknetUtils.test.ts b/packages/starknet-snap/test/utils/starknetUtils.test.ts index e4a70e1a..204e8956 100644 --- a/packages/starknet-snap/test/utils/starknetUtils.test.ts +++ b/packages/starknet-snap/test/utils/starknetUtils.test.ts @@ -29,7 +29,7 @@ describe('Test function: callContract', function () { it('should get the signer of an user account correctly', async function () { sandbox.stub(utils, 'callContract').callsFake(async () => { - return { result: ['0x795d62a9896b221af17bedd8cceb8d963ac6864857d7476e2f8c03ba0c5df9'] }; + return ['0x795d62a9896b221af17bedd8cceb8d963ac6864857d7476e2f8c03ba0c5df9']; }); const result = await utils.getSigner(userAddress, STARKNET_TESTNET_NETWORK); diff --git a/patches/starknet+6.6.0.patch b/patches/starknet+6.6.0.patch new file mode 100644 index 00000000..1f17c21e --- /dev/null +++ b/patches/starknet+6.6.0.patch @@ -0,0 +1,28 @@ +diff --git a/node_modules/starknet/dist/index.js b/node_modules/starknet/dist/index.js +index 1569354..fb8d569 100644 +--- a/node_modules/starknet/dist/index.js ++++ b/node_modules/starknet/dist/index.js +@@ -5832,7 +5832,7 @@ var Account = class extends RpcProvider2 { + return this.estimateInvokeFee(calls, details); + } + async estimateFeeBulk(invocations, details = {}) { +- const { nonce, blockIdentifier, version } = details; ++ const { nonce, blockIdentifier, version, skipValidate } = details; + const accountInvocations = await this.accountInvocationsFactory(invocations, { + ...v3Details(details), + versions: [ +@@ -5845,11 +5845,12 @@ var Account = class extends RpcProvider2 { + // sierra + ], + nonce, +- blockIdentifier ++ blockIdentifier, ++ skipValidate + }); + return super.getEstimateFeeBulk(accountInvocations, { + blockIdentifier, +- skipValidate: details.skipValidate ++ skipValidate: skipValidate + }); + } + async simulateTransaction(invocations, details = {}) { diff --git a/yarn.lock b/yarn.lock index 1c0f273c..1b1deae4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3154,16 +3154,17 @@ __metadata: linkType: hard "@consensys/starknet-snap@file:../starknet-snap::locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui": - version: 2.5.1 - resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=195ab3&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" + version: 2.5.2 + resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=361b19&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" 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.6.0 starknet_v4.22.0: "npm:starknet@4.22.0" - checksum: dc8a3354e0ec4863c9ff6d2841abeb0ea841f69519202d1c1b904308024a7ff76f3d44a1cfa91d043739ce807aa7b8513d06baf7cb357475450d653a39f89efd + checksum: 686f271891d12a0451646fc712f2353ec0495f2397b12c25eede5264e186c9ab7bcebf011df3789d9c14b144a0685bbefa3eff8ab6b90bb17763c5434e6af8ef languageName: node linkType: hard @@ -3187,7 +3188,7 @@ __metadata: chai-as-promised: ^7.1.1 concurrently: ^7.1.0 cross-env: ^7.0.3 - envify: ^4.1.0 + dotenv: ^16.4.5 eslint: ^8.13.0 ethereum-unit-converter: ^0.0.17 ethers: ^5.5.1 @@ -3198,7 +3199,7 @@ __metadata: sinon: ^13.0.2 sinon-chai: ^3.7.0 standard-version: ^9.5.0 - starknet: ^5.14.0 + starknet: 6.6.0 starknet_v4.22.0: "npm:starknet@4.22.0" ts-node: ^10.8.1 typescript: ^4.6.3 @@ -5481,15 +5482,6 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:~1.0.0": - version: 1.0.0 - resolution: "@noble/curves@npm:1.0.0" - dependencies: - "@noble/hashes": 1.3.0 - checksum: 6bcef44d626c640dc8961819d68dd67dffb907e3b973b7c27efe0ecdd9a5c6ce62c7b9e3dfc930c66605dced7f1ec0514d191c09a2ce98d6d52b66e3315ffa79 - languageName: node - linkType: hard - "@noble/ed25519@npm:^1.6.0": version: 1.7.3 resolution: "@noble/ed25519@npm:1.7.3" @@ -5504,14 +5496,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.3.0": - version: 1.3.0 - resolution: "@noble/hashes@npm:1.3.0" - checksum: d7ddb6d7c60f1ce1f87facbbef5b724cdea536fc9e7f59ae96e0fc9de96c8f1a2ae2bdedbce10f7dcc621338dfef8533daa73c873f2b5c87fa1a4e05a95c2e2e - languageName: node - linkType: hard - -"@noble/hashes@npm:1.3.3, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:^1.3.2, @noble/hashes@npm:~1.3.2": +"@noble/hashes@npm:1.3.3, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:^1.3.2, @noble/hashes@npm:~1.3.2, @noble/hashes@npm:~1.3.3": version: 1.3.3 resolution: "@noble/hashes@npm:1.3.3" checksum: 8a6496d1c0c64797339bc694ad06cdfaa0f9e56cd0c3f68ae3666cfb153a791a55deb0af9c653c7ed2db64d537aa3e3054629740d2f2338bb1dcb7ab60cd205b @@ -5525,13 +5510,6 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:~1.3.0": - version: 1.3.1 - resolution: "@noble/hashes@npm:1.3.1" - checksum: 7fdefc0f7a0c1ec27acc6ff88841793e3f93ec4ce6b8a6a12bfc0dd70ae6b7c4c82fe305fdfeda1735d5ad4a9eebe761e6693b3d355689c559e91242f4bc95b1 - languageName: node - linkType: hard - "@noble/secp256k1@npm:1.7.1, @noble/secp256k1@npm:^1.5.5, @noble/secp256k1@npm:^1.7.1, @noble/secp256k1@npm:~1.7.0": version: 1.7.1 resolution: "@noble/secp256k1@npm:1.7.1" @@ -5786,6 +5764,13 @@ __metadata: languageName: node linkType: hard +"@scure/base@npm:~1.1.3": + version: 1.1.6 + resolution: "@scure/base@npm:1.1.6" + checksum: d6deaae91deba99e87939af9e55d80edba302674983f32bba57f942e22b1726a83c62dc50d8f4370a5d5d35a212dda167fb169f4b0d0c297488d8604608fc3d3 + languageName: node + linkType: hard + "@scure/bip32@npm:1.1.5": version: 1.1.5 resolution: "@scure/bip32@npm:1.1.5" @@ -5828,6 +5813,16 @@ __metadata: languageName: node linkType: hard +"@scure/starknet@npm:~1.0.0": + version: 1.0.0 + resolution: "@scure/starknet@npm:1.0.0" + dependencies: + "@noble/curves": ~1.3.0 + "@noble/hashes": ~1.3.3 + checksum: 2df4234ff7ae025b72c0e7eb5af81e35bb5790d72f9dc7746bd91183527081df3e637579616fa7717d4227abf67e11380cf266bea43144231325503f52644087 + languageName: node + linkType: hard + "@sinclair/typebox@npm:^0.24.1": version: 0.24.51 resolution: "@sinclair/typebox@npm:0.24.51" @@ -9003,6 +8998,13 @@ __metadata: languageName: node linkType: hard +"@yarnpkg/lockfile@npm:^1.1.0": + version: 1.1.0 + resolution: "@yarnpkg/lockfile@npm:1.1.0" + checksum: 05b881b4866a3546861fee756e6d3812776ea47fa6eb7098f983d6d0eefa02e12b66c3fff931574120f196286a7ad4879ce02743c8bb2be36c6a576c7852083a + languageName: node + linkType: hard + "JSONStream@npm:^1.0.3, JSONStream@npm:^1.0.4": version: 1.3.5 resolution: "JSONStream@npm:1.3.5" @@ -9029,6 +9031,20 @@ __metadata: languageName: node linkType: hard +"abi-wan-kanabi@npm:^2.2.1": + version: 2.2.1 + resolution: "abi-wan-kanabi@npm:2.2.1" + dependencies: + ansicolors: ^0.3.2 + cardinal: ^2.1.1 + fs-extra: ^10.0.0 + yargs: ^17.7.2 + bin: + generate: dist/generate.js + checksum: 1567dd8c962a735d79f546b463bbce063fe202f823112bc8713ac14213e814417cbdc25cdd95299889aae5664ed44febf843833924e754a992e705053084fda0 + languageName: node + linkType: hard + "abort-controller@npm:^3.0.0": version: 3.0.0 resolution: "abort-controller@npm:3.0.0" @@ -9397,6 +9413,13 @@ __metadata: languageName: node linkType: hard +"ansicolors@npm:^0.3.2, ansicolors@npm:~0.3.2": + version: 0.3.2 + resolution: "ansicolors@npm:0.3.2" + checksum: e84fae7ebc27ac96d9dbb57f35f078cd6dde1b7046b0f03f73dcefc9fbb1f2e82e3685d083466aded8faf038f9fa9ebb408d215282bcd7aaa301d5ac3c486815 + languageName: node + linkType: hard + "anymatch@npm:^2.0.0": version: 2.0.0 resolution: "anymatch@npm:2.0.0" @@ -11003,6 +11026,19 @@ __metadata: languageName: node linkType: hard +"call-bind@npm:^1.0.5": + version: 1.0.7 + resolution: "call-bind@npm:1.0.7" + dependencies: + es-define-property: ^1.0.0 + es-errors: ^1.3.0 + function-bind: ^1.1.2 + get-intrinsic: ^1.2.4 + set-function-length: ^1.2.1 + checksum: 295c0c62b90dd6522e6db3b0ab1ce26bdf9e7404215bda13cfee25b626b5ff1a7761324d58d38b1ef1607fc65aca2d06e44d2e18d0dfc6c14b465b00d8660029 + languageName: node + linkType: hard + "call-me-maybe@npm:^1.0.1": version: 1.0.2 resolution: "call-me-maybe@npm:1.0.2" @@ -11118,6 +11154,18 @@ __metadata: languageName: node linkType: hard +"cardinal@npm:^2.1.1": + version: 2.1.1 + resolution: "cardinal@npm:2.1.1" + dependencies: + ansicolors: ~0.3.2 + redeyed: ~2.1.0 + bin: + cdl: ./bin/cdl.js + checksum: e8d4ae46439cf8fed481c0efd267711ee91e199aa7821a9143e784ed94a6495accd01a0b36d84d377e8ee2cc9928a6c9c123b03be761c60b805f2c026b8a99ad + languageName: node + linkType: hard + "case-sensitive-paths-webpack-plugin@npm:^2.3.0, case-sensitive-paths-webpack-plugin@npm:^2.4.0": version: 2.4.0 resolution: "case-sensitive-paths-webpack-plugin@npm:2.4.0" @@ -11341,6 +11389,13 @@ __metadata: languageName: node linkType: hard +"ci-info@npm:^3.7.0": + version: 3.9.0 + resolution: "ci-info@npm:3.9.0" + checksum: 6b19dc9b2966d1f8c2041a838217299718f15d6c4b63ae36e4674edd2bee48f780e94761286a56aa59eb305a85fbea4ddffb7630ec063e7ec7e7e5ad42549a87 + languageName: node + linkType: hard + "cipher-base@npm:^1.0.0, cipher-base@npm:^1.0.1, cipher-base@npm:^1.0.3": version: 1.0.4 resolution: "cipher-base@npm:1.0.4" @@ -12973,6 +13028,17 @@ __metadata: languageName: node linkType: hard +"define-data-property@npm:^1.1.4": + version: 1.1.4 + resolution: "define-data-property@npm:1.1.4" + dependencies: + es-define-property: ^1.0.0 + es-errors: ^1.3.0 + gopd: ^1.0.1 + checksum: 8068ee6cab694d409ac25936eb861eea704b7763f7f342adbdfe337fc27c78d7ae0eff2364b2917b58c508d723c7a074326d068eef2e45c4edcd85cf94d0313b + languageName: node + linkType: hard + "define-lazy-prop@npm:^2.0.0": version: 2.0.0 resolution: "define-lazy-prop@npm:2.0.0" @@ -13442,6 +13508,13 @@ __metadata: languageName: node linkType: hard +"dotenv@npm:^16.4.5": + version: 16.4.5 + resolution: "dotenv@npm:16.4.5" + checksum: 301a12c3d44fd49888b74eb9ccf9f07a1f5df43f489e7fcb89647a2edcd84c42d6bc349dc8df099cd18f07c35c7b04685c1a4f3e6a6a9e6b30f8d48c15b7f49c + languageName: node + linkType: hard + "dotenv@npm:^8.0.0": version: 8.6.0 resolution: "dotenv@npm:8.6.0" @@ -13660,18 +13733,6 @@ __metadata: languageName: node linkType: hard -"envify@npm:^4.1.0": - version: 4.1.0 - resolution: "envify@npm:4.1.0" - dependencies: - esprima: ^4.0.0 - through: ~2.3.4 - bin: - envify: bin/envify - checksum: ee48873a56a117b812fb5e4d50870bf4440f5ba3462db4f4677e041fbdf2d05c70d72baa59af5f584373ab54d751b6543087a9afd4313774e058f020486728b8 - languageName: node - linkType: hard - "err-code@npm:^2.0.2": version: 2.0.3 resolution: "err-code@npm:2.0.3" @@ -13757,6 +13818,22 @@ __metadata: languageName: node linkType: hard +"es-define-property@npm:^1.0.0": + version: 1.0.0 + resolution: "es-define-property@npm:1.0.0" + dependencies: + get-intrinsic: ^1.2.4 + checksum: f66ece0a887b6dca71848fa71f70461357c0e4e7249696f81bad0a1f347eed7b31262af4a29f5d726dc026426f085483b6b90301855e647aa8e21936f07293c6 + languageName: node + linkType: hard + +"es-errors@npm:^1.3.0": + version: 1.3.0 + resolution: "es-errors@npm:1.3.0" + checksum: ec1414527a0ccacd7f15f4a3bc66e215f04f595ba23ca75cdae0927af099b5ec865f9f4d33e9d7e86f512f252876ac77d4281a7871531a50678132429b1271b5 + languageName: node + linkType: hard + "es-get-iterator@npm:^1.0.2, es-get-iterator@npm:^1.1.2": version: 1.1.3 resolution: "es-get-iterator@npm:1.1.3" @@ -14189,7 +14266,7 @@ __metadata: languageName: node linkType: hard -"esprima@npm:^4.0.0, esprima@npm:^4.0.1": +"esprima@npm:^4.0.0, esprima@npm:^4.0.1, esprima@npm:~4.0.0": version: 4.0.1 resolution: "esprima@npm:4.0.1" bin: @@ -14750,6 +14827,16 @@ __metadata: languageName: node linkType: hard +"fetch-cookie@npm:^3.0.0": + version: 3.0.1 + resolution: "fetch-cookie@npm:3.0.1" + dependencies: + set-cookie-parser: ^2.4.8 + tough-cookie: ^4.0.0 + checksum: 01657ccdf6305c3bf9b2375a9aedd6930f803acc77583c02e96a0b3d84068cc9406d2ad4d061a8c4d9c106c021de51dd2aa505a0a05a4477a1a859052f2537a0 + languageName: node + linkType: hard + "fetch-retry@npm:^5.0.2": version: 5.0.4 resolution: "fetch-retry@npm:5.0.4" @@ -14940,6 +15027,15 @@ __metadata: languageName: node linkType: hard +"find-yarn-workspace-root@npm:^2.0.0": + version: 2.0.0 + resolution: "find-yarn-workspace-root@npm:2.0.0" + dependencies: + micromatch: ^4.0.2 + checksum: fa5ca8f9d08fe7a54ce7c0a5931ff9b7e36f9ee7b9475fb13752bcea80ec6b5f180fa5102d60b376d5526ce924ea3fc6b19301262efa0a5d248dd710f3644242 + languageName: node + linkType: hard + "flat-cache@npm:^3.0.4": version: 3.0.4 resolution: "flat-cache@npm:3.0.4" @@ -15259,6 +15355,13 @@ __metadata: languageName: node linkType: hard +"function-bind@npm:^1.1.2": + version: 1.1.2 + resolution: "function-bind@npm:1.1.2" + checksum: 2b0ff4ce708d99715ad14a6d1f894e2a83242e4a52ccfcefaee5e40050562e5f6dafc1adbb4ce2d4ab47279a45dc736ab91ea5042d843c3c092820dfe032efb1 + languageName: node + linkType: hard + "function.prototype.name@npm:^1.1.0, function.prototype.name@npm:^1.1.5": version: 1.1.5 resolution: "function.prototype.name@npm:1.1.5" @@ -15366,6 +15469,19 @@ __metadata: languageName: node linkType: hard +"get-intrinsic@npm:^1.2.4": + version: 1.2.4 + resolution: "get-intrinsic@npm:1.2.4" + dependencies: + es-errors: ^1.3.0 + function-bind: ^1.1.2 + has-proto: ^1.0.1 + has-symbols: ^1.0.3 + hasown: ^2.0.0 + checksum: 414e3cdf2c203d1b9d7d33111df746a4512a1aa622770b361dadddf8ed0b5aeb26c560f49ca077e24bfafb0acb55ca908d1f709216ccba33ffc548ec8a79a951 + languageName: node + linkType: hard + "get-own-enumerable-property-symbols@npm:^3.0.0": version: 3.0.2 resolution: "get-own-enumerable-property-symbols@npm:3.0.2" @@ -15818,6 +15934,15 @@ __metadata: languageName: node linkType: hard +"has-property-descriptors@npm:^1.0.2": + version: 1.0.2 + resolution: "has-property-descriptors@npm:1.0.2" + dependencies: + es-define-property: ^1.0.0 + checksum: fcbb246ea2838058be39887935231c6d5788babed499d0e9d0cc5737494c48aba4fe17ba1449e0d0fbbb1e36175442faa37f9c427ae357d6ccb1d895fbcd3de3 + languageName: node + linkType: hard + "has-proto@npm:^1.0.1": version: 1.0.1 resolution: "has-proto@npm:1.0.1" @@ -15927,6 +16052,15 @@ __metadata: languageName: node linkType: hard +"hasown@npm:^2.0.0": + version: 2.0.2 + resolution: "hasown@npm:2.0.2" + dependencies: + function-bind: ^1.1.2 + checksum: e8516f776a15149ca6c6ed2ae3110c417a00b62260e222590e54aa367cbcd6ed99122020b37b7fbdf05748df57b265e70095d7bf35a47660587619b15ffb93db + languageName: node + linkType: hard + "hast-to-hyperscript@npm:^9.0.0": version: 9.0.1 resolution: "hast-to-hyperscript@npm:9.0.1" @@ -18396,6 +18530,18 @@ __metadata: languageName: node linkType: hard +"json-stable-stringify@npm:^1.0.2": + version: 1.1.1 + resolution: "json-stable-stringify@npm:1.1.1" + dependencies: + call-bind: ^1.0.5 + isarray: ^2.0.5 + jsonify: ^0.0.1 + object-keys: ^1.1.1 + checksum: e1ba06600fd278767eeff53f28e408e29c867e79abf564e7aadc3ce8f31f667258f8db278ef28831e45884dd687388fa1910f46e599fc19fb94c9afbbe3a4de8 + languageName: node + linkType: hard + "json-stringify-safe@npm:^5.0.1, json-stringify-safe@npm:~5.0.1": version: 5.0.1 resolution: "json-stringify-safe@npm:5.0.1" @@ -18436,6 +18582,13 @@ __metadata: languageName: node linkType: hard +"jsonify@npm:^0.0.1": + version: 0.0.1 + resolution: "jsonify@npm:0.0.1" + checksum: 027287e1c0294fce15f18c0ff990cfc2318e7f01fb76515f784d5cd0784abfec6fc5c2355c3a2f2cb0ad7f4aa2f5b74ebbfe4e80476c35b2d13cabdb572e1134 + languageName: node + linkType: hard + "jsonparse@npm:^1.2.0": version: 1.3.1 resolution: "jsonparse@npm:1.3.1" @@ -18530,6 +18683,15 @@ __metadata: languageName: node linkType: hard +"klaw-sync@npm:^6.0.0": + version: 6.0.0 + resolution: "klaw-sync@npm:6.0.0" + dependencies: + graceful-fs: ^4.1.11 + checksum: 0da397f8961313c3ef8f79fb63af9002cde5a8fb2aeb1a37351feff0dd6006129c790400c3f5c3b4e757bedcabb13d21ec0a5eaef5a593d59515d4f2c291e475 + languageName: node + linkType: hard + "kleur@npm:^3.0.3": version: 3.0.3 resolution: "kleur@npm:3.0.3" @@ -18887,10 +19049,10 @@ __metadata: languageName: node linkType: hard -"lossless-json@npm:^2.0.8": - version: 2.0.9 - resolution: "lossless-json@npm:2.0.9" - checksum: 26aebc8c697b6db20a85b8524a46f9d9b7f428cea1b2b504f833b67c162724d089179e5b0666d9b6a81cd92c8acd4c55ae4d66447e83f8883aafc0c51e5df797 +"lossless-json@npm:^4.0.1": + version: 4.0.1 + resolution: "lossless-json@npm:4.0.1" + checksum: 41e89f5b7800cf5f863776542c82d8a19a696e5537865699d5ee062726d069561f7b857e838195496f2a43afe64a7dce475be5a2565822881f39feb0eda5d218 languageName: node linkType: hard @@ -19298,16 +19460,6 @@ __metadata: languageName: node linkType: hard -"micro-starknet@npm:~0.2.1": - version: 0.2.3 - resolution: "micro-starknet@npm:0.2.3" - dependencies: - "@noble/curves": ~1.0.0 - "@noble/hashes": ~1.3.0 - checksum: f1ae152348d1ca0bd0b4d09cb7901aee5cb1e815dcbfb6c3a623d107c169fad00808e154e7ca8abf2b16639a83044bc602c66fc3e0eb0de89a5c81815ff9b2ef - languageName: node - linkType: hard - "microevent.ts@npm:~0.1.1": version: 0.1.1 resolution: "microevent.ts@npm:0.1.1" @@ -20442,7 +20594,7 @@ __metadata: languageName: node linkType: hard -"open@npm:^7.0.3": +"open@npm:^7.0.3, open@npm:^7.4.2": version: 7.4.2 resolution: "open@npm:7.4.2" dependencies: @@ -20522,6 +20674,13 @@ __metadata: languageName: node linkType: hard +"os-tmpdir@npm:~1.0.2": + version: 1.0.2 + resolution: "os-tmpdir@npm:1.0.2" + checksum: 5666560f7b9f10182548bf7013883265be33620b1c1b4a4d405c25be2636f970c5488ff3e6c48de75b55d02bde037249fe5dbfbb4c0fb7714953d56aed062e6d + languageName: node + linkType: hard + "p-all@npm:^2.1.0": version: 2.1.0 resolution: "p-all@npm:2.1.0" @@ -20838,6 +20997,31 @@ __metadata: languageName: node linkType: hard +"patch-package@npm:^8.0.0": + version: 8.0.0 + resolution: "patch-package@npm:8.0.0" + dependencies: + "@yarnpkg/lockfile": ^1.1.0 + chalk: ^4.1.2 + ci-info: ^3.7.0 + cross-spawn: ^7.0.3 + find-yarn-workspace-root: ^2.0.0 + fs-extra: ^9.0.0 + json-stable-stringify: ^1.0.2 + klaw-sync: ^6.0.0 + minimist: ^1.2.6 + open: ^7.4.2 + rimraf: ^2.6.3 + semver: ^7.5.3 + slash: ^2.0.0 + tmp: ^0.0.33 + yaml: ^2.2.2 + bin: + patch-package: index.js + checksum: d23cddc4d1622e2d8c7ca31b145c6eddb24bd271f69905e766de5e1f199f0b9a5479a6a6939ea857288399d4ed249285639d539a2c00fbddb7daa39934b007a2 + languageName: node + linkType: hard + "path-browserify@npm:0.0.1": version: 0.0.1 resolution: "path-browserify@npm:0.0.1" @@ -22050,6 +22234,13 @@ __metadata: languageName: node linkType: hard +"postinstall-postinstall@npm:^2.1.0": + version: 2.1.0 + resolution: "postinstall-postinstall@npm:2.1.0" + checksum: e1d34252cf8d2c5641c7d2db7426ec96e3d7a975f01c174c68f09ef5b8327bc8d5a9aa2001a45e693db2cdbf69577094d3fe6597b564ad2d2202b65fba76134b + languageName: node + linkType: hard + "prelude-ls@npm:^1.2.1": version: 1.2.1 resolution: "prelude-ls@npm:1.2.1" @@ -23051,6 +23242,15 @@ __metadata: languageName: node linkType: hard +"redeyed@npm:~2.1.0": + version: 2.1.1 + resolution: "redeyed@npm:2.1.1" + dependencies: + esprima: ~4.0.0 + checksum: 39a1426e377727cfb47a0e24e95c1cf78d969fbc388dc1e0fa1e2ef8a8756450cefb8b0c2598f63b85f1a331986fca7604c0db798427a5775a1dbdb9c1291979 + languageName: node + linkType: hard + "redux-persist@npm:^6.0.0": version: 6.0.0 resolution: "redux-persist@npm:6.0.0" @@ -23920,7 +24120,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.5.4": +"semver@npm:^7.5.3, semver@npm:^7.5.4": version: 7.6.0 resolution: "semver@npm:7.6.0" dependencies: @@ -24069,6 +24269,27 @@ __metadata: languageName: node linkType: hard +"set-cookie-parser@npm:^2.4.8": + version: 2.6.0 + resolution: "set-cookie-parser@npm:2.6.0" + checksum: bf11ebc594c53d84588f1b4c04f1b8ce14e0498b1c011b3d76b5c6d5aac481bbc3f7c5260ec4ce99bdc1d9aed19f9fc315e73166a36ca74d0f12349a73f6bdc9 + languageName: node + linkType: hard + +"set-function-length@npm:^1.2.1": + version: 1.2.2 + resolution: "set-function-length@npm:1.2.2" + dependencies: + define-data-property: ^1.1.4 + es-errors: ^1.3.0 + function-bind: ^1.1.2 + get-intrinsic: ^1.2.4 + gopd: ^1.0.1 + has-property-descriptors: ^1.0.2 + checksum: a8248bdacdf84cb0fab4637774d9fb3c7a8e6089866d04c817583ff48e14149c87044ce683d7f50759a8c50fb87c7a7e173535b06169c87ef76f5fb276dfff72 + languageName: node + linkType: hard + "set-value@npm:^2.0.0, set-value@npm:^2.0.1": version: 2.0.1 resolution: "set-value@npm:2.0.1" @@ -24649,9 +24870,29 @@ __metadata: "@commitlint/cli": ^17.0.3 "@commitlint/config-conventional": ^17.0.3 husky: ^8.0.0 + patch-package: ^8.0.0 + postinstall-postinstall: ^2.1.0 languageName: unknown linkType: soft +"starknet@npm:6.6.0": + version: 6.6.0 + resolution: "starknet@npm:6.6.0" + dependencies: + "@noble/curves": ~1.3.0 + "@scure/base": ~1.1.3 + "@scure/starknet": ~1.0.0 + abi-wan-kanabi: ^2.2.1 + fetch-cookie: ^3.0.0 + isomorphic-fetch: ^3.0.0 + lossless-json: ^4.0.1 + pako: ^2.0.4 + ts-mixer: ^6.0.3 + url-join: ^4.0.1 + checksum: 62688e4251c5c90ed8f5ba2e49c1af60b229091d845bf00b2735abbe8709b22258c42e91bbe78f5edd4cdfb3f01c0d24acb3d41763523b9b61929b0a03238297 + languageName: node + linkType: hard + "starknet@npm:^4.22.0, starknet_v4.22.0@npm:starknet@4.22.0": version: 4.22.0 resolution: "starknet@npm:4.22.0" @@ -24671,20 +24912,6 @@ __metadata: languageName: node linkType: hard -"starknet@npm:^5.14.0": - version: 5.16.0 - resolution: "starknet@npm:5.16.0" - dependencies: - "@noble/curves": ~1.0.0 - isomorphic-fetch: ^3.0.0 - lossless-json: ^2.0.8 - micro-starknet: ~0.2.1 - pako: ^2.0.4 - url-join: ^4.0.1 - checksum: 745e68d698aacb4836fb638a907b9844c566f0a3a169a80722eef73c7d0c48fe1a31a458f32ed248bc63587e4b3811067ae37e3e573d84bec1a205cd45e678db - languageName: node - linkType: hard - "state-toggle@npm:^1.0.0": version: 1.0.3 resolution: "state-toggle@npm:1.0.3" @@ -25640,7 +25867,7 @@ __metadata: languageName: node linkType: hard -"through@npm:2, through@npm:>=2.2.7 <3, through@npm:~2.3.4": +"through@npm:2, through@npm:>=2.2.7 <3": version: 2.3.8 resolution: "through@npm:2.3.8" checksum: a38c3e059853c494af95d50c072b83f8b676a9ba2818dcc5b108ef252230735c54e0185437618596c790bbba8fcdaef5b290405981ffa09dce67b1f1bf190cbd @@ -25672,6 +25899,15 @@ __metadata: languageName: node linkType: hard +"tmp@npm:^0.0.33": + version: 0.0.33 + resolution: "tmp@npm:0.0.33" + dependencies: + os-tmpdir: ~1.0.2 + checksum: 902d7aceb74453ea02abbf58c203f4a8fc1cead89b60b31e354f74ed5b3fb09ea817f94fb310f884a5d16987dd9fa5a735412a7c2dd088dd3d415aa819ae3a28 + languageName: node + linkType: hard + "tmpl@npm:1.0.5": version: 1.0.5 resolution: "tmpl@npm:1.0.5" @@ -25862,6 +26098,13 @@ __metadata: languageName: node linkType: hard +"ts-mixer@npm:^6.0.3": + version: 6.0.4 + resolution: "ts-mixer@npm:6.0.4" + checksum: 36b1af526befd74345e736e9aa16f5c28876ebcea07784da14d929149fd7e6028cfd2fe9304c8efe8cb91b588443a9cc9e991df58e4c6e602326edbaae2af3ab + languageName: node + linkType: hard + "ts-node@npm:^10.8.1": version: 10.9.1 resolution: "ts-node@npm:10.9.1" @@ -27824,6 +28067,15 @@ __metadata: languageName: node linkType: hard +"yaml@npm:^2.2.2": + version: 2.4.1 + resolution: "yaml@npm:2.4.1" + bin: + yaml: bin.mjs + checksum: 4c391d07a5d5e935e058babb71026c9cdc9a6fd889e35dd91b53cfb0a12691b67c6c5c740858e71345fef18cd9c13c554a6dda9196f59820d769d94041badb0b + languageName: node + linkType: hard + "yargs-parser@npm:20.2.4": version: 20.2.4 resolution: "yargs-parser@npm:20.2.4" @@ -27916,7 +28168,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:^17.7.1": +"yargs@npm:^17.7.1, yargs@npm:^17.7.2": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: From 687dde107159c3dc4444ccd978614452678cf36d Mon Sep 17 00:00:00 2001 From: stanleyyuen <102275989+stanleyyconsensys@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:57:55 +0800 Subject: [PATCH 2/6] chore: remove unuse script --- packages/starknet-snap/package.json | 3 +-- yarn.lock | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/starknet-snap/package.json b/packages/starknet-snap/package.json index a069e75f..3a0d4257 100644 --- a/packages/starknet-snap/package.json +++ b/packages/starknet-snap/package.json @@ -20,8 +20,7 @@ "lint:fix": "eslint '**/*.{js,ts,tsx}' --fix", "test": "yarn run test:unit && yarn run cover:report", "test:unit": "nyc --check-coverage --statements 80 --branches 80 --functions 80 --lines 80 mocha --colors -r ts-node/register \"test/**/*.test.ts\"", - "cover:report": "nyc report --reporter=lcov --reporter=text", - "postinstall": "patch-package" + "cover:report": "nyc report --reporter=lcov --reporter=text" }, "keywords": [], "author": "", diff --git a/yarn.lock b/yarn.lock index 1ac1761d..7eb9934c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3155,7 +3155,7 @@ __metadata: "@consensys/starknet-snap@file:../starknet-snap::locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui": version: 2.5.2 - resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=361b19&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" + resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=4cd730&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" dependencies: "@metamask/snaps-sdk": 3.0.1 async-mutex: ^0.3.2 @@ -3164,7 +3164,7 @@ __metadata: ethers: ^5.5.1 starknet: 6.6.0 starknet_v4.22.0: "npm:starknet@4.22.0" - checksum: dc8a3354e0ec4863c9ff6d2841abeb0ea841f69519202d1c1b904308024a7ff76f3d44a1cfa91d043739ce807aa7b8513d06baf7cb357475450d653a39f89efd + checksum: 5efd2170f2bd28a61facd0cf96d62fd4d8ce67400381e58bddf0f30aee511d426f3154981f02ff0a20ed2e8402aec23a9160ee7f0a5f965461e22c660685bcee languageName: node linkType: hard From 968d20c55f7b31cf24c481a168a4f04bd5cca759 Mon Sep 17 00:00:00 2001 From: stanleyyuen <102275989+stanleyyconsensys@users.noreply.github.com> Date: Fri, 22 Mar 2024 10:08:17 +0800 Subject: [PATCH 3/6] chore: add default config --- packages/starknet-snap/snap.config.js | 2 +- packages/starknet-snap/snap.manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/starknet-snap/snap.config.js b/packages/starknet-snap/snap.config.js index 1a3ea7f1..f3cb5cd0 100644 --- a/packages/starknet-snap/snap.config.js +++ b/packages/starknet-snap/snap.config.js @@ -4,7 +4,7 @@ dotenv.config(); module.exports = { bundler: "webpack", environment: { - SNAP_ENV: process.env.SNAP_ENV, + SNAP_ENV: process.env.SNAP_ENV ?? "prod", }, input: "./src/index.ts", server: { diff --git a/packages/starknet-snap/snap.manifest.json b/packages/starknet-snap/snap.manifest.json index 232f8020..9041a6c7 100644 --- a/packages/starknet-snap/snap.manifest.json +++ b/packages/starknet-snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/ConsenSys/starknet-snap.git" }, "source": { - "shasum": "MZqJ3vs3WpVx0cflacDwaqUeAdsZELDONCo0LbR84UI=", + "shasum": "3xEYKygpVtx7plIQWyXsnBvZuH8danFLXmGngqQVb9U=", "location": { "npm": { "filePath": "dist/bundle.js", From 553431a7c3367cac3c6d90bef8a3a45739a0f5bc Mon Sep 17 00:00:00 2001 From: stanleyyuen <102275989+stanleyyconsensys@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:12:10 +0800 Subject: [PATCH 4/6] chore: remove patching --- package.json | 9 +- packages/starknet-snap/package.json | 2 +- packages/starknet-snap/snap.manifest.json | 2 +- patches/starknet+6.6.0.patch | 28 --- yarn.lock | 222 +--------------------- 5 files changed, 15 insertions(+), 248 deletions(-) delete mode 100644 patches/starknet+6.6.0.patch diff --git a/package.json b/package.json index b8f10e55..8bc025bf 100644 --- a/package.json +++ b/package.json @@ -9,20 +9,17 @@ "packages/*" ], "scripts": { - "setup": "yarn workspaces foreach run setup && yarn postinstall", + "setup": "yarn workspaces foreach run setup", "build": "yarn workspaces foreach run build", "test": "yarn workspace @consensys/starknet-snap run test", "lint": "yarn workspaces foreach run lint", "clean": "yarn workspaces foreach run clean", - "prepare": "husky install", - "postinstall": "patch-package" + "prepare": "husky install" }, "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "husky": "^8.0.0", - "patch-package": "^8.0.0", - "postinstall-postinstall": "^2.1.0" + "husky": "^8.0.0" }, "resolutions": { "luxon@^3.2.1": "patch:luxon@npm%3A3.3.0#./.yarn/patches/luxon-npm-3.3.0-bdbae9bfd5.patch" diff --git a/packages/starknet-snap/package.json b/packages/starknet-snap/package.json index 3a0d4257..68c97388 100644 --- a/packages/starknet-snap/package.json +++ b/packages/starknet-snap/package.json @@ -56,7 +56,7 @@ "dotenv": "^16.4.5", "ethereum-unit-converter": "^0.0.17", "ethers": "^5.5.1", - "starknet": "6.6.0", + "starknet": "6.6.6", "starknet_v4.22.0": "npm:starknet@4.22.0" }, "publishConfig": { diff --git a/packages/starknet-snap/snap.manifest.json b/packages/starknet-snap/snap.manifest.json index 9041a6c7..c0e50222 100644 --- a/packages/starknet-snap/snap.manifest.json +++ b/packages/starknet-snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/ConsenSys/starknet-snap.git" }, "source": { - "shasum": "3xEYKygpVtx7plIQWyXsnBvZuH8danFLXmGngqQVb9U=", + "shasum": "YbuYD0p5mRtllKx98NNZ9YIz+G7QBvd3iW1S6Vc1kjg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/patches/starknet+6.6.0.patch b/patches/starknet+6.6.0.patch deleted file mode 100644 index 1f17c21e..00000000 --- a/patches/starknet+6.6.0.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/node_modules/starknet/dist/index.js b/node_modules/starknet/dist/index.js -index 1569354..fb8d569 100644 ---- a/node_modules/starknet/dist/index.js -+++ b/node_modules/starknet/dist/index.js -@@ -5832,7 +5832,7 @@ var Account = class extends RpcProvider2 { - return this.estimateInvokeFee(calls, details); - } - async estimateFeeBulk(invocations, details = {}) { -- const { nonce, blockIdentifier, version } = details; -+ const { nonce, blockIdentifier, version, skipValidate } = details; - const accountInvocations = await this.accountInvocationsFactory(invocations, { - ...v3Details(details), - versions: [ -@@ -5845,11 +5845,12 @@ var Account = class extends RpcProvider2 { - // sierra - ], - nonce, -- blockIdentifier -+ blockIdentifier, -+ skipValidate - }); - return super.getEstimateFeeBulk(accountInvocations, { - blockIdentifier, -- skipValidate: details.skipValidate -+ skipValidate: skipValidate - }); - } - async simulateTransaction(invocations, details = {}) { diff --git a/yarn.lock b/yarn.lock index 7eb9934c..e2511ab5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3155,16 +3155,16 @@ __metadata: "@consensys/starknet-snap@file:../starknet-snap::locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui": version: 2.5.2 - resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=4cd730&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" + resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=c9e0f9&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" 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: 6.6.0 + starknet: 6.6.6 starknet_v4.22.0: "npm:starknet@4.22.0" - checksum: 5efd2170f2bd28a61facd0cf96d62fd4d8ce67400381e58bddf0f30aee511d426f3154981f02ff0a20ed2e8402aec23a9160ee7f0a5f965461e22c660685bcee + checksum: fa3dc727767684fad1788e3fec62d5b3b4e7ba2ac333360303cfceac46186f71cfb6b87d2fce866cda27f9b36e3977ff0405e73fa389d567d5ee38671a99377c languageName: node linkType: hard @@ -3199,7 +3199,7 @@ __metadata: sinon: ^13.0.2 sinon-chai: ^3.7.0 standard-version: ^9.5.0 - starknet: 6.6.0 + starknet: 6.6.6 starknet_v4.22.0: "npm:starknet@4.22.0" ts-node: ^10.8.1 typescript: ^4.6.3 @@ -8998,13 +8998,6 @@ __metadata: languageName: node linkType: hard -"@yarnpkg/lockfile@npm:^1.1.0": - version: 1.1.0 - resolution: "@yarnpkg/lockfile@npm:1.1.0" - checksum: 05b881b4866a3546861fee756e6d3812776ea47fa6eb7098f983d6d0eefa02e12b66c3fff931574120f196286a7ad4879ce02743c8bb2be36c6a576c7852083a - languageName: node - linkType: hard - "JSONStream@npm:^1.0.3, JSONStream@npm:^1.0.4": version: 1.3.5 resolution: "JSONStream@npm:1.3.5" @@ -11026,19 +11019,6 @@ __metadata: languageName: node linkType: hard -"call-bind@npm:^1.0.5": - version: 1.0.7 - resolution: "call-bind@npm:1.0.7" - dependencies: - es-define-property: ^1.0.0 - es-errors: ^1.3.0 - function-bind: ^1.1.2 - get-intrinsic: ^1.2.4 - set-function-length: ^1.2.1 - checksum: 295c0c62b90dd6522e6db3b0ab1ce26bdf9e7404215bda13cfee25b626b5ff1a7761324d58d38b1ef1607fc65aca2d06e44d2e18d0dfc6c14b465b00d8660029 - languageName: node - linkType: hard - "call-me-maybe@npm:^1.0.1": version: 1.0.2 resolution: "call-me-maybe@npm:1.0.2" @@ -11389,13 +11369,6 @@ __metadata: languageName: node linkType: hard -"ci-info@npm:^3.7.0": - version: 3.9.0 - resolution: "ci-info@npm:3.9.0" - checksum: 6b19dc9b2966d1f8c2041a838217299718f15d6c4b63ae36e4674edd2bee48f780e94761286a56aa59eb305a85fbea4ddffb7630ec063e7ec7e7e5ad42549a87 - languageName: node - linkType: hard - "cipher-base@npm:^1.0.0, cipher-base@npm:^1.0.1, cipher-base@npm:^1.0.3": version: 1.0.4 resolution: "cipher-base@npm:1.0.4" @@ -13028,17 +13001,6 @@ __metadata: languageName: node linkType: hard -"define-data-property@npm:^1.1.4": - version: 1.1.4 - resolution: "define-data-property@npm:1.1.4" - dependencies: - es-define-property: ^1.0.0 - es-errors: ^1.3.0 - gopd: ^1.0.1 - checksum: 8068ee6cab694d409ac25936eb861eea704b7763f7f342adbdfe337fc27c78d7ae0eff2364b2917b58c508d723c7a074326d068eef2e45c4edcd85cf94d0313b - languageName: node - linkType: hard - "define-lazy-prop@npm:^2.0.0": version: 2.0.0 resolution: "define-lazy-prop@npm:2.0.0" @@ -13818,22 +13780,6 @@ __metadata: languageName: node linkType: hard -"es-define-property@npm:^1.0.0": - version: 1.0.0 - resolution: "es-define-property@npm:1.0.0" - dependencies: - get-intrinsic: ^1.2.4 - checksum: f66ece0a887b6dca71848fa71f70461357c0e4e7249696f81bad0a1f347eed7b31262af4a29f5d726dc026426f085483b6b90301855e647aa8e21936f07293c6 - languageName: node - linkType: hard - -"es-errors@npm:^1.3.0": - version: 1.3.0 - resolution: "es-errors@npm:1.3.0" - checksum: ec1414527a0ccacd7f15f4a3bc66e215f04f595ba23ca75cdae0927af099b5ec865f9f4d33e9d7e86f512f252876ac77d4281a7871531a50678132429b1271b5 - languageName: node - linkType: hard - "es-get-iterator@npm:^1.0.2, es-get-iterator@npm:^1.1.2": version: 1.1.3 resolution: "es-get-iterator@npm:1.1.3" @@ -15027,15 +14973,6 @@ __metadata: languageName: node linkType: hard -"find-yarn-workspace-root@npm:^2.0.0": - version: 2.0.0 - resolution: "find-yarn-workspace-root@npm:2.0.0" - dependencies: - micromatch: ^4.0.2 - checksum: fa5ca8f9d08fe7a54ce7c0a5931ff9b7e36f9ee7b9475fb13752bcea80ec6b5f180fa5102d60b376d5526ce924ea3fc6b19301262efa0a5d248dd710f3644242 - languageName: node - linkType: hard - "flat-cache@npm:^3.0.4": version: 3.0.4 resolution: "flat-cache@npm:3.0.4" @@ -15355,13 +15292,6 @@ __metadata: languageName: node linkType: hard -"function-bind@npm:^1.1.2": - version: 1.1.2 - resolution: "function-bind@npm:1.1.2" - checksum: 2b0ff4ce708d99715ad14a6d1f894e2a83242e4a52ccfcefaee5e40050562e5f6dafc1adbb4ce2d4ab47279a45dc736ab91ea5042d843c3c092820dfe032efb1 - languageName: node - linkType: hard - "function.prototype.name@npm:^1.1.0, function.prototype.name@npm:^1.1.5": version: 1.1.5 resolution: "function.prototype.name@npm:1.1.5" @@ -15469,19 +15399,6 @@ __metadata: languageName: node linkType: hard -"get-intrinsic@npm:^1.2.4": - version: 1.2.4 - resolution: "get-intrinsic@npm:1.2.4" - dependencies: - es-errors: ^1.3.0 - function-bind: ^1.1.2 - has-proto: ^1.0.1 - has-symbols: ^1.0.3 - hasown: ^2.0.0 - checksum: 414e3cdf2c203d1b9d7d33111df746a4512a1aa622770b361dadddf8ed0b5aeb26c560f49ca077e24bfafb0acb55ca908d1f709216ccba33ffc548ec8a79a951 - languageName: node - linkType: hard - "get-own-enumerable-property-symbols@npm:^3.0.0": version: 3.0.2 resolution: "get-own-enumerable-property-symbols@npm:3.0.2" @@ -15934,15 +15851,6 @@ __metadata: languageName: node linkType: hard -"has-property-descriptors@npm:^1.0.2": - version: 1.0.2 - resolution: "has-property-descriptors@npm:1.0.2" - dependencies: - es-define-property: ^1.0.0 - checksum: fcbb246ea2838058be39887935231c6d5788babed499d0e9d0cc5737494c48aba4fe17ba1449e0d0fbbb1e36175442faa37f9c427ae357d6ccb1d895fbcd3de3 - languageName: node - linkType: hard - "has-proto@npm:^1.0.1": version: 1.0.1 resolution: "has-proto@npm:1.0.1" @@ -16052,15 +15960,6 @@ __metadata: languageName: node linkType: hard -"hasown@npm:^2.0.0": - version: 2.0.2 - resolution: "hasown@npm:2.0.2" - dependencies: - function-bind: ^1.1.2 - checksum: e8516f776a15149ca6c6ed2ae3110c417a00b62260e222590e54aa367cbcd6ed99122020b37b7fbdf05748df57b265e70095d7bf35a47660587619b15ffb93db - languageName: node - linkType: hard - "hast-to-hyperscript@npm:^9.0.0": version: 9.0.1 resolution: "hast-to-hyperscript@npm:9.0.1" @@ -18530,18 +18429,6 @@ __metadata: languageName: node linkType: hard -"json-stable-stringify@npm:^1.0.2": - version: 1.1.1 - resolution: "json-stable-stringify@npm:1.1.1" - dependencies: - call-bind: ^1.0.5 - isarray: ^2.0.5 - jsonify: ^0.0.1 - object-keys: ^1.1.1 - checksum: e1ba06600fd278767eeff53f28e408e29c867e79abf564e7aadc3ce8f31f667258f8db278ef28831e45884dd687388fa1910f46e599fc19fb94c9afbbe3a4de8 - languageName: node - linkType: hard - "json-stringify-safe@npm:^5.0.1, json-stringify-safe@npm:~5.0.1": version: 5.0.1 resolution: "json-stringify-safe@npm:5.0.1" @@ -18582,13 +18469,6 @@ __metadata: languageName: node linkType: hard -"jsonify@npm:^0.0.1": - version: 0.0.1 - resolution: "jsonify@npm:0.0.1" - checksum: 027287e1c0294fce15f18c0ff990cfc2318e7f01fb76515f784d5cd0784abfec6fc5c2355c3a2f2cb0ad7f4aa2f5b74ebbfe4e80476c35b2d13cabdb572e1134 - languageName: node - linkType: hard - "jsonparse@npm:^1.2.0": version: 1.3.1 resolution: "jsonparse@npm:1.3.1" @@ -18683,15 +18563,6 @@ __metadata: languageName: node linkType: hard -"klaw-sync@npm:^6.0.0": - version: 6.0.0 - resolution: "klaw-sync@npm:6.0.0" - dependencies: - graceful-fs: ^4.1.11 - checksum: 0da397f8961313c3ef8f79fb63af9002cde5a8fb2aeb1a37351feff0dd6006129c790400c3f5c3b4e757bedcabb13d21ec0a5eaef5a593d59515d4f2c291e475 - languageName: node - linkType: hard - "kleur@npm:^3.0.3": version: 3.0.3 resolution: "kleur@npm:3.0.3" @@ -20594,7 +20465,7 @@ __metadata: languageName: node linkType: hard -"open@npm:^7.0.3, open@npm:^7.4.2": +"open@npm:^7.0.3": version: 7.4.2 resolution: "open@npm:7.4.2" dependencies: @@ -20674,13 +20545,6 @@ __metadata: languageName: node linkType: hard -"os-tmpdir@npm:~1.0.2": - version: 1.0.2 - resolution: "os-tmpdir@npm:1.0.2" - checksum: 5666560f7b9f10182548bf7013883265be33620b1c1b4a4d405c25be2636f970c5488ff3e6c48de75b55d02bde037249fe5dbfbb4c0fb7714953d56aed062e6d - languageName: node - linkType: hard - "p-all@npm:^2.1.0": version: 2.1.0 resolution: "p-all@npm:2.1.0" @@ -20997,31 +20861,6 @@ __metadata: languageName: node linkType: hard -"patch-package@npm:^8.0.0": - version: 8.0.0 - resolution: "patch-package@npm:8.0.0" - dependencies: - "@yarnpkg/lockfile": ^1.1.0 - chalk: ^4.1.2 - ci-info: ^3.7.0 - cross-spawn: ^7.0.3 - find-yarn-workspace-root: ^2.0.0 - fs-extra: ^9.0.0 - json-stable-stringify: ^1.0.2 - klaw-sync: ^6.0.0 - minimist: ^1.2.6 - open: ^7.4.2 - rimraf: ^2.6.3 - semver: ^7.5.3 - slash: ^2.0.0 - tmp: ^0.0.33 - yaml: ^2.2.2 - bin: - patch-package: index.js - checksum: d23cddc4d1622e2d8c7ca31b145c6eddb24bd271f69905e766de5e1f199f0b9a5479a6a6939ea857288399d4ed249285639d539a2c00fbddb7daa39934b007a2 - languageName: node - linkType: hard - "path-browserify@npm:0.0.1": version: 0.0.1 resolution: "path-browserify@npm:0.0.1" @@ -22234,13 +22073,6 @@ __metadata: languageName: node linkType: hard -"postinstall-postinstall@npm:^2.1.0": - version: 2.1.0 - resolution: "postinstall-postinstall@npm:2.1.0" - checksum: e1d34252cf8d2c5641c7d2db7426ec96e3d7a975f01c174c68f09ef5b8327bc8d5a9aa2001a45e693db2cdbf69577094d3fe6597b564ad2d2202b65fba76134b - languageName: node - linkType: hard - "prelude-ls@npm:^1.2.1": version: 1.2.1 resolution: "prelude-ls@npm:1.2.1" @@ -24120,7 +23952,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.5.3, semver@npm:^7.5.4": +"semver@npm:^7.5.4": version: 7.6.0 resolution: "semver@npm:7.6.0" dependencies: @@ -24276,20 +24108,6 @@ __metadata: languageName: node linkType: hard -"set-function-length@npm:^1.2.1": - version: 1.2.2 - resolution: "set-function-length@npm:1.2.2" - dependencies: - define-data-property: ^1.1.4 - es-errors: ^1.3.0 - function-bind: ^1.1.2 - get-intrinsic: ^1.2.4 - gopd: ^1.0.1 - has-property-descriptors: ^1.0.2 - checksum: a8248bdacdf84cb0fab4637774d9fb3c7a8e6089866d04c817583ff48e14149c87044ce683d7f50759a8c50fb87c7a7e173535b06169c87ef76f5fb276dfff72 - languageName: node - linkType: hard - "set-value@npm:^2.0.0, set-value@npm:^2.0.1": version: 2.0.1 resolution: "set-value@npm:2.0.1" @@ -24870,14 +24688,12 @@ __metadata: "@commitlint/cli": ^17.0.3 "@commitlint/config-conventional": ^17.0.3 husky: ^8.0.0 - patch-package: ^8.0.0 - postinstall-postinstall: ^2.1.0 languageName: unknown linkType: soft -"starknet@npm:6.6.0": - version: 6.6.0 - resolution: "starknet@npm:6.6.0" +"starknet@npm:6.6.6": + version: 6.6.6 + resolution: "starknet@npm:6.6.6" dependencies: "@noble/curves": ~1.3.0 "@scure/base": ~1.1.3 @@ -24889,7 +24705,7 @@ __metadata: pako: ^2.0.4 ts-mixer: ^6.0.3 url-join: ^4.0.1 - checksum: 62688e4251c5c90ed8f5ba2e49c1af60b229091d845bf00b2735abbe8709b22258c42e91bbe78f5edd4cdfb3f01c0d24acb3d41763523b9b61929b0a03238297 + checksum: b1a2ddab6f393be61c65bb5d426ddd631be6958f30671ba71aaeea237af1a1c5163941c9149e20f5701975855bccf0ab184f2a21ceee7ad5a4b974a46b7ffc1c languageName: node linkType: hard @@ -25899,15 +25715,6 @@ __metadata: languageName: node linkType: hard -"tmp@npm:^0.0.33": - version: 0.0.33 - resolution: "tmp@npm:0.0.33" - dependencies: - os-tmpdir: ~1.0.2 - checksum: 902d7aceb74453ea02abbf58c203f4a8fc1cead89b60b31e354f74ed5b3fb09ea817f94fb310f884a5d16987dd9fa5a735412a7c2dd088dd3d415aa819ae3a28 - languageName: node - linkType: hard - "tmpl@npm:1.0.5": version: 1.0.5 resolution: "tmpl@npm:1.0.5" @@ -28067,15 +27874,6 @@ __metadata: languageName: node linkType: hard -"yaml@npm:^2.2.2": - version: 2.4.1 - resolution: "yaml@npm:2.4.1" - bin: - yaml: bin.mjs - checksum: 4c391d07a5d5e935e058babb71026c9cdc9a6fd889e35dd91b53cfb0a12691b67c6c5c740858e71345fef18cd9c13c554a6dda9196f59820d769d94041badb0b - languageName: node - linkType: hard - "yargs-parser@npm:20.2.4": version: 20.2.4 resolution: "yargs-parser@npm:20.2.4" From 5de9e98bce1120e098f0a204ddc13e0f34aac17e Mon Sep 17 00:00:00 2001 From: stanleyyuen <102275989+stanleyyconsensys@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:28:37 +0800 Subject: [PATCH 5/6] chore: update library version --- packages/starknet-snap/package.json | 2 +- packages/starknet-snap/snap.config.js | 2 +- packages/starknet-snap/snap.manifest.json | 2 +- packages/starknet-snap/src/signTransaction.ts | 3 +- packages/starknet-snap/src/types/snapApi.ts | 1 - .../starknet-snap/src/utils/starknetUtils.ts | 24 +++------ packages/starknet-snap/test/constants.test.ts | 2 +- yarn.lock | 54 +++++++++++++------ 8 files changed, 52 insertions(+), 38 deletions(-) diff --git a/packages/starknet-snap/package.json b/packages/starknet-snap/package.json index e8769dee..a3f6982e 100644 --- a/packages/starknet-snap/package.json +++ b/packages/starknet-snap/package.json @@ -56,7 +56,7 @@ "dotenv": "^16.4.5", "ethereum-unit-converter": "^0.0.17", "ethers": "^5.5.1", - "starknet": "6.6.6", + "starknet": "6.7.0", "starknet_v4.22.0": "npm:starknet@4.22.0" }, "publishConfig": { diff --git a/packages/starknet-snap/snap.config.js b/packages/starknet-snap/snap.config.js index c0b015ff..43ca1d0c 100644 --- a/packages/starknet-snap/snap.config.js +++ b/packages/starknet-snap/snap.config.js @@ -5,7 +5,7 @@ module.exports = { bundler: "webpack", environment: { SNAP_ENV: process.env.SNAP_ENV ?? "prod", - VOYAGER_API_KEY: process.env.VOYAGER_API_KEY, + VOYAGER_API_KEY: process.env.VOYAGER_API_KEY ?? "", }, input: "./src/index.ts", server: { diff --git a/packages/starknet-snap/snap.manifest.json b/packages/starknet-snap/snap.manifest.json index 7057c907..b058edfe 100644 --- a/packages/starknet-snap/snap.manifest.json +++ b/packages/starknet-snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/ConsenSys/starknet-snap.git" }, "source": { - "shasum": "YbuYD0p5mRtllKx98NNZ9YIz+G7QBvd3iW1S6Vc1kjg=", + "shasum": "trDDU4ANftSs6SE0RJK3uXaxRnCBq7fvgptzA280SPA=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/starknet-snap/src/signTransaction.ts b/packages/starknet-snap/src/signTransaction.ts index 3c2ec4ad..b2b6718f 100644 --- a/packages/starknet-snap/src/signTransaction.ts +++ b/packages/starknet-snap/src/signTransaction.ts @@ -34,8 +34,7 @@ export async function signTransaction(params: ApiParams): Promise { providerParam = { nodeUrl: network.nodeUrl, }; - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return new Provider(providerParam) as unknown as ProviderInterface; + return new Provider(providerParam); }; export const callContract = async ( @@ -318,7 +317,7 @@ export const getMassagedTransactions = async ( } catch (err) { logger.error(`getMassagedTransactions: error received from getTransaction: ${err}`); } - + const massagedTxn: Transaction = { txnHash: txnResp.transaction_hash || txn.hash, txnType: txn.type?.toLowerCase(), @@ -395,7 +394,7 @@ export function getFullPublicKeyPairFromPrivateKey(privateKey: string) { export const getTypedDataMessageSignature = ( privateKey: string, - typedDataMessage: typedData.TypedData, + typedDataMessage: TypedData, signerUserAddress: string, ) => { const msgHash = typedData.getMessageHash(typedDataMessage, signerUserAddress); @@ -408,7 +407,7 @@ export const getSignatureBySignatureString = (signatureStr: string) => { export const verifyTypedDataMessageSignature = ( fullPublicKey: string, - typedDataMessage: typedData.TypedData, + typedDataMessage: TypedData, signerUserAddress: num.BigNumberish, signatureStr: string, ) => { @@ -537,13 +536,10 @@ export const validateAndParseAddress = (address: num.BigNumberish, length = 63) export const signTransactions = async ( privateKey: string, transactions: Call[], - transactionsDetail: InvocationsSignerDetails, - abis: Abi[], + transactionsDetail: InvocationsSignerDetails ): Promise => { const signer = new Signer(privateKey); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - const signatures = await signer.signTransaction(transactions, transactionsDetail, abis); + const signatures = await signer.signTransaction(transactions, transactionsDetail); return stark.signatureToDecimalArray(signatures); }; @@ -565,11 +561,7 @@ export const signDeclareTransaction = async ( return stark.signatureToDecimalArray(signatures); }; -export const signMessage = async ( - privateKey: string, - typedDataMessage: typedData.TypedData, - signerUserAddress: string, -) => { +export const signMessage = async (privateKey: string, typedDataMessage: TypedData, signerUserAddress: string) => { const signer = new Signer(privateKey); const signatures = await signer.signMessage(typedDataMessage, signerUserAddress); return stark.signatureToDecimalArray(signatures); diff --git a/packages/starknet-snap/test/constants.test.ts b/packages/starknet-snap/test/constants.test.ts index 4076e991..cb406abb 100644 --- a/packages/starknet-snap/test/constants.test.ts +++ b/packages/starknet-snap/test/constants.test.ts @@ -1,5 +1,5 @@ import { JsonBIP44CoinTypeNode } from '@metamask/key-tree'; -import { EstimateFee, GetTransactionResponse, num } from 'starknet'; +import { EstimateFee, GetTransactionResponse, num } from 'starknet'; import { AccContract, Erc20Token, diff --git a/yarn.lock b/yarn.lock index c500cf0b..68a10d83 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3154,17 +3154,17 @@ __metadata: linkType: hard "@consensys/starknet-snap@file:../starknet-snap::locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui": - version: 2.5.2 - resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=8a6ae2&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" + version: 2.6.1 + resolution: "@consensys/starknet-snap@file:../starknet-snap#../starknet-snap::hash=33b3e4&locator=wallet-ui%40workspace%3Apackages%2Fwallet-ui" 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: 6.6.6 + starknet: 6.7.0 starknet_v4.22.0: "npm:starknet@4.22.0" - checksum: fa3dc727767684fad1788e3fec62d5b3b4e7ba2ac333360303cfceac46186f71cfb6b87d2fce866cda27f9b36e3977ff0405e73fa389d567d5ee38671a99377c + checksum: c19932a7c1a7887e2183ed8702394a595f24c1b193bbc109bd06b75b14479ad34655a060ebd5bb84dd8392b6fcbeff8cb39e1e1e70f37a4f059a3f8437a68b70 languageName: node linkType: hard @@ -3199,7 +3199,7 @@ __metadata: sinon: ^13.0.2 sinon-chai: ^3.7.0 standard-version: ^9.5.0 - starknet: 6.6.6 + starknet: 6.7.0 starknet_v4.22.0: "npm:starknet@4.22.0" ts-node: ^10.8.1 typescript: ^4.6.3 @@ -5482,6 +5482,15 @@ __metadata: languageName: node linkType: hard +"@noble/curves@npm:~1.4.0": + version: 1.4.0 + resolution: "@noble/curves@npm:1.4.0" + dependencies: + "@noble/hashes": 1.4.0 + checksum: 0014ff561d16e98da4a57e2310a4015e4bdab3b1e1eafcd18d3f9b955c29c3501452ca5d702fddf8ca92d570bbeadfbe53fe16ebbd81a319c414f739154bb26b + languageName: node + linkType: hard + "@noble/ed25519@npm:^1.6.0": version: 1.7.3 resolution: "@noble/ed25519@npm:1.7.3" @@ -5503,6 +5512,13 @@ __metadata: languageName: node linkType: hard +"@noble/hashes@npm:1.4.0": + version: 1.4.0 + resolution: "@noble/hashes@npm:1.4.0" + checksum: 8ba816ae26c90764b8c42493eea383716396096c5f7ba6bea559993194f49d80a73c081f315f4c367e51bd2d5891700bcdfa816b421d24ab45b41cb03e4f3342 + languageName: node + linkType: hard + "@noble/hashes@npm:~1.1.1": version: 1.1.5 resolution: "@noble/hashes@npm:1.1.5" @@ -9024,9 +9040,9 @@ __metadata: languageName: node linkType: hard -"abi-wan-kanabi@npm:^2.2.1": - version: 2.2.1 - resolution: "abi-wan-kanabi@npm:2.2.1" +"abi-wan-kanabi@npm:^2.2.2": + version: 2.2.2 + resolution: "abi-wan-kanabi@npm:2.2.2" dependencies: ansicolors: ^0.3.2 cardinal: ^2.1.1 @@ -9034,7 +9050,7 @@ __metadata: yargs: ^17.7.2 bin: generate: dist/generate.js - checksum: 1567dd8c962a735d79f546b463bbce063fe202f823112bc8713ac14213e814417cbdc25cdd95299889aae5664ed44febf843833924e754a992e705053084fda0 + checksum: 4cf69171887c243a4b5857653f791f3b2042eba93a7326fe03120355cb9f0e29944b91650f96ad739bffad7d8ec9d88c71eeb0debe57df3cd905a1b7c9c2c4a8 languageName: node linkType: hard @@ -24691,21 +24707,29 @@ __metadata: languageName: unknown linkType: soft -"starknet@npm:6.6.6": - version: 6.6.6 - resolution: "starknet@npm:6.6.6" +"starknet-types@npm:^0.0.4": + version: 0.0.4 + resolution: "starknet-types@npm:0.0.4" + checksum: a83d306830696ea875b8b07541db47e515a4ddb7bfce0cf5555cce12c8ce0e697b984762720c7f27761dc4114b4e5d3f81006e82fc45e52b052afe8fc86240fa + languageName: node + linkType: hard + +"starknet@npm:6.7.0": + version: 6.7.0 + resolution: "starknet@npm:6.7.0" dependencies: - "@noble/curves": ~1.3.0 + "@noble/curves": ~1.4.0 "@scure/base": ~1.1.3 "@scure/starknet": ~1.0.0 - abi-wan-kanabi: ^2.2.1 + abi-wan-kanabi: ^2.2.2 fetch-cookie: ^3.0.0 isomorphic-fetch: ^3.0.0 lossless-json: ^4.0.1 pako: ^2.0.4 + starknet-types: ^0.0.4 ts-mixer: ^6.0.3 url-join: ^4.0.1 - checksum: b1a2ddab6f393be61c65bb5d426ddd631be6958f30671ba71aaeea237af1a1c5163941c9149e20f5701975855bccf0ab184f2a21ceee7ad5a4b974a46b7ffc1c + checksum: 3c4abda7bab3008c8f98728c4b23a47a2dc97b876c6a33a824da77907b63611fde2df22298aa4c512e3c81e3fe005dd7e288969f18b00299e6eae450a147769d languageName: node linkType: hard From 70e0b5199b71c5e8ed000f524768b05d00226b27 Mon Sep 17 00:00:00 2001 From: stanleyyuen <102275989+stanleyyconsensys@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:41:14 +0800 Subject: [PATCH 6/6] chore: update getStarkName --- packages/starknet-snap/src/signTransaction.ts | 2 +- packages/starknet-snap/src/utils/starknetUtils.ts | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/starknet-snap/src/signTransaction.ts b/packages/starknet-snap/src/signTransaction.ts index b2b6718f..cd8c6434 100644 --- a/packages/starknet-snap/src/signTransaction.ts +++ b/packages/starknet-snap/src/signTransaction.ts @@ -34,7 +34,7 @@ export async function signTransaction(params: ApiParams): Promise => { const signer = new Signer(privateKey); const signatures = await signer.signTransaction(transactions, transactionsDetail); @@ -569,7 +569,5 @@ export const signMessage = async (privateKey: string, typedDataMessage: TypedDat export const getStarkNameUtil = async (network: Network, userAddress: string) => { const provider = getProvider(network); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return provider.getStarkName(userAddress); + return Account.getStarkName(provider, userAddress); };