From 34d3cdbdff3bb70a23bfd31ee834e05e4486c382 Mon Sep 17 00:00:00 2001 From: Adegbite Ademola Kelvin Date: Tue, 29 Oct 2024 13:33:24 +0100 Subject: [PATCH 1/9] feature: add starknet token support --- packages/starknet-node/README.md | 9 + packages/starknet-node/cjs.tsconfig.json | 11 + packages/starknet-node/package.json | 82 +++ packages/starknet-node/src/client.ts | 46 ++ packages/starknet-node/src/index.ts | 5 + packages/starknet-node/src/irys.ts | 37 ++ packages/starknet-node/src/token.ts | 551 ++++++++++++++++++ .../starknet-node/test/modules/cjs.test.cjs | 10 + .../starknet-node/test/modules/esm.test.mjs | 10 + .../starknet-node/test/someFeature.test.ts | 6 + packages/starknet-node/test/tsconfig.json | 16 + packages/starknet-node/tsconfig.json | 11 + 12 files changed, 794 insertions(+) create mode 100644 packages/starknet-node/README.md create mode 100644 packages/starknet-node/cjs.tsconfig.json create mode 100644 packages/starknet-node/package.json create mode 100644 packages/starknet-node/src/client.ts create mode 100644 packages/starknet-node/src/index.ts create mode 100644 packages/starknet-node/src/irys.ts create mode 100644 packages/starknet-node/src/token.ts create mode 100644 packages/starknet-node/test/modules/cjs.test.cjs create mode 100644 packages/starknet-node/test/modules/esm.test.mjs create mode 100644 packages/starknet-node/test/someFeature.test.ts create mode 100644 packages/starknet-node/test/tsconfig.json create mode 100644 packages/starknet-node/tsconfig.json diff --git a/packages/starknet-node/README.md b/packages/starknet-node/README.md new file mode 100644 index 0000000..1d3d834 --- /dev/null +++ b/packages/starknet-node/README.md @@ -0,0 +1,9 @@ +# starknet-node + +TODO + +## Installation + +```sh +npm install @irys/upload-starknet-node +``` diff --git a/packages/starknet-node/cjs.tsconfig.json b/packages/starknet-node/cjs.tsconfig.json new file mode 100644 index 0000000..ff4892d --- /dev/null +++ b/packages/starknet-node/cjs.tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../cjs.tsconfig.json", + "include": [ + "src" + ], + "compilerOptions": { + "outDir": "dist/cjs", + "rootDir": "./src", + "declaration": false + } +} \ No newline at end of file diff --git a/packages/starknet-node/package.json b/packages/starknet-node/package.json new file mode 100644 index 0000000..7ae48d3 --- /dev/null +++ b/packages/starknet-node/package.json @@ -0,0 +1,82 @@ +{ + "name": "@irys/upload-starknet-node", + "version": "0.0.0", + "description": "TODO", + "license": "MIT", + "sideEffects": false, + "module": "dist/esm/index.js", + "main": "dist/cjs/index.js", + "types": "dist/types/index.d.ts", + "exports": { + ".": { + "types": "./dist/types/index.d.ts", + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + }, + "./esm/*": { + "types": "./dist/types/*.d.ts", + "default": "./dist/esm/*.js" + }, + "./cjs/*": { + "types": "./dist/types/*.d.ts", + "default": "./dist/cjs/*.js" + }, + "./*": { + "types": "./dist/types/*.d.ts", + "import": { + "types": "./dist/types/*.d.ts", + "default": "./dist/esm/*.js" + }, + "require": { + "types": "./dist/types/*.d.ts", + "default": "./dist/cjs/*.js" + } + } + }, + "files": [ + "/dist/cjs", + "/dist/esm", + "/dist/types", + "/src" + ], + "scripts": { + "lint": "eslint --ext js,ts,tsx src", + "lint:fix": "eslint --fix --ext js,ts,tsx src", + "clean": "rimraf dist", + "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", + "test": "ava" + }, + "dependencies": { + "@irys/bundles": "^0.0.2", + "@irys/upload": "workspace:^", + "@irys/upload-core": "workspace:^", + "bignumber.js": "^9.1.2", + "starknet": "^6.17.0" + }, + "devDependencies": { + "@ava/typescript": "^5.0.0", + "ava": "^6.1.3" + }, + "publishConfig": { + "access": "public" + }, + "author": "Irys maintainers ", + "homepage": "https://irys.xyz", + "repository": { + "url": "https://github.com/irys-xyz/js-sdk.git" + }, + "typedoc": { + "entryPoint": "./src/index.ts", + "readmeFile": "./README.md", + "displayName": "starknet-node" + }, + "ava": { + "typescript": { + "compile": false, + "rewritePaths": { + "src/": "dist/test/src/", + "test/": "dist/test/test/" + } + } + } +} diff --git a/packages/starknet-node/src/client.ts b/packages/starknet-node/src/client.ts new file mode 100644 index 0000000..a5f01f6 --- /dev/null +++ b/packages/starknet-node/src/client.ts @@ -0,0 +1,46 @@ +import { BaseNodeToken } from "@irys/upload/tokens/base"; +import { Constructable, type TokenConfigTrimmed } from "@irys/upload/builder"; +import BaseSTRK20Token from "./token"; + +const STARKNET_PROVIDER_URL = "https://starknet-mainnet.public.blastapi.io"; +const CONTRACT_ADDRESSES = { + ETH: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", + STRK: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d", +}; + +// set stark token as default +export class StarknetToken extends BaseSTRK20Token { + constructor(config: TokenConfigTrimmed) { + super({ + name: "starknet", + ticker: "STRK", + contractAddress: config.opts?.contractAddress ?? CONTRACT_ADDRESSES.STRK, + privateKey: config.opts?.privateKey ?? "", + address: config.opts?.address ?? "", + irys: config.irys, + providerUrl: config.providerUrl ?? STARKNET_PROVIDER_URL + }); + } +} + +function getBoundERC20(name: string, ticker: string, contractAddress: string): Constructable<[TokenConfigTrimmed], BaseSTRK20Token> { + return class extends BaseSTRK20Token { + constructor(config: TokenConfigTrimmed) { + super({ + name, + ticker, + ...config, + providerUrl: config.providerUrl ?? STARKNET_PROVIDER_URL, + contractAddress: config.opts?.contractAddress ?? contractAddress, + privateKey: config.opts?.privateKey ?? "", + address: config.opts?.address ?? "" + }); + } + }; +} + +// config to use starknetETH +export const StarknetEth = getBoundERC20("eth", "ETH", CONTRACT_ADDRESSES.ETH); +export const Starknet: Constructable<[TokenConfigTrimmed], BaseNodeToken> = StarknetToken + +export default Starknet; diff --git a/packages/starknet-node/src/index.ts b/packages/starknet-node/src/index.ts new file mode 100644 index 0000000..e455606 --- /dev/null +++ b/packages/starknet-node/src/index.ts @@ -0,0 +1,5 @@ +export * from './token'; +export * from "./client" +import { Starknet } from './client'; +export {Starknet}; +export default Starknet; diff --git a/packages/starknet-node/src/irys.ts b/packages/starknet-node/src/irys.ts new file mode 100644 index 0000000..5a2c4b1 --- /dev/null +++ b/packages/starknet-node/src/irys.ts @@ -0,0 +1,37 @@ +import BaseNodeIrys from "@irys/upload/base"; +import BaseStarknetToken from "./token"; +import type { IrysConfig } from "@irys/upload-core"; + + +type TokenOptions = { + privateKey?: string; + address?: string; + }; + + // Update the NodeIrysConfig type to include TokenOptions for tokenOpts + interface NodeIrysConfig { + url: string; + key: string; + config?: IrysConfig + tokenOpts:TokenOptions + } +export default class StarknetIrys extends BaseNodeIrys { + constructor({ url, key, config,tokenOpts }: NodeIrysConfig) { + super({ + url, + config, + getTokenConfig: (irys) => + new BaseStarknetToken({ + irys, + name: "starknet", + ticker: "STRK", + providerUrl: config?.providerUrl ?? "", + wallet: key, + opts: config?.tokenOpts, + privateKey: tokenOpts?.privateKey ?? "", + address: tokenOpts?.address ?? "", + contractAddress: config?.contractAddress ?? "" + }), + }); + } +} diff --git a/packages/starknet-node/src/token.ts b/packages/starknet-node/src/token.ts new file mode 100644 index 0000000..9ddc829 --- /dev/null +++ b/packages/starknet-node/src/token.ts @@ -0,0 +1,551 @@ +import { BaseNodeToken } from '@irys/upload/tokens/base'; +import type { TokenConfig, Tx } from '@irys/upload-core'; +import { Contract, RpcProvider, Provider } from 'starknet'; +import { StarknetSigner, Signer } from '@irys/bundles'; +import BigNumber from 'bignumber.js'; +import { num, Account, uint256 } from 'starknet'; + +const starknetSigner = StarknetSigner; + +export interface STRKTokenConfig extends TokenConfig { + contractAddress: string; + privateKey: string; + address: string; +} + +export default class BaseSTRK20Token extends BaseNodeToken { + protected contractInstance!: Contract; + protected contractAddress: string; + protected declare providerInstance: Provider; + protected privateKey: string; + protected signer: StarknetSigner; + protected account: Account; + constructor(config: STRKTokenConfig) { + super(config); + this.contractAddress = config.contractAddress; + this.privateKey = config.privateKey; + this._address = config.address; + this.providerInstance = new RpcProvider({ nodeUrl: this.providerUrl }); + this.account = new Account(this.providerInstance,this._address, this.privateKey); + this.signer = new StarknetSigner(this.providerInstance,this._address,this.privateKey); + } + + async init(): Promise { + try { + await this.signer.init(); + } catch (error) { + console.error('Failed to initialize signer:', error); + throw error; + } + } + + async getContract(): Promise { + if (!this.contractInstance) { + this.contractInstance = new Contract( + strkerc20token, + this.contractAddress, + this.providerInstance + ); + const decimals = Math.pow(10, await this.contractInstance.decimals()); + this.base = + this.contractAddress === + '0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d' + ? ['fri', decimals] + : this.contractAddress === + '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7' + ? ['wei', decimals] + : ['', 0]; + } + return this.contractInstance; + } + protected async getProvider(): Promise { + if (!this.providerInstance) { + this.providerInstance = new RpcProvider({ nodeUrl: this.providerUrl }); + } + return this.providerInstance; + } + + async getTx(txId: string): Promise { + try { + const receipt = await this.providerInstance.getTransactionReceipt(txId); + const traces = await this.providerInstance.getTransactionTrace(txId); + + if (!receipt || !traces) { + throw new Error("Transaction does not exist or is still pending."); + } + + const receiptResponse = (receipt as unknown as Transaction).value; + const tracesResponse = (traces as FeeTransferInvocation).fee_transfer_invocation; + + const amount = receiptResponse?.actual_fee.amount; + + return { + from: tracesResponse?.caller_address as string, + to: tracesResponse?.contract_address as string, + blockHeight: new BigNumber(receiptResponse?.block_number as number), + amount: new BigNumber(amount as string), + pending: !receiptResponse?.block_number, + confirmed: !!(receiptResponse?.finality_status === 'ACCEPTED_ON_L1'), + }; + } catch (error) { + console.error(`Error fetching transaction details: ${error}`); + throw error; + } + } + + ownerToAddress(owner: any): string { + return this.signer.address; + } + async sign(data: Uint8Array): Promise { + return this.signer.sign(data); + } + getSigner(): Signer { + return this.signer; + } + verify(pub: any, data: Uint8Array, signature: Uint8Array): Promise { + return starknetSigner.verify(pub, data, signature); + } + async getCurrentHeight(): Promise { + const response = await this.providerInstance.getBlockNumber(); + return new BigNumber(response, 16); + } + async getFee( + amount: BigNumber.Value, + to?: string, + _multiplier?: BigNumber.Value | undefined + ): Promise { + try { + const amountBigNumber = new BigNumber(amount); + const _amount = uint256.bnToUint256(amountBigNumber.toString()); + + const suggestedMaxFee = await this.account.estimateInvokeFee({ + contractAddress: this.contractAddress, + entrypoint: 'transfer', + calldata: [to || '', _amount.high, _amount.low], + }); + + const result = suggestedMaxFee.suggestedMaxFee; + const result_to_hex = num.toHex(result); + return new BigNumber(result_to_hex); + } catch (error) { + console.error('Error estimating fee:', error); + throw new Error('Failed to estimate fee. Please try again.'); + } + } + + + async createTx( + amount: BigNumber.Value, + to: string, + _fee?: string | object | undefined + ): Promise<{ txId: string | undefined; tx: any }> { + try { + const amountBigNumber = new BigNumber(amount); + const _amount = uint256.bnToUint256(amountBigNumber.toString()); + + const calldata = [to, _amount.low, _amount.high]; + const maxFeeEstimate = await this.account.estimateFee({ + contractAddress: this.contractAddress, + entrypoint: 'transfer', + calldata, + }); + + const { transaction_hash: txId } = await this.account.execute( + { + contractAddress: this.contractAddress, + entrypoint: 'transfer', + calldata, + }, + { maxFee: maxFeeEstimate.suggestedMaxFee } + ); + + return { txId, tx: txId }; + } catch (error) { + console.error('Transaction creation failed:', error); + throw new Error('Transaction failed. Please try again.'); + } + } + + async sendTx(data: any): Promise { + if (!this._address) { + throw new Error('Address is not defined'); + } + try { + // Execute the transaction using the account's invoke method + const response = await this.account.execute(data); + // Wait for the transaction to be confirmed + await this.providerInstance.waitForTransaction(response.transaction_hash); + return response.transaction_hash; + } catch (error) { + console.error(`Error occurred while sending transaction - ${error}`); + throw error; + } + } + + getPublicKey(): string | Buffer { + return this.signer.publicKey; + } +} + +interface FeeTransferInvocation { + fee_transfer_invocation?: { + calldata: string[]; + caller_address: string; + contract_address: string; + entry_point_selector: string; + entry_point_type: string; + }; +} + +interface Transaction { + value?: { + actual_fee: { + amount: string; + unit: 'WEI'; + }; + block_number: number; + execution_status: 'SUCCEEDED' | 'FAILED'; + finality_status: 'ACCEPTED_ON_L1' | 'REJECTED'; + }; +} + +const strkerc20token = [ + { + members: [ + { + name: 'low', + offset: 0, + type: 'felt', + }, + { + name: 'high', + offset: 1, + type: 'felt', + }, + ], + name: 'Uint256', + size: 2, + type: 'struct', + }, + { + data: [ + { + name: 'from_', + type: 'felt', + }, + { + name: 'to', + type: 'felt', + }, + { + name: 'value', + type: 'Uint256', + }, + ], + keys: [], + name: 'Transfer', + type: 'event', + }, + { + data: [ + { + name: 'owner', + type: 'felt', + }, + { + name: 'spender', + type: 'felt', + }, + { + name: 'value', + type: 'Uint256', + }, + ], + keys: [], + name: 'Approval', + type: 'event', + }, + { + inputs: [], + name: 'name', + outputs: [ + { + name: 'name', + type: 'felt', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'symbol', + outputs: [ + { + name: 'symbol', + type: 'felt', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'totalSupply', + outputs: [ + { + name: 'totalSupply', + type: 'Uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'decimals', + outputs: [ + { + name: 'decimals', + type: 'felt', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + name: 'account', + type: 'felt', + }, + ], + name: 'balanceOf', + outputs: [ + { + name: 'balance', + type: 'Uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + name: 'owner', + type: 'felt', + }, + { + name: 'spender', + type: 'felt', + }, + ], + name: 'allowance', + outputs: [ + { + name: 'remaining', + type: 'Uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'permittedMinter', + outputs: [ + { + name: 'minter', + type: 'felt', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'initialized', + outputs: [ + { + name: 'res', + type: 'felt', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'get_version', + outputs: [ + { + name: 'version', + type: 'felt', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'get_identity', + outputs: [ + { + name: 'identity', + type: 'felt', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + name: 'init_vector_len', + type: 'felt', + }, + { + name: 'init_vector', + type: 'felt*', + }, + ], + name: 'initialize', + outputs: [], + type: 'function', + }, + { + inputs: [ + { + name: 'recipient', + type: 'felt', + }, + { + name: 'amount', + type: 'Uint256', + }, + ], + name: 'transfer', + outputs: [ + { + name: 'success', + type: 'felt', + }, + ], + type: 'function', + }, + { + inputs: [ + { + name: 'sender', + type: 'felt', + }, + { + name: 'recipient', + type: 'felt', + }, + { + name: 'amount', + type: 'Uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + name: 'success', + type: 'felt', + }, + ], + type: 'function', + }, + { + inputs: [ + { + name: 'spender', + type: 'felt', + }, + { + name: 'amount', + type: 'Uint256', + }, + ], + name: 'approve', + outputs: [ + { + name: 'success', + type: 'felt', + }, + ], + type: 'function', + }, + { + inputs: [ + { + name: 'spender', + type: 'felt', + }, + { + name: 'added_value', + type: 'Uint256', + }, + ], + name: 'increaseAllowance', + outputs: [ + { + name: 'success', + type: 'felt', + }, + ], + type: 'function', + }, + { + inputs: [ + { + name: 'spender', + type: 'felt', + }, + { + name: 'subtracted_value', + type: 'Uint256', + }, + ], + name: 'decreaseAllowance', + outputs: [ + { + name: 'success', + type: 'felt', + }, + ], + type: 'function', + }, + { + inputs: [ + { + name: 'recipient', + type: 'felt', + }, + { + name: 'amount', + type: 'Uint256', + }, + ], + name: 'permissionedMint', + outputs: [], + type: 'function', + }, + { + inputs: [ + { + name: 'account', + type: 'felt', + }, + { + name: 'amount', + type: 'Uint256', + }, + ], + name: 'permissionedBurn', + outputs: [], + type: 'function', + }, +]; diff --git a/packages/starknet-node/test/modules/cjs.test.cjs b/packages/starknet-node/test/modules/cjs.test.cjs new file mode 100644 index 0000000..215ffde --- /dev/null +++ b/packages/starknet-node/test/modules/cjs.test.cjs @@ -0,0 +1,10 @@ +/* eslint-disable import/no-extraneous-dependencies */ +const test = require('ava'); + +const exported = require('../../dist/cjs/index.js'); + +test('it successfully exports commonjs exports', (t) => { + const exportedKeys = Object.keys(exported); + t.true(exportedKeys.length > 0); +}); + diff --git a/packages/starknet-node/test/modules/esm.test.mjs b/packages/starknet-node/test/modules/esm.test.mjs new file mode 100644 index 0000000..cf2e7a9 --- /dev/null +++ b/packages/starknet-node/test/modules/esm.test.mjs @@ -0,0 +1,10 @@ +/* eslint-disable import/extensions */ +/* eslint-disable import/no-extraneous-dependencies */ +import test from 'ava'; +import * as exported from '../../dist/esm/index.js'; + +test('it successfully exports esm exports', (t) => { + const exportedKeys = Object.keys(exported); + t.true(exportedKeys.length > 0); +}); + diff --git a/packages/starknet-node/test/someFeature.test.ts b/packages/starknet-node/test/someFeature.test.ts new file mode 100644 index 0000000..d36fba4 --- /dev/null +++ b/packages/starknet-node/test/someFeature.test.ts @@ -0,0 +1,6 @@ +import test from 'ava'; +import { MyToken } from '../src'; + +test('example test', async (t) => { + t.is(typeof MyToken, 'object'); +}); diff --git a/packages/starknet-node/test/tsconfig.json b/packages/starknet-node/test/tsconfig.json new file mode 100644 index 0000000..2d667da --- /dev/null +++ b/packages/starknet-node/test/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../cjs.tsconfig.json", + "include": [ + "../src", + "../test" + ], + "compilerOptions": { + "module": "Node16", + "rootDir": "../", + "outDir": "../dist/test", + "declarationDir": null, + "moduleResolution": "Node16", + "declaration": false, + "emitDeclarationOnly": false + } +} diff --git a/packages/starknet-node/tsconfig.json b/packages/starknet-node/tsconfig.json new file mode 100644 index 0000000..e1259f3 --- /dev/null +++ b/packages/starknet-node/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../esm.tsconfig.json", + "include": [ + "src", + ], + "compilerOptions": { + "outDir": "dist/esm", + "declarationDir": "dist/types", + "rootDir": "./src" + } +} \ No newline at end of file From 750beac18bd127c4ca3d1ba92fec88ec78fbb3b9 Mon Sep 17 00:00:00 2001 From: Adegbite Ademola Kelvin Date: Mon, 4 Nov 2024 14:42:27 +0100 Subject: [PATCH 2/9] chore: add ownerToAddress function --- .../starknet-node/src/abi/argent.abi.json | 1657 +++++++++++++++++ .../starknet-node/src/abi/braavos.abi.json | 1089 +++++++++++ packages/starknet-node/src/abi/erc20.abi.json | 1122 +++++++++++ packages/starknet-node/src/client.ts | 3 +- .../src/supportedWallets/abi/walletConfig.ts | 16 + packages/starknet-node/src/token.ts | 405 +--- .../starknet-node/test/someFeature.test.ts | 4 +- 7 files changed, 3947 insertions(+), 349 deletions(-) create mode 100644 packages/starknet-node/src/abi/argent.abi.json create mode 100644 packages/starknet-node/src/abi/braavos.abi.json create mode 100644 packages/starknet-node/src/abi/erc20.abi.json create mode 100644 packages/starknet-node/src/supportedWallets/abi/walletConfig.ts diff --git a/packages/starknet-node/src/abi/argent.abi.json b/packages/starknet-node/src/abi/argent.abi.json new file mode 100644 index 0000000..c52c392 --- /dev/null +++ b/packages/starknet-node/src/abi/argent.abi.json @@ -0,0 +1,1657 @@ +[ + { + "name": "AccountImpl", + "type": "impl", + "interface_name": "argent::account::interface::IAccount" + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "core::starknet::account::Call", + "type": "struct", + "members": [ + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "selector", + "type": "core::felt252" + }, + { + "name": "calldata", + "type": "core::array::Span::" + } + ] + }, + { + "name": "argent::account::interface::IAccount", + "type": "interface", + "items": [ + { + "name": "__validate__", + "type": "function", + "inputs": [ + { + "name": "calls", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "name": "__execute__", + "type": "function", + "inputs": [ + { + "name": "calls", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "name": "is_valid_signature", + "type": "function", + "inputs": [ + { + "name": "hash", + "type": "core::felt252" + }, + { + "name": "signature", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "UpgradeableCallbackOldImpl", + "type": "impl", + "interface_name": "argent::upgrade::interface::IUpgradableCallbackOld" + }, + { + "name": "argent::upgrade::interface::IUpgradableCallbackOld", + "type": "interface", + "items": [ + { + "name": "execute_after_upgrade", + "type": "function", + "inputs": [ + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "external" + } + ] + }, + { + "name": "UpgradeableCallbackImpl", + "type": "impl", + "interface_name": "argent::upgrade::interface::IUpgradableCallback" + }, + { + "name": "argent::upgrade::interface::IUpgradableCallback", + "type": "interface", + "items": [ + { + "name": "perform_upgrade", + "type": "function", + "inputs": [ + { + "name": "new_implementation", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "data", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "ArgentUserAccountImpl", + "type": "impl", + "interface_name": "argent::account::interface::IArgentUserAccount" + }, + { + "name": "argent::signer::signer_signature::StarknetSigner", + "type": "struct", + "members": [ + { + "name": "pubkey", + "type": "core::zeroable::NonZero::" + } + ] + }, + { + "name": "core::starknet::eth_address::EthAddress", + "type": "struct", + "members": [ + { + "name": "address", + "type": "core::felt252" + } + ] + }, + { + "name": "argent::signer::signer_signature::Secp256k1Signer", + "type": "struct", + "members": [ + { + "name": "pubkey_hash", + "type": "core::starknet::eth_address::EthAddress" + } + ] + }, + { + "name": "core::integer::u256", + "type": "struct", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "name": "argent::signer::signer_signature::Secp256r1Signer", + "type": "struct", + "members": [ + { + "name": "pubkey", + "type": "core::zeroable::NonZero::" + } + ] + }, + { + "name": "argent::signer::signer_signature::Eip191Signer", + "type": "struct", + "members": [ + { + "name": "eth_address", + "type": "core::starknet::eth_address::EthAddress" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "argent::signer::signer_signature::WebauthnSigner", + "type": "struct", + "members": [ + { + "name": "origin", + "type": "core::array::Span::" + }, + { + "name": "rp_id_hash", + "type": "core::zeroable::NonZero::" + }, + { + "name": "pubkey", + "type": "core::zeroable::NonZero::" + } + ] + }, + { + "name": "argent::signer::signer_signature::Signer", + "type": "enum", + "variants": [ + { + "name": "Starknet", + "type": "argent::signer::signer_signature::StarknetSigner" + }, + { + "name": "Secp256k1", + "type": "argent::signer::signer_signature::Secp256k1Signer" + }, + { + "name": "Secp256r1", + "type": "argent::signer::signer_signature::Secp256r1Signer" + }, + { + "name": "Eip191", + "type": "argent::signer::signer_signature::Eip191Signer" + }, + { + "name": "Webauthn", + "type": "argent::signer::signer_signature::WebauthnSigner" + } + ] + }, + { + "name": "core::option::Option::", + "type": "enum", + "variants": [ + { + "name": "Some", + "type": "argent::signer::signer_signature::Signer" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "name": "argent::signer::signer_signature::StarknetSignature", + "type": "struct", + "members": [ + { + "name": "r", + "type": "core::felt252" + }, + { + "name": "s", + "type": "core::felt252" + } + ] + }, + { + "name": "core::bool", + "type": "enum", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "name": "core::starknet::secp256_trait::Signature", + "type": "struct", + "members": [ + { + "name": "r", + "type": "core::integer::u256" + }, + { + "name": "s", + "type": "core::integer::u256" + }, + { + "name": "y_parity", + "type": "core::bool" + } + ] + }, + { + "name": "argent::signer::webauthn::Sha256Implementation", + "type": "enum", + "variants": [ + { + "name": "Cairo0", + "type": "()" + }, + { + "name": "Cairo1", + "type": "()" + } + ] + }, + { + "name": "argent::signer::webauthn::WebauthnSignature", + "type": "struct", + "members": [ + { + "name": "cross_origin", + "type": "core::bool" + }, + { + "name": "client_data_json_outro", + "type": "core::array::Span::" + }, + { + "name": "flags", + "type": "core::integer::u8" + }, + { + "name": "sign_count", + "type": "core::integer::u32" + }, + { + "name": "ec_signature", + "type": "core::starknet::secp256_trait::Signature" + }, + { + "name": "sha256_implementation", + "type": "argent::signer::webauthn::Sha256Implementation" + } + ] + }, + { + "name": "argent::signer::signer_signature::SignerSignature", + "type": "enum", + "variants": [ + { + "name": "Starknet", + "type": "(argent::signer::signer_signature::StarknetSigner, argent::signer::signer_signature::StarknetSignature)" + }, + { + "name": "Secp256k1", + "type": "(argent::signer::signer_signature::Secp256k1Signer, core::starknet::secp256_trait::Signature)" + }, + { + "name": "Secp256r1", + "type": "(argent::signer::signer_signature::Secp256r1Signer, core::starknet::secp256_trait::Signature)" + }, + { + "name": "Eip191", + "type": "(argent::signer::signer_signature::Eip191Signer, core::starknet::secp256_trait::Signature)" + }, + { + "name": "Webauthn", + "type": "(argent::signer::signer_signature::WebauthnSigner, argent::signer::webauthn::WebauthnSignature)" + } + ] + }, + { + "name": "argent::signer::signer_signature::SignerType", + "type": "enum", + "variants": [ + { + "name": "Starknet", + "type": "()" + }, + { + "name": "Secp256k1", + "type": "()" + }, + { + "name": "Secp256r1", + "type": "()" + }, + { + "name": "Eip191", + "type": "()" + }, + { + "name": "Webauthn", + "type": "()" + } + ] + }, + { + "name": "core::option::Option::", + "type": "enum", + "variants": [ + { + "name": "Some", + "type": "core::felt252" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "name": "core::option::Option::", + "type": "enum", + "variants": [ + { + "name": "Some", + "type": "argent::signer::signer_signature::SignerType" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "name": "argent::recovery::interface::LegacyEscapeType", + "type": "enum", + "variants": [ + { + "name": "None", + "type": "()" + }, + { + "name": "Guardian", + "type": "()" + }, + { + "name": "Owner", + "type": "()" + } + ] + }, + { + "name": "argent::signer::signer_signature::SignerStorageValue", + "type": "struct", + "members": [ + { + "name": "stored_value", + "type": "core::felt252" + }, + { + "name": "signer_type", + "type": "argent::signer::signer_signature::SignerType" + } + ] + }, + { + "name": "core::option::Option::", + "type": "enum", + "variants": [ + { + "name": "Some", + "type": "argent::signer::signer_signature::SignerStorageValue" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "name": "argent::recovery::interface::LegacyEscape", + "type": "struct", + "members": [ + { + "name": "ready_at", + "type": "core::integer::u64" + }, + { + "name": "escape_type", + "type": "argent::recovery::interface::LegacyEscapeType" + }, + { + "name": "new_signer", + "type": "core::option::Option::" + } + ] + }, + { + "name": "argent::account::interface::Version", + "type": "struct", + "members": [ + { + "name": "major", + "type": "core::integer::u8" + }, + { + "name": "minor", + "type": "core::integer::u8" + }, + { + "name": "patch", + "type": "core::integer::u8" + } + ] + }, + { + "name": "argent::recovery::interface::EscapeStatus", + "type": "enum", + "variants": [ + { + "name": "None", + "type": "()" + }, + { + "name": "NotReady", + "type": "()" + }, + { + "name": "Ready", + "type": "()" + }, + { + "name": "Expired", + "type": "()" + } + ] + }, + { + "name": "argent::account::interface::IArgentUserAccount", + "type": "interface", + "items": [ + { + "name": "__validate_declare__", + "type": "function", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "__validate_deploy__", + "type": "function", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + }, + { + "name": "contract_address_salt", + "type": "core::felt252" + }, + { + "name": "owner", + "type": "argent::signer::signer_signature::Signer" + }, + { + "name": "guardian", + "type": "core::option::Option::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "set_escape_security_period", + "type": "function", + "inputs": [ + { + "name": "new_security_period", + "type": "core::integer::u64" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "change_owner", + "type": "function", + "inputs": [ + { + "name": "signer_signature", + "type": "argent::signer::signer_signature::SignerSignature" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "change_guardian", + "type": "function", + "inputs": [ + { + "name": "new_guardian", + "type": "core::option::Option::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "change_guardian_backup", + "type": "function", + "inputs": [ + { + "name": "new_guardian_backup", + "type": "core::option::Option::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "trigger_escape_owner", + "type": "function", + "inputs": [ + { + "name": "new_owner", + "type": "argent::signer::signer_signature::Signer" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "trigger_escape_guardian", + "type": "function", + "inputs": [ + { + "name": "new_guardian", + "type": "core::option::Option::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "escape_owner", + "type": "function", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "escape_guardian", + "type": "function", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "cancel_escape", + "type": "function", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "get_owner", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "get_owner_guid", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "get_owner_type", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "argent::signer::signer_signature::SignerType" + } + ], + "state_mutability": "view" + }, + { + "name": "get_guardian", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "is_guardian", + "type": "function", + "inputs": [ + { + "name": "guardian", + "type": "argent::signer::signer_signature::Signer" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "get_guardian_guid", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::option::Option::" + } + ], + "state_mutability": "view" + }, + { + "name": "get_guardian_type", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::option::Option::" + } + ], + "state_mutability": "view" + }, + { + "name": "get_guardian_backup", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "get_guardian_backup_guid", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::option::Option::" + } + ], + "state_mutability": "view" + }, + { + "name": "get_guardian_backup_type", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::option::Option::" + } + ], + "state_mutability": "view" + }, + { + "name": "get_escape", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "argent::recovery::interface::LegacyEscape" + } + ], + "state_mutability": "view" + }, + { + "name": "get_name", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "get_version", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "argent::account::interface::Version" + } + ], + "state_mutability": "view" + }, + { + "name": "get_last_owner_trigger_escape_attempt", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "get_last_guardian_trigger_escape_attempt", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "get_last_owner_escape_attempt", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "get_last_guardian_escape_attempt", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "get_escape_and_status", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "(argent::recovery::interface::LegacyEscape, argent::recovery::interface::EscapeStatus)" + } + ], + "state_mutability": "view" + }, + { + "name": "get_escape_security_period", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "DeprecatedArgentAccountImpl", + "type": "impl", + "interface_name": "argent::account::interface::IDeprecatedArgentAccount" + }, + { + "name": "argent::account::interface::IDeprecatedArgentAccount", + "type": "interface", + "items": [ + { + "name": "getVersion", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "getName", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "isValidSignature", + "type": "function", + "inputs": [ + { + "name": "hash", + "type": "core::felt252" + }, + { + "name": "signatures", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "Sessionable", + "type": "impl", + "interface_name": "argent::session::interface::ISessionable" + }, + { + "name": "argent::session::interface::ISessionable", + "type": "interface", + "items": [ + { + "name": "revoke_session", + "type": "function", + "inputs": [ + { + "name": "session_hash", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "is_session_revoked", + "type": "function", + "inputs": [ + { + "name": "session_hash", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "is_session_authorization_cached", + "type": "function", + "inputs": [ + { + "name": "session_hash", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "ExecuteFromOutside", + "type": "impl", + "interface_name": "argent::outside_execution::interface::IOutsideExecution" + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "argent::outside_execution::interface::OutsideExecution", + "type": "struct", + "members": [ + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "nonce", + "type": "core::felt252" + }, + { + "name": "execute_after", + "type": "core::integer::u64" + }, + { + "name": "execute_before", + "type": "core::integer::u64" + }, + { + "name": "calls", + "type": "core::array::Span::" + } + ] + }, + { + "name": "argent::outside_execution::interface::IOutsideExecution", + "type": "interface", + "items": [ + { + "name": "execute_from_outside", + "type": "function", + "inputs": [ + { + "name": "outside_execution", + "type": "argent::outside_execution::interface::OutsideExecution" + }, + { + "name": "signature", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "name": "execute_from_outside_v2", + "type": "function", + "inputs": [ + { + "name": "outside_execution", + "type": "argent::outside_execution::interface::OutsideExecution" + }, + { + "name": "signature", + "type": "core::array::Span::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "name": "is_valid_outside_execution_nonce", + "type": "function", + "inputs": [ + { + "name": "nonce", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "get_outside_execution_message_hash_rev_0", + "type": "function", + "inputs": [ + { + "name": "outside_execution", + "type": "argent::outside_execution::interface::OutsideExecution" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "get_outside_execution_message_hash_rev_1", + "type": "function", + "inputs": [ + { + "name": "outside_execution", + "type": "argent::outside_execution::interface::OutsideExecution" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "SRC5", + "type": "impl", + "interface_name": "argent::introspection::interface::ISRC5" + }, + { + "name": "argent::introspection::interface::ISRC5", + "type": "interface", + "items": [ + { + "name": "supports_interface", + "type": "function", + "inputs": [ + { + "name": "interface_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "SRC5Legacy", + "type": "impl", + "interface_name": "argent::introspection::interface::ISRC5Legacy" + }, + { + "name": "argent::introspection::interface::ISRC5Legacy", + "type": "interface", + "items": [ + { + "name": "supportsInterface", + "type": "function", + "inputs": [ + { + "name": "interfaceId", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "Upgradable", + "type": "impl", + "interface_name": "argent::upgrade::interface::IUpgradeable" + }, + { + "name": "argent::upgrade::interface::IUpgradeable", + "type": "interface", + "items": [ + { + "name": "upgrade", + "type": "function", + "inputs": [ + { + "name": "new_implementation", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "constructor", + "type": "constructor", + "inputs": [ + { + "name": "owner", + "type": "argent::signer::signer_signature::Signer" + }, + { + "name": "guardian", + "type": "core::option::Option::" + } + ] + }, + { + "kind": "enum", + "name": "argent::outside_execution::outside_execution::outside_execution_component::Event", + "type": "event", + "variants": [] + }, + { + "kind": "enum", + "name": "argent::introspection::src5::src5_component::Event", + "type": "event", + "variants": [] + }, + { + "kind": "struct", + "name": "argent::upgrade::upgrade::upgrade_component::AccountUpgraded", + "type": "event", + "members": [ + { + "kind": "data", + "name": "new_implementation", + "type": "core::starknet::class_hash::ClassHash" + } + ] + }, + { + "kind": "enum", + "name": "argent::upgrade::upgrade::upgrade_component::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "AccountUpgraded", + "type": "argent::upgrade::upgrade::upgrade_component::AccountUpgraded" + } + ] + }, + { + "kind": "struct", + "name": "argent::session::session::session_component::SessionRevoked", + "type": "event", + "members": [ + { + "kind": "data", + "name": "session_hash", + "type": "core::felt252" + } + ] + }, + { + "kind": "enum", + "name": "argent::session::session::session_component::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "SessionRevoked", + "type": "argent::session::session::session_component::SessionRevoked" + } + ] + }, + { + "kind": "enum", + "name": "openzeppelin::security::reentrancyguard::ReentrancyGuardComponent::Event", + "type": "event", + "variants": [] + }, + { + "name": "core::array::Span::>", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::>" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::TransactionExecuted", + "type": "event", + "members": [ + { + "kind": "key", + "name": "hash", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "response", + "type": "core::array::Span::>" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::AccountCreated", + "type": "event", + "members": [ + { + "kind": "key", + "name": "owner", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "guardian", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::AccountCreatedGuid", + "type": "event", + "members": [ + { + "kind": "key", + "name": "owner_guid", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "guardian_guid", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::EscapeOwnerTriggeredGuid", + "type": "event", + "members": [ + { + "kind": "data", + "name": "ready_at", + "type": "core::integer::u64" + }, + { + "kind": "data", + "name": "new_owner_guid", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::EscapeGuardianTriggeredGuid", + "type": "event", + "members": [ + { + "kind": "data", + "name": "ready_at", + "type": "core::integer::u64" + }, + { + "kind": "data", + "name": "new_guardian_guid", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::OwnerEscapedGuid", + "type": "event", + "members": [ + { + "kind": "data", + "name": "new_owner_guid", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::GuardianEscapedGuid", + "type": "event", + "members": [ + { + "kind": "data", + "name": "new_guardian_guid", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::EscapeCanceled", + "type": "event", + "members": [] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::OwnerChanged", + "type": "event", + "members": [ + { + "kind": "data", + "name": "new_owner", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::OwnerChangedGuid", + "type": "event", + "members": [ + { + "kind": "data", + "name": "new_owner_guid", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::GuardianChanged", + "type": "event", + "members": [ + { + "kind": "data", + "name": "new_guardian", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::GuardianChangedGuid", + "type": "event", + "members": [ + { + "kind": "data", + "name": "new_guardian_guid", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::GuardianBackupChanged", + "type": "event", + "members": [ + { + "kind": "data", + "name": "new_guardian_backup", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::GuardianBackupChangedGuid", + "type": "event", + "members": [ + { + "kind": "data", + "name": "new_guardian_backup_guid", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::SignerLinked", + "type": "event", + "members": [ + { + "kind": "key", + "name": "signer_guid", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "signer", + "type": "argent::signer::signer_signature::Signer" + } + ] + }, + { + "kind": "struct", + "name": "argent::presets::argent_account::ArgentAccount::EscapeSecurityPeriodChanged", + "type": "event", + "members": [ + { + "kind": "data", + "name": "escape_security_period", + "type": "core::integer::u64" + } + ] + }, + { + "kind": "enum", + "name": "argent::presets::argent_account::ArgentAccount::Event", + "type": "event", + "variants": [ + { + "kind": "flat", + "name": "ExecuteFromOutsideEvents", + "type": "argent::outside_execution::outside_execution::outside_execution_component::Event" + }, + { + "kind": "flat", + "name": "SRC5Events", + "type": "argent::introspection::src5::src5_component::Event" + }, + { + "kind": "flat", + "name": "UpgradeEvents", + "type": "argent::upgrade::upgrade::upgrade_component::Event" + }, + { + "kind": "flat", + "name": "SessionableEvents", + "type": "argent::session::session::session_component::Event" + }, + { + "kind": "flat", + "name": "ReentrancyGuardEvent", + "type": "openzeppelin::security::reentrancyguard::ReentrancyGuardComponent::Event" + }, + { + "kind": "nested", + "name": "TransactionExecuted", + "type": "argent::presets::argent_account::ArgentAccount::TransactionExecuted" + }, + { + "kind": "nested", + "name": "AccountCreated", + "type": "argent::presets::argent_account::ArgentAccount::AccountCreated" + }, + { + "kind": "nested", + "name": "AccountCreatedGuid", + "type": "argent::presets::argent_account::ArgentAccount::AccountCreatedGuid" + }, + { + "kind": "nested", + "name": "EscapeOwnerTriggeredGuid", + "type": "argent::presets::argent_account::ArgentAccount::EscapeOwnerTriggeredGuid" + }, + { + "kind": "nested", + "name": "EscapeGuardianTriggeredGuid", + "type": "argent::presets::argent_account::ArgentAccount::EscapeGuardianTriggeredGuid" + }, + { + "kind": "nested", + "name": "OwnerEscapedGuid", + "type": "argent::presets::argent_account::ArgentAccount::OwnerEscapedGuid" + }, + { + "kind": "nested", + "name": "GuardianEscapedGuid", + "type": "argent::presets::argent_account::ArgentAccount::GuardianEscapedGuid" + }, + { + "kind": "nested", + "name": "EscapeCanceled", + "type": "argent::presets::argent_account::ArgentAccount::EscapeCanceled" + }, + { + "kind": "nested", + "name": "OwnerChanged", + "type": "argent::presets::argent_account::ArgentAccount::OwnerChanged" + }, + { + "kind": "nested", + "name": "OwnerChangedGuid", + "type": "argent::presets::argent_account::ArgentAccount::OwnerChangedGuid" + }, + { + "kind": "nested", + "name": "GuardianChanged", + "type": "argent::presets::argent_account::ArgentAccount::GuardianChanged" + }, + { + "kind": "nested", + "name": "GuardianChangedGuid", + "type": "argent::presets::argent_account::ArgentAccount::GuardianChangedGuid" + }, + { + "kind": "nested", + "name": "GuardianBackupChanged", + "type": "argent::presets::argent_account::ArgentAccount::GuardianBackupChanged" + }, + { + "kind": "nested", + "name": "GuardianBackupChangedGuid", + "type": "argent::presets::argent_account::ArgentAccount::GuardianBackupChangedGuid" + }, + { + "kind": "nested", + "name": "SignerLinked", + "type": "argent::presets::argent_account::ArgentAccount::SignerLinked" + }, + { + "kind": "nested", + "name": "EscapeSecurityPeriodChanged", + "type": "argent::presets::argent_account::ArgentAccount::EscapeSecurityPeriodChanged" + } + ] + } + ] \ No newline at end of file diff --git a/packages/starknet-node/src/abi/braavos.abi.json b/packages/starknet-node/src/abi/braavos.abi.json new file mode 100644 index 0000000..d9b59ed --- /dev/null +++ b/packages/starknet-node/src/abi/braavos.abi.json @@ -0,0 +1,1089 @@ +[ + { + "name": "ExternalMethods", + "type": "impl", + "interface_name": "braavos_account::account::interface::IBraavosAccount" + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "core::starknet::account::Call", + "type": "struct", + "members": [ + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "selector", + "type": "core::felt252" + }, + { + "name": "calldata", + "type": "core::array::Span::" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "braavos_account::signers::signers::StarkPubKey", + "type": "struct", + "members": [ + { + "name": "pub_key", + "type": "core::felt252" + } + ] + }, + { + "name": "braavos_account::account::interface::RequiredSigner", + "type": "enum", + "variants": [ + { + "name": "NA", + "type": "()" + }, + { + "name": "Stark", + "type": "()" + }, + { + "name": "Strong", + "type": "()" + }, + { + "name": "Multisig", + "type": "()" + } + ] + }, + { + "name": "braavos_account::account::interface::IBraavosAccount", + "type": "interface", + "items": [ + { + "name": "__validate__", + "type": "function", + "inputs": [ + { + "name": "calls", + "type": "core::array::Span::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "name": "__execute__", + "type": "function", + "inputs": [ + { + "name": "calls", + "type": "core::array::Span::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "name": "is_valid_signature", + "type": "function", + "inputs": [ + { + "name": "hash", + "type": "core::felt252" + }, + { + "name": "signature", + "type": "core::array::Span::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "__validate_deploy__", + "type": "function", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + }, + { + "name": "salt", + "type": "core::felt252" + }, + { + "name": "stark_pub_key", + "type": "braavos_account::signers::signers::StarkPubKey" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "__validate_declare__", + "type": "function", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "initializer", + "type": "function", + "inputs": [ + { + "name": "stark_pub_key", + "type": "braavos_account::signers::signers::StarkPubKey" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "get_version", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "get_required_signer", + "type": "function", + "inputs": [ + { + "name": "calls", + "type": "core::array::Span::" + }, + { + "name": "fee_amount", + "type": "core::integer::u128" + }, + { + "name": "tx_version", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "braavos_account::account::interface::RequiredSigner" + } + ], + "state_mutability": "external" + } + ] + }, + { + "name": "DwlExternalImpl", + "type": "impl", + "interface_name": "braavos_account::dwl::interface::IDwlExternal" + }, + { + "name": "braavos_account::dwl::interface::IDwlExternal", + "type": "interface", + "items": [ + { + "name": "set_withdrawal_limit_low", + "type": "function", + "inputs": [ + { + "name": "withdrawal_limit_low", + "type": "core::integer::u128" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_withdrawal_limit_high", + "type": "function", + "inputs": [ + { + "name": "withdrawal_limit_high", + "type": "core::integer::u128" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "get_withdrawal_limit_low", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + }, + { + "name": "get_withdrawal_limit_high", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + }, + { + "name": "get_daily_spend", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + }, + { + "name": "get_fee_token_rate", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + }, + { + "name": "get_stark_fee_token_rate", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "RateConfigImpl", + "type": "impl", + "interface_name": "braavos_account::dwl::interface::IRateServiceExternal" + }, + { + "name": "core::bool", + "type": "enum", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "name": "braavos_account::dwl::interface::TokenConfig", + "type": "struct", + "members": [ + { + "name": "is_threshold_currency", + "type": "core::bool" + }, + { + "name": "token_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "pool_key", + "type": "core::felt252" + }, + { + "name": "is_threshold_currency_token0", + "type": "core::bool" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "braavos_account::dwl::interface::WhitelistCallConfig", + "type": "struct", + "members": [ + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "selector", + "type": "core::felt252" + }, + { + "name": "whitelist_call_type", + "type": "core::integer::u8" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "braavos_account::dwl::interface::IRateServiceExternal", + "type": "interface", + "items": [ + { + "name": "update_rate_config", + "type": "function", + "inputs": [ + { + "name": "white_listed_tokens", + "type": "core::array::Span::" + }, + { + "name": "white_listed_calls_list", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "SignerManagementImpl", + "type": "impl", + "interface_name": "braavos_account::signers::interface::ISignerManagement" + }, + { + "name": "braavos_account::signers::interface::GetSignersResponse", + "type": "struct", + "members": [ + { + "name": "stark", + "type": "core::array::Array::" + }, + { + "name": "secp256r1", + "type": "core::array::Array::" + }, + { + "name": "webauthn", + "type": "core::array::Array::" + } + ] + }, + { + "name": "core::integer::u256", + "type": "struct", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "name": "braavos_account::signers::signers::Secp256r1PubKey", + "type": "struct", + "members": [ + { + "name": "pub_x", + "type": "core::integer::u256" + }, + { + "name": "pub_y", + "type": "core::integer::u256" + } + ] + }, + { + "name": "braavos_account::signers::signer_type::SignerType", + "type": "enum", + "variants": [ + { + "name": "Empty", + "type": "()" + }, + { + "name": "Stark", + "type": "()" + }, + { + "name": "Secp256r1", + "type": "()" + }, + { + "name": "Webauthn", + "type": "()" + } + ] + }, + { + "name": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest", + "type": "struct", + "members": [ + { + "name": "expire_at", + "type": "core::integer::u64" + } + ] + }, + { + "name": "braavos_account::signers::interface::ISignerManagement", + "type": "interface", + "items": [ + { + "name": "get_public_key", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "get_signers", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "braavos_account::signers::interface::GetSignersResponse" + } + ], + "state_mutability": "view" + }, + { + "name": "add_secp256r1_signer", + "type": "function", + "inputs": [ + { + "name": "secp256r1_signer", + "type": "braavos_account::signers::signers::Secp256r1PubKey" + }, + { + "name": "signer_type", + "type": "braavos_account::signers::signer_type::SignerType" + }, + { + "name": "multisig_threshold", + "type": "core::integer::u32" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "remove_secp256r1_signer", + "type": "function", + "inputs": [ + { + "name": "guid", + "type": "core::felt252" + }, + { + "name": "signer_type", + "type": "braavos_account::signers::signer_type::SignerType" + }, + { + "name": "multisig_threshold", + "type": "core::integer::u32" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "change_secp256r1_signer", + "type": "function", + "inputs": [ + { + "name": "secp256r1_signer", + "type": "braavos_account::signers::signers::Secp256r1PubKey" + }, + { + "name": "existing_guid", + "type": "core::felt252" + }, + { + "name": "signer_type", + "type": "braavos_account::signers::signer_type::SignerType" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "deferred_remove_signers", + "type": "function", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "cancel_deferred_remove_signers", + "type": "function", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "get_deferred_remove_signers", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest" + } + ], + "state_mutability": "view" + }, + { + "name": "set_execution_time_delay", + "type": "function", + "inputs": [ + { + "name": "time_delay", + "type": "core::integer::u64" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "get_execution_time_delay", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "MultisigImpl", + "type": "impl", + "interface_name": "braavos_account::signers::interface::IMultisig" + }, + { + "name": "braavos_account::signers::interface::IMultisig", + "type": "interface", + "items": [ + { + "name": "set_multisig_threshold", + "type": "function", + "inputs": [ + { + "name": "multisig_threshold", + "type": "core::integer::u32" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "get_multisig_threshold", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "UpgradableImpl", + "type": "impl", + "interface_name": "braavos_account::upgradable::interface::IUpgradable" + }, + { + "name": "braavos_account::upgradable::interface::IUpgradable", + "type": "interface", + "items": [ + { + "name": "upgrade", + "type": "function", + "inputs": [ + { + "name": "upgrade_to", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "StorageMigrationImpl", + "type": "impl", + "interface_name": "braavos_account::upgradable::interface::IStorageMigration" + }, + { + "name": "braavos_account::upgradable::interface::IStorageMigration", + "type": "interface", + "items": [ + { + "name": "migrate_storage", + "type": "function", + "inputs": [ + { + "name": "from_version", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "SRC5Impl", + "type": "impl", + "interface_name": "braavos_account::introspection::interface::ISRC5WithCamelCase" + }, + { + "name": "braavos_account::introspection::interface::ISRC5WithCamelCase", + "type": "interface", + "items": [ + { + "name": "supports_interface", + "type": "function", + "inputs": [ + { + "name": "interface_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "supportsInterface", + "type": "function", + "inputs": [ + { + "name": "interfaceId", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "OutsideExecImpl", + "type": "impl", + "interface_name": "braavos_account::outside_execution::interface::IOutsideExecution_V2" + }, + { + "name": "braavos_account::outside_execution::interface::OutsideExecution", + "type": "struct", + "members": [ + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "nonce", + "type": "core::felt252" + }, + { + "name": "execute_after", + "type": "core::integer::u64" + }, + { + "name": "execute_before", + "type": "core::integer::u64" + }, + { + "name": "calls", + "type": "core::array::Span::" + } + ] + }, + { + "name": "braavos_account::outside_execution::interface::IOutsideExecution_V2", + "type": "interface", + "items": [ + { + "name": "execute_from_outside_v2", + "type": "function", + "inputs": [ + { + "name": "outside_execution", + "type": "braavos_account::outside_execution::interface::OutsideExecution" + }, + { + "name": "signature", + "type": "core::array::Span::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "name": "is_valid_outside_execution_nonce", + "type": "function", + "inputs": [ + { + "name": "nonce", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "constructor", + "type": "constructor", + "inputs": [] + }, + { + "kind": "struct", + "name": "braavos_account::signers::signer_management::SignerManagementComponent::OwnerAdded", + "type": "event", + "members": [ + { + "kind": "key", + "name": "new_owner_guid", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "signer_type", + "type": "braavos_account::signers::signer_type::SignerType" + }, + { + "kind": "data", + "name": "signer_data", + "type": "core::array::Span::" + } + ] + }, + { + "kind": "struct", + "name": "braavos_account::signers::signer_management::SignerManagementComponent::OwnerRemoved", + "type": "event", + "members": [ + { + "kind": "key", + "name": "removed_owner_guid", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "removed_signer_type", + "type": "braavos_account::signers::signer_type::SignerType" + } + ] + }, + { + "kind": "struct", + "name": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest", + "type": "event", + "members": [ + { + "kind": "data", + "name": "expire_at", + "type": "core::integer::u64" + } + ] + }, + { + "kind": "struct", + "name": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequestCancelled", + "type": "event", + "members": [ + { + "kind": "data", + "name": "cancelled_deferred_request", + "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest" + } + ] + }, + { + "kind": "struct", + "name": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequestExpired", + "type": "event", + "members": [ + { + "kind": "data", + "name": "expired_deferred_request", + "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest" + } + ] + }, + { + "kind": "enum", + "name": "braavos_account::signers::signer_management::SignerManagementComponent::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "OwnerAdded", + "type": "braavos_account::signers::signer_management::SignerManagementComponent::OwnerAdded" + }, + { + "kind": "nested", + "name": "OwnerRemoved", + "type": "braavos_account::signers::signer_management::SignerManagementComponent::OwnerRemoved" + }, + { + "kind": "nested", + "name": "DeferredRemoveSignerRequest", + "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest" + }, + { + "kind": "nested", + "name": "DeferredRemoveSignerRequestCancelled", + "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequestCancelled" + }, + { + "kind": "nested", + "name": "DeferredRemoveSignerRequestExpired", + "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequestExpired" + } + ] + }, + { + "kind": "struct", + "name": "braavos_account::signers::multisig::MultisigComponent::MultisigSet", + "type": "event", + "members": [ + { + "kind": "data", + "name": "multisig_threshold", + "type": "core::integer::u32" + } + ] + }, + { + "kind": "enum", + "name": "braavos_account::signers::multisig::MultisigComponent::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "MultisigSet", + "type": "braavos_account::signers::multisig::MultisigComponent::MultisigSet" + } + ] + }, + { + "kind": "struct", + "name": "braavos_account::upgradable::upgradable::UpgradableComponent::Upgraded", + "type": "event", + "members": [ + { + "kind": "key", + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ] + }, + { + "kind": "enum", + "name": "braavos_account::upgradable::upgradable::UpgradableComponent::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "Upgraded", + "type": "braavos_account::upgradable::upgradable::UpgradableComponent::Upgraded" + } + ] + }, + { + "kind": "enum", + "name": "braavos_account::introspection::src5::SRC5Component::Event", + "type": "event", + "variants": [] + }, + { + "kind": "struct", + "name": "braavos_account::dwl::dwl::DwlComponent::WithdrawalLimitLowSet", + "type": "event", + "members": [ + { + "kind": "data", + "name": "withdrawal_limit_low", + "type": "core::integer::u128" + } + ] + }, + { + "kind": "struct", + "name": "braavos_account::dwl::dwl::DwlComponent::WithdrawalLimitHighSet", + "type": "event", + "members": [ + { + "kind": "data", + "name": "withdrawal_limit_high", + "type": "core::integer::u128" + } + ] + }, + { + "kind": "enum", + "name": "braavos_account::dwl::dwl::DwlComponent::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "WithdrawalLimitLowSet", + "type": "braavos_account::dwl::dwl::DwlComponent::WithdrawalLimitLowSet" + }, + { + "kind": "nested", + "name": "WithdrawalLimitHighSet", + "type": "braavos_account::dwl::dwl::DwlComponent::WithdrawalLimitHighSet" + } + ] + }, + { + "kind": "enum", + "name": "braavos_account::dwl::rate_service::RateComponent::Event", + "type": "event", + "variants": [] + }, + { + "kind": "enum", + "name": "braavos_account::outside_execution::outside_execution::OutsideExecComponent::Event", + "type": "event", + "variants": [] + }, + { + "kind": "enum", + "name": "braavos_account::presets::braavos_account::BraavosAccount::Event", + "type": "event", + "variants": [ + { + "kind": "flat", + "name": "SignerMgtEvt", + "type": "braavos_account::signers::signer_management::SignerManagementComponent::Event" + }, + { + "kind": "flat", + "name": "MultisigEvt", + "type": "braavos_account::signers::multisig::MultisigComponent::Event" + }, + { + "kind": "flat", + "name": "UpgradableEvt", + "type": "braavos_account::upgradable::upgradable::UpgradableComponent::Event" + }, + { + "kind": "flat", + "name": "Src5Evt", + "type": "braavos_account::introspection::src5::SRC5Component::Event" + }, + { + "kind": "flat", + "name": "DwlEvent", + "type": "braavos_account::dwl::dwl::DwlComponent::Event" + }, + { + "kind": "flat", + "name": "RateEvent", + "type": "braavos_account::dwl::rate_service::RateComponent::Event" + }, + { + "kind": "flat", + "name": "OutsideExecEvt", + "type": "braavos_account::outside_execution::outside_execution::OutsideExecComponent::Event" + } + ] + } + ] \ No newline at end of file diff --git a/packages/starknet-node/src/abi/erc20.abi.json b/packages/starknet-node/src/abi/erc20.abi.json new file mode 100644 index 0000000..310944b --- /dev/null +++ b/packages/starknet-node/src/abi/erc20.abi.json @@ -0,0 +1,1122 @@ +[ + { + "name": "LockingContract", + "type": "impl", + "interface_name": "src::mintable_lock_interface::ILockingContract" + }, + { + "name": "src::mintable_lock_interface::ILockingContract", + "type": "interface", + "items": [ + { + "name": "set_locking_contract", + "type": "function", + "inputs": [ + { + "name": "locking_contract", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "get_locking_contract", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "LockAndDelegate", + "type": "impl", + "interface_name": "src::mintable_lock_interface::ILockAndDelegate" + }, + { + "name": "core::integer::u256", + "type": "struct", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "name": "src::mintable_lock_interface::ILockAndDelegate", + "type": "interface", + "items": [ + { + "name": "lock_and_delegate", + "type": "function", + "inputs": [ + { + "name": "delegatee", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "lock_and_delegate_by_sig", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "delegatee", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + }, + { + "name": "nonce", + "type": "core::felt252" + }, + { + "name": "expiry", + "type": "core::integer::u64" + }, + { + "name": "signature", + "type": "core::array::Array::" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "MintableToken", + "type": "impl", + "interface_name": "src::mintable_token_interface::IMintableToken" + }, + { + "name": "src::mintable_token_interface::IMintableToken", + "type": "interface", + "items": [ + { + "name": "permissioned_mint", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "permissioned_burn", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "MintableTokenCamelImpl", + "type": "impl", + "interface_name": "src::mintable_token_interface::IMintableTokenCamel" + }, + { + "name": "src::mintable_token_interface::IMintableTokenCamel", + "type": "interface", + "items": [ + { + "name": "permissionedMint", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "permissionedBurn", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "Replaceable", + "type": "impl", + "interface_name": "src::replaceability_interface::IReplaceable" + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "src::replaceability_interface::EICData", + "type": "struct", + "members": [ + { + "name": "eic_hash", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "eic_init_data", + "type": "core::array::Span::" + } + ] + }, + { + "name": "core::option::Option::", + "type": "enum", + "variants": [ + { + "name": "Some", + "type": "src::replaceability_interface::EICData" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "name": "core::bool", + "type": "enum", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "name": "src::replaceability_interface::ImplementationData", + "type": "struct", + "members": [ + { + "name": "impl_hash", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "eic_data", + "type": "core::option::Option::" + }, + { + "name": "final", + "type": "core::bool" + } + ] + }, + { + "name": "src::replaceability_interface::IReplaceable", + "type": "interface", + "items": [ + { + "name": "get_upgrade_delay", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "get_impl_activation_time", + "type": "function", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "add_new_implementation", + "type": "function", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "remove_implementation", + "type": "function", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "replace_to", + "type": "function", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "AccessControlImplExternal", + "type": "impl", + "interface_name": "src::access_control_interface::IAccessControl" + }, + { + "name": "src::access_control_interface::IAccessControl", + "type": "interface", + "items": [ + { + "name": "has_role", + "type": "function", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + }, + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "get_role_admin", + "type": "function", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "name": "RolesImpl", + "type": "impl", + "interface_name": "src::roles_interface::IMinimalRoles" + }, + { + "name": "src::roles_interface::IMinimalRoles", + "type": "interface", + "items": [ + { + "name": "is_governance_admin", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "is_upgrade_governor", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "register_governance_admin", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "remove_governance_admin", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "register_upgrade_governor", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "remove_upgrade_governor", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "renounce", + "type": "function", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "ERC20Impl", + "type": "impl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20" + }, + { + "name": "openzeppelin::token::erc20::interface::IERC20", + "type": "interface", + "items": [ + { + "name": "name", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "symbol", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "decimals", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u8" + } + ], + "state_mutability": "view" + }, + { + "name": "total_supply", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "balance_of", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "allowance", + "type": "function", + "inputs": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "transfer", + "type": "function", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "transfer_from", + "type": "function", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "approve", + "type": "function", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "name": "ERC20CamelOnlyImpl", + "type": "impl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20CamelOnly" + }, + { + "name": "openzeppelin::token::erc20::interface::IERC20CamelOnly", + "type": "interface", + "items": [ + { + "name": "totalSupply", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "balanceOf", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "transferFrom", + "type": "function", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "name": "constructor", + "type": "constructor", + "inputs": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "symbol", + "type": "core::felt252" + }, + { + "name": "decimals", + "type": "core::integer::u8" + }, + { + "name": "initial_supply", + "type": "core::integer::u256" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "permitted_minter", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "provisional_governance_admin", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "upgrade_delay", + "type": "core::integer::u64" + } + ] + }, + { + "name": "increase_allowance", + "type": "function", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "added_value", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "decrease_allowance", + "type": "function", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtracted_value", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "increaseAllowance", + "type": "function", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "addedValue", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "decreaseAllowance", + "type": "function", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtractedValue", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "kind": "struct", + "name": "src::strk::erc20_lockable::ERC20Lockable::Transfer", + "type": "event", + "members": [ + { + "kind": "data", + "name": "from", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "to", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "src::strk::erc20_lockable::ERC20Lockable::Approval", + "type": "event", + "members": [ + { + "kind": "data", + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "src::replaceability_interface::ImplementationAdded", + "type": "event", + "members": [ + { + "kind": "data", + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ] + }, + { + "kind": "struct", + "name": "src::replaceability_interface::ImplementationRemoved", + "type": "event", + "members": [ + { + "kind": "data", + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ] + }, + { + "kind": "struct", + "name": "src::replaceability_interface::ImplementationReplaced", + "type": "event", + "members": [ + { + "kind": "data", + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ] + }, + { + "kind": "struct", + "name": "src::replaceability_interface::ImplementationFinalized", + "type": "event", + "members": [ + { + "kind": "data", + "name": "impl_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ] + }, + { + "kind": "struct", + "name": "src::access_control_interface::RoleGranted", + "type": "event", + "members": [ + { + "kind": "data", + "name": "role", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "src::access_control_interface::RoleRevoked", + "type": "event", + "members": [ + { + "kind": "data", + "name": "role", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "src::access_control_interface::RoleAdminChanged", + "type": "event", + "members": [ + { + "kind": "data", + "name": "role", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "previous_admin_role", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "new_admin_role", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "src::roles_interface::GovernanceAdminAdded", + "type": "event", + "members": [ + { + "kind": "data", + "name": "added_account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "added_by", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "src::roles_interface::GovernanceAdminRemoved", + "type": "event", + "members": [ + { + "kind": "data", + "name": "removed_account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "removed_by", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "src::roles_interface::UpgradeGovernorAdded", + "type": "event", + "members": [ + { + "kind": "data", + "name": "added_account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "added_by", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "src::roles_interface::UpgradeGovernorRemoved", + "type": "event", + "members": [ + { + "kind": "data", + "name": "removed_account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "removed_by", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "enum", + "name": "src::strk::erc20_lockable::ERC20Lockable::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "Transfer", + "type": "src::strk::erc20_lockable::ERC20Lockable::Transfer" + }, + { + "kind": "nested", + "name": "Approval", + "type": "src::strk::erc20_lockable::ERC20Lockable::Approval" + }, + { + "kind": "nested", + "name": "ImplementationAdded", + "type": "src::replaceability_interface::ImplementationAdded" + }, + { + "kind": "nested", + "name": "ImplementationRemoved", + "type": "src::replaceability_interface::ImplementationRemoved" + }, + { + "kind": "nested", + "name": "ImplementationReplaced", + "type": "src::replaceability_interface::ImplementationReplaced" + }, + { + "kind": "nested", + "name": "ImplementationFinalized", + "type": "src::replaceability_interface::ImplementationFinalized" + }, + { + "kind": "nested", + "name": "RoleGranted", + "type": "src::access_control_interface::RoleGranted" + }, + { + "kind": "nested", + "name": "RoleRevoked", + "type": "src::access_control_interface::RoleRevoked" + }, + { + "kind": "nested", + "name": "RoleAdminChanged", + "type": "src::access_control_interface::RoleAdminChanged" + }, + { + "kind": "nested", + "name": "GovernanceAdminAdded", + "type": "src::roles_interface::GovernanceAdminAdded" + }, + { + "kind": "nested", + "name": "GovernanceAdminRemoved", + "type": "src::roles_interface::GovernanceAdminRemoved" + }, + { + "kind": "nested", + "name": "UpgradeGovernorAdded", + "type": "src::roles_interface::UpgradeGovernorAdded" + }, + { + "kind": "nested", + "name": "UpgradeGovernorRemoved", + "type": "src::roles_interface::UpgradeGovernorRemoved" + } + ] + } + ] \ No newline at end of file diff --git a/packages/starknet-node/src/client.ts b/packages/starknet-node/src/client.ts index a5f01f6..075b9b7 100644 --- a/packages/starknet-node/src/client.ts +++ b/packages/starknet-node/src/client.ts @@ -2,6 +2,7 @@ import { BaseNodeToken } from "@irys/upload/tokens/base"; import { Constructable, type TokenConfigTrimmed } from "@irys/upload/builder"; import BaseSTRK20Token from "./token"; + const STARKNET_PROVIDER_URL = "https://starknet-mainnet.public.blastapi.io"; const CONTRACT_ADDRESSES = { ETH: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", @@ -14,10 +15,10 @@ export class StarknetToken extends BaseSTRK20Token { super({ name: "starknet", ticker: "STRK", + ...config, contractAddress: config.opts?.contractAddress ?? CONTRACT_ADDRESSES.STRK, privateKey: config.opts?.privateKey ?? "", address: config.opts?.address ?? "", - irys: config.irys, providerUrl: config.providerUrl ?? STARKNET_PROVIDER_URL }); } diff --git a/packages/starknet-node/src/supportedWallets/abi/walletConfig.ts b/packages/starknet-node/src/supportedWallets/abi/walletConfig.ts new file mode 100644 index 0000000..b6ea73b --- /dev/null +++ b/packages/starknet-node/src/supportedWallets/abi/walletConfig.ts @@ -0,0 +1,16 @@ +import argentAbi from "../../abi/argent.abi.json"; +import braavosAbi from "../../abi/braavos.abi.json"; + +export const walletConfigs = [ + { + name: 'Argent', + abi: argentAbi, + selector: 'get_owner', + }, + { + name: 'Braavos', + abi: braavosAbi, + selector: 'get_public_key', + }, + ]; + \ No newline at end of file diff --git a/packages/starknet-node/src/token.ts b/packages/starknet-node/src/token.ts index 9ddc829..44d417b 100644 --- a/packages/starknet-node/src/token.ts +++ b/packages/starknet-node/src/token.ts @@ -1,10 +1,11 @@ -import { BaseNodeToken } from '@irys/upload/tokens/base'; -import type { TokenConfig, Tx } from '@irys/upload-core'; -import { Contract, RpcProvider, Provider } from 'starknet'; +import type {TokenConfig, Tx} from "@irys/upload-core"; +import {BaseNodeToken} from "@irys/upload/tokens/base" +import { Contract, RpcProvider, Provider, Result } from 'starknet'; import { StarknetSigner, Signer } from '@irys/bundles'; import BigNumber from 'bignumber.js'; import { num, Account, uint256 } from 'starknet'; - +import strkerc20token from "../src/abi/erc20.abi.json" +import { walletConfigs } from './supportedWallets/abi/walletConfig'; const starknetSigner = StarknetSigner; export interface STRKTokenConfig extends TokenConfig { @@ -93,22 +94,74 @@ export default class BaseSTRK20Token extends BaseNodeToken { } } - ownerToAddress(owner: any): string { - return this.signer.address; + + async ownerToAddress(_owner: any): Promise { + // Public key and address lengths + const publicKeyLength = 33; + const addressLength = 32; + + // Get the returned public key and convert to a buffer + const returnedPubKey = await this.getAccountPublicKey(); + const returnedPubKeyBuffer = Buffer.from(returnedPubKey.toString()); + + // Get the injected public key from the signer + const InjectedPublicKey = this.signer.publicKey; + + // Extracting the public key and address from the InjectedPublicKey + const extractedPublicKeyBuffer = InjectedPublicKey.slice.call(0, publicKeyLength); + const extractedAddressBuffer = InjectedPublicKey.slice.call(publicKeyLength, publicKeyLength + addressLength); + + // Convert extracted buffers to hex + const extractedAddressHex = extractedAddressBuffer.toString('hex'); + + // Check if the returned public key matches the extracted public key + if (returnedPubKeyBuffer.equals(extractedPublicKeyBuffer)) { + return extractedAddressHex; + } else { + return ""; + } } + + + + async getAccountPublicKey(): Promise { + if (!this._address) { + throw new Error('Address is not defined'); + } + + for (const config of walletConfigs) { + try { + const contractInstance = new Contract(config.abi, this._address, this.providerInstance); + const publicKey = await contractInstance.call(config.selector); + if (publicKey) { + return publicKey; + } + } catch (error) { + console.log(`${config.name} method failed.`); + } + } + + throw new Error(`Unable to retrieve the public key for address ${this._address}`); + } + + async sign(data: Uint8Array): Promise { return this.signer.sign(data); } + getSigner(): Signer { return this.signer; } + verify(pub: any, data: Uint8Array, signature: Uint8Array): Promise { return starknetSigner.verify(pub, data, signature); } + async getCurrentHeight(): Promise { const response = await this.providerInstance.getBlockNumber(); return new BigNumber(response, 16); } + async getFee( amount: BigNumber.Value, to?: string, @@ -209,343 +262,3 @@ interface Transaction { }; } -const strkerc20token = [ - { - members: [ - { - name: 'low', - offset: 0, - type: 'felt', - }, - { - name: 'high', - offset: 1, - type: 'felt', - }, - ], - name: 'Uint256', - size: 2, - type: 'struct', - }, - { - data: [ - { - name: 'from_', - type: 'felt', - }, - { - name: 'to', - type: 'felt', - }, - { - name: 'value', - type: 'Uint256', - }, - ], - keys: [], - name: 'Transfer', - type: 'event', - }, - { - data: [ - { - name: 'owner', - type: 'felt', - }, - { - name: 'spender', - type: 'felt', - }, - { - name: 'value', - type: 'Uint256', - }, - ], - keys: [], - name: 'Approval', - type: 'event', - }, - { - inputs: [], - name: 'name', - outputs: [ - { - name: 'name', - type: 'felt', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'symbol', - outputs: [ - { - name: 'symbol', - type: 'felt', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'totalSupply', - outputs: [ - { - name: 'totalSupply', - type: 'Uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'decimals', - outputs: [ - { - name: 'decimals', - type: 'felt', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - name: 'account', - type: 'felt', - }, - ], - name: 'balanceOf', - outputs: [ - { - name: 'balance', - type: 'Uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - name: 'owner', - type: 'felt', - }, - { - name: 'spender', - type: 'felt', - }, - ], - name: 'allowance', - outputs: [ - { - name: 'remaining', - type: 'Uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'permittedMinter', - outputs: [ - { - name: 'minter', - type: 'felt', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'initialized', - outputs: [ - { - name: 'res', - type: 'felt', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'get_version', - outputs: [ - { - name: 'version', - type: 'felt', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'get_identity', - outputs: [ - { - name: 'identity', - type: 'felt', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - name: 'init_vector_len', - type: 'felt', - }, - { - name: 'init_vector', - type: 'felt*', - }, - ], - name: 'initialize', - outputs: [], - type: 'function', - }, - { - inputs: [ - { - name: 'recipient', - type: 'felt', - }, - { - name: 'amount', - type: 'Uint256', - }, - ], - name: 'transfer', - outputs: [ - { - name: 'success', - type: 'felt', - }, - ], - type: 'function', - }, - { - inputs: [ - { - name: 'sender', - type: 'felt', - }, - { - name: 'recipient', - type: 'felt', - }, - { - name: 'amount', - type: 'Uint256', - }, - ], - name: 'transferFrom', - outputs: [ - { - name: 'success', - type: 'felt', - }, - ], - type: 'function', - }, - { - inputs: [ - { - name: 'spender', - type: 'felt', - }, - { - name: 'amount', - type: 'Uint256', - }, - ], - name: 'approve', - outputs: [ - { - name: 'success', - type: 'felt', - }, - ], - type: 'function', - }, - { - inputs: [ - { - name: 'spender', - type: 'felt', - }, - { - name: 'added_value', - type: 'Uint256', - }, - ], - name: 'increaseAllowance', - outputs: [ - { - name: 'success', - type: 'felt', - }, - ], - type: 'function', - }, - { - inputs: [ - { - name: 'spender', - type: 'felt', - }, - { - name: 'subtracted_value', - type: 'Uint256', - }, - ], - name: 'decreaseAllowance', - outputs: [ - { - name: 'success', - type: 'felt', - }, - ], - type: 'function', - }, - { - inputs: [ - { - name: 'recipient', - type: 'felt', - }, - { - name: 'amount', - type: 'Uint256', - }, - ], - name: 'permissionedMint', - outputs: [], - type: 'function', - }, - { - inputs: [ - { - name: 'account', - type: 'felt', - }, - { - name: 'amount', - type: 'Uint256', - }, - ], - name: 'permissionedBurn', - outputs: [], - type: 'function', - }, -]; diff --git a/packages/starknet-node/test/someFeature.test.ts b/packages/starknet-node/test/someFeature.test.ts index d36fba4..24d4274 100644 --- a/packages/starknet-node/test/someFeature.test.ts +++ b/packages/starknet-node/test/someFeature.test.ts @@ -1,6 +1,6 @@ import test from 'ava'; -import { MyToken } from '../src'; +import { StarknetToken } from '../src/client'; test('example test', async (t) => { - t.is(typeof MyToken, 'object'); + t.is(typeof StarknetToken, 'function'); }); From c3e9f3613ab5fc553342f8fe034000a6342af36d Mon Sep 17 00:00:00 2001 From: Adegbite Ademola Kelvin Date: Mon, 4 Nov 2024 14:50:55 +0100 Subject: [PATCH 3/9] chore: update --- packages/aptos-node/src/token.ts | 2 +- packages/ethereum/src/ethereum.ts | 2 +- packages/solana-node/src/token.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/aptos-node/src/token.ts b/packages/aptos-node/src/token.ts index f01eb97..23e7e6d 100644 --- a/packages/aptos-node/src/token.ts +++ b/packages/aptos-node/src/token.ts @@ -88,7 +88,7 @@ export class AptosConfig extends BaseNodeToken { }; } - ownerToAddress(owner: any): string { + async ownerToAddress(owner: any): Promise { const hash = sha3.sha3_256.create(); hash.update(Buffer.from(owner)); hash.update("\x00"); diff --git a/packages/ethereum/src/ethereum.ts b/packages/ethereum/src/ethereum.ts index fb71790..dcc09b2 100644 --- a/packages/ethereum/src/ethereum.ts +++ b/packages/ethereum/src/ethereum.ts @@ -51,7 +51,7 @@ export default class BaseEthereumToken extends BaseNodeToken { }; } - ownerToAddress(owner: any): string { + async ownerToAddress(owner: any): Promise { return "0x" + keccak256(owner.slice(1)).slice(-20).toString("hex"); } diff --git a/packages/solana-node/src/token.ts b/packages/solana-node/src/token.ts index 0a8665c..0240c79 100644 --- a/packages/solana-node/src/token.ts +++ b/packages/solana-node/src/token.ts @@ -68,7 +68,7 @@ export default class SolanaConfig extends BaseNodeToken { return tx; } - ownerToAddress(owner: any): string { + async ownerToAddress(owner: any): Promise { return bs58.encode(owner); } From 6dcbc3ec5759c96918d6b6bd68c4bf64c2b011f1 Mon Sep 17 00:00:00 2001 From: Adegbite Ademola Kelvin Date: Mon, 4 Nov 2024 14:53:11 +0100 Subject: [PATCH 4/9] chore: update --- examples/node/scripts/test-upload.ts | 11 +- examples/node/scripts/tokens/starknet.ts | 37 +++ .../{abi => }/walletConfig.ts | 4 +- packages/starknet-node/src/token.ts | 2 +- pnpm-lock.yaml | 260 +++++++++++++++++- 5 files changed, 298 insertions(+), 16 deletions(-) create mode 100644 examples/node/scripts/tokens/starknet.ts rename packages/starknet-node/src/supportedWallets/{abi => }/walletConfig.ts (67%) diff --git a/examples/node/scripts/test-upload.ts b/examples/node/scripts/test-upload.ts index 9969e37..2ce9b54 100644 --- a/examples/node/scripts/test-upload.ts +++ b/examples/node/scripts/test-upload.ts @@ -14,6 +14,7 @@ import { canUploadUsdcEth } from "./tokens/usdcEth"; import { canUploadUsdcPolygon } from "./tokens/usdcPolygon"; import { canUploadChainlink } from "./tokens/chainlink"; import { canUploadSolana } from "./tokens/solana"; +import {canUploadStarknet} from "./tokens/starknet" const runTests = async () => { @@ -96,8 +97,16 @@ const runTests = async () => { const usdcPolygonResult = await canUploadUsdcPolygon(); if (usdcPolygonResult) console.log("USDC on Polygon upload test passed."); else console.log("USDC on Polygon upload test failed."); - + + const uploadStarknet = await canUploadStarknet() + if(uploadStarknet)console.log("STRK on Starknet upload test passed."); + else console.log("STRK on Starknet upload test failed."); + }; runTests().catch((err) => console.error("Unexpected error during testing:", err)); + + + + diff --git a/examples/node/scripts/tokens/starknet.ts b/examples/node/scripts/tokens/starknet.ts new file mode 100644 index 0000000..88f51e3 --- /dev/null +++ b/examples/node/scripts/tokens/starknet.ts @@ -0,0 +1,37 @@ +import { Uploader } from "@irys/upload"; +import { Starknet, StarknetEth, StarknetToken } from "@irys/upload-starknet-node"; +import "dotenv/config"; + +/** + * Tests if data can be uploaded to Irys using USDCPolygon. + * + * @returns {Promise} Returns true if upload is successful, otherwise false. + */ +export const canUploadStarknet = async (): Promise => { + try { + // Initialize the Irys Uploader with the Ethereum wallet + const irysUploader = await Uploader(Starknet).withWallet("0x005d5c250b5c181684ae6d8ebfa0faeac3ad0c6f31a6c2f102a2fffddba00a05"); + + // Attempt to upload data to Irys + //@ts-ignore + const receipt = await irysUploader.upload("hirys", { + tags: [{ name: "Content-Type", value: "text/plain" }], + }); + + console.log('reciept:', receipt) + + // If an exception is not thrown, the upload was successful + // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); + return true; + } catch (error) { + console.error("Error during upload:", error); + return false; + } +}; +const privateKey = "0x005d5c250b5c181684ae6d8ebfa0faeac3ad0c6f31a6c2f102a2fffddba00a05"; +const address = "0x02F659cf8CCE41168B8c0A8BedCE468E33BE1B7bd26E920266C025Dc0F8FBD1b" + +const TokenConfigTrimmed = { + privateKey, + address, +} diff --git a/packages/starknet-node/src/supportedWallets/abi/walletConfig.ts b/packages/starknet-node/src/supportedWallets/walletConfig.ts similarity index 67% rename from packages/starknet-node/src/supportedWallets/abi/walletConfig.ts rename to packages/starknet-node/src/supportedWallets/walletConfig.ts index b6ea73b..edcca95 100644 --- a/packages/starknet-node/src/supportedWallets/abi/walletConfig.ts +++ b/packages/starknet-node/src/supportedWallets/walletConfig.ts @@ -1,5 +1,5 @@ -import argentAbi from "../../abi/argent.abi.json"; -import braavosAbi from "../../abi/braavos.abi.json"; +import argentAbi from "../abi/argent.abi.json"; +import braavosAbi from "../abi/braavos.abi.json"; export const walletConfigs = [ { diff --git a/packages/starknet-node/src/token.ts b/packages/starknet-node/src/token.ts index 44d417b..640faeb 100644 --- a/packages/starknet-node/src/token.ts +++ b/packages/starknet-node/src/token.ts @@ -5,7 +5,7 @@ import { StarknetSigner, Signer } from '@irys/bundles'; import BigNumber from 'bignumber.js'; import { num, Account, uint256 } from 'starknet'; import strkerc20token from "../src/abi/erc20.abi.json" -import { walletConfigs } from './supportedWallets/abi/walletConfig'; +import { walletConfigs } from './supportedWallets/walletConfig'; const starknetSigner = StarknetSigner; export interface STRKTokenConfig extends TokenConfig { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3a8b089..957547a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -149,7 +149,7 @@ importers: version: link:../../../packages/ethereum-web ethers: specifier: ^5.7.2 - version: 5.7.2 + version: 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) next: specifier: 14.2.7 version: 14.2.7(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -631,6 +631,31 @@ importers: specifier: ^6.1.3 version: 6.1.3(@ava/typescript@5.0.0) + packages/starknet-node: + dependencies: + '@irys/bundles': + specifier: ^0.0.2 + version: 0.0.2(arweave@1.15.1)(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@irys/upload': + specifier: workspace:^ + version: link:../upload-node + '@irys/upload-core': + specifier: workspace:^ + version: link:../upload-core + bignumber.js: + specifier: ^9.1.2 + version: 9.1.2 + starknet: + specifier: ^6.17.0 + version: 6.17.0 + devDependencies: + '@ava/typescript': + specifier: ^5.0.0 + version: 5.0.0 + ava: + specifier: ^6.1.3 + version: 6.1.3(@ava/typescript@5.0.0) + packages/upload-core: dependencies: '@irys/bundles': @@ -1597,6 +1622,9 @@ packages: '@irys/bundles@0.0.1': resolution: {integrity: sha512-yeQNzElERksFbfbNxJQsMkhtkI3+tNqIMZ/Wwxh76NVBmCnCP5huefOv7ET0MOO7TEQL+TqvKSqmFklYSvTyHw==} + '@irys/bundles@0.0.2': + resolution: {integrity: sha512-reLAQFYQ6zFvu1QS38fGyIHYWa5LNnoxWQLAtXnQBHw4ULlquGXKijuA2fz7TqkoYYbMMD2zhb5VwHuUX5FiQg==} + '@irys/query@0.0.9': resolution: {integrity: sha512-uBIy8qeOQupUSBzR+1KU02JJXFp5Ue9l810PIbBF/ylUB8RTreUFkyyABZ7J3FUaOIXFYrT7WVFSJSzXM7P+8w==} engines: {node: '>=16.10.0'} @@ -1706,6 +1734,9 @@ packages: '@noble/curves@1.2.0': resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==} + '@noble/curves@1.3.0': + resolution: {integrity: sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==} + '@noble/curves@1.4.0': resolution: {integrity: sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==} @@ -1723,6 +1754,10 @@ packages: resolution: {integrity: sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==} engines: {node: '>= 16'} + '@noble/hashes@1.3.3': + resolution: {integrity: sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==} + engines: {node: '>= 16'} + '@noble/hashes@1.4.0': resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} engines: {node: '>= 16'} @@ -1958,6 +1993,9 @@ packages: '@scure/bip39@1.4.0': resolution: {integrity: sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==} + '@scure/starknet@1.0.0': + resolution: {integrity: sha512-o5J57zY0f+2IL/mq8+AYJJ4Xpc1fOtDhr+mFQKbHnYFmm3WQrC+8zj2HEgxak1a+x86mhmBC1Kq305KUpVf0wg==} + '@shikijs/core@1.16.1': resolution: {integrity: sha512-aI0hBtw+a6KsJp2jcD4YuQqKpeCbURMZbhHVozDknJpm+KJqeMRkEnfBC8BaKE/5XC+uofPgCLsa/TkTk0Ba0w==} @@ -2082,6 +2120,9 @@ packages: '@solana/web3.js@1.95.3': resolution: {integrity: sha512-O6rPUN0w2fkNqx/Z3QJMB9L225Ex10PRDH8bTaIUPZXMPV0QP8ZpPvjQnXK+upUczlRgzHzd6SjKIha1p+I6og==} + '@starknet-io/types-js@0.7.7': + resolution: {integrity: sha512-WLrpK7LIaIb8Ymxu6KF/6JkGW1sso988DweWu7p5QY/3y7waBIiPvzh27D9bX5KIJNRDyOoOVoHVEKYUYWZ/RQ==} + '@supercharge/promise-pool@3.2.0': resolution: {integrity: sha512-pj0cAALblTZBPtMltWOlZTQSLT07jIaFNeM8TWoJD1cQMgDB9mcMlVMoetiB35OzNJpqQ2b+QEtwiR9f20mADg==} engines: {node: '>=8'} @@ -2347,6 +2388,10 @@ packages: abbrev@1.1.1: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + abi-wan-kanabi@2.2.3: + resolution: {integrity: sha512-JlqiAl9CPvTm5kKG0QXmVCWNWoC/XyRMOeT77cQlbxXWllgjf6SqUmaNqFon72C2o5OSZids+5FvLdsw6dvWaw==} + hasBin: true + abitype@1.0.5: resolution: {integrity: sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw==} peerDependencies: @@ -2442,6 +2487,9 @@ packages: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} + ansicolors@0.3.2: + resolution: {integrity: sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==} + any-promise@1.3.0: resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} @@ -2729,6 +2777,10 @@ packages: caniuse-lite@1.0.30001655: resolution: {integrity: sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==} + cardinal@2.1.1: + resolution: {integrity: sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw==} + hasBin: true + cbor@9.0.2: resolution: {integrity: sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ==} engines: {node: '>=16'} @@ -3361,6 +3413,9 @@ packages: fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} + fetch-cookie@3.0.1: + resolution: {integrity: sha512-ZGXe8Y5Z/1FWqQ9q/CrJhkUD73DyBU9VF0hBQmEO/wPHe4A9PKTjplFDLeFX8aOsYypZUcX5Ji/eByn3VCVO3Q==} + figures@3.2.0: resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} engines: {node: '>=8'} @@ -3434,6 +3489,10 @@ packages: resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} engines: {node: '>= 6'} + fs-extra@10.1.0: + resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} + engines: {node: '>=12'} + fs-extra@11.2.0: resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} engines: {node: '>=14.14'} @@ -3869,6 +3928,9 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + isomorphic-fetch@3.0.0: + resolution: {integrity: sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==} + isomorphic-ws@4.0.1: resolution: {integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==} peerDependencies: @@ -4061,6 +4123,9 @@ packages: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true + lossless-json@4.0.2: + resolution: {integrity: sha512-+z0EaLi2UcWi8MZRxA5iTb6m4Ys4E80uftGY+yG5KNFJb5EceQXOhdW/pWJZ8m97s26u7yZZAYMcKWNztSZssA==} + lowercase-keys@2.0.0: resolution: {integrity: sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==} engines: {node: '>=8'} @@ -4403,6 +4468,9 @@ packages: package-json-from-dist@1.0.0: resolution: {integrity: sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==} + pako@2.1.0: + resolution: {integrity: sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==} + parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -4591,6 +4659,9 @@ packages: pseudomap@1.0.2: resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} + psl@1.9.0: + resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + pump@3.0.0: resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} @@ -4602,6 +4673,9 @@ packages: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} + querystringify@2.2.0: + resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} + queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -4647,6 +4721,9 @@ packages: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} + redeyed@2.1.1: + resolution: {integrity: sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==} + reflect.getprototypeof@1.0.6: resolution: {integrity: sha512-fmfw4XgoDke3kdI6h4xcUz1dG8uaiv5q9gcEwLS4Pnth2kxT+GZ7YehS1JTMGBQmtV7Y4GFGbs2re2NqhdozUg==} engines: {node: '>= 0.4'} @@ -4686,6 +4763,9 @@ packages: require-relative@0.8.7: resolution: {integrity: sha512-AKGr4qvHiryxRb19m3PsLRGuKVAbJLUD7E6eOaHkfKhwc+vSgVOCY5xNvm9EkolBKTOf0GrQAZKLimOCz81Khg==} + requires-port@1.0.0: + resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} + resolve-alpn@1.2.1: resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==} @@ -4810,6 +4890,9 @@ packages: set-blocking@2.0.0: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} + set-cookie-parser@2.7.1: + resolution: {integrity: sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==} + set-function-length@1.2.2: resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} engines: {node: '>= 0.4'} @@ -4890,6 +4973,9 @@ packages: resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} engines: {node: '>=10'} + starknet@6.17.0: + resolution: {integrity: sha512-ZzqurYL8+Y0pnIXXvxnMc+8we4jhwH/qFG5tOkaAgWSPyTR44qbBjHSOMNO1eRAmkVg9IEdiBVaG5vTpiF8kTQ==} + stop-iteration-iterator@1.0.0: resolution: {integrity: sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==} engines: {node: '>= 0.4'} @@ -5073,6 +5159,10 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} + tough-cookie@4.1.4: + resolution: {integrity: sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==} + engines: {node: '>=6'} + tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} @@ -5089,6 +5179,9 @@ packages: ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + ts-mixer@6.0.4: + resolution: {integrity: sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA==} + ts-node@10.9.2: resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true @@ -5238,6 +5331,10 @@ packages: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} + universalify@0.2.0: + resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} + engines: {node: '>= 4.0.0'} + universalify@2.0.1: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} @@ -5251,6 +5348,9 @@ packages: uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + url-parse@1.5.10: + resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} + utf-8-validate@5.0.10: resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} engines: {node: '>=6.14.2'} @@ -5295,6 +5395,9 @@ packages: resolution: {integrity: sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==} engines: {node: '>=6'} + whatwg-fetch@3.6.20: + resolution: {integrity: sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==} + whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} @@ -6831,6 +6934,34 @@ snapshots: - encoding - utf-8-validate + '@irys/bundles@0.0.2(arweave@1.15.1)(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/providers': 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@ethersproject/signing-key': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/wallet': 5.7.0 + '@irys/arweave': 0.0.2 + '@noble/ed25519': 1.7.3 + base64url: 3.0.1 + bs58: 4.0.1 + keccak: 3.0.4 + secp256k1: 5.0.0 + starknet: 6.17.0 + optionalDependencies: + '@randlabs/myalgo-connect': 1.4.2 + algosdk: 1.24.1 + arweave-stream-tx: 1.2.2(arweave@1.15.1) + multistream: 4.1.0 + tmp-promise: 3.0.3 + transitivePeerDependencies: + - arweave + - bufferutil + - debug + - encoding + - utf-8-validate + '@irys/query@0.0.9': dependencies: async-retry: 1.3.3 @@ -6946,6 +7077,10 @@ snapshots: dependencies: '@noble/hashes': 1.3.2 + '@noble/curves@1.3.0': + dependencies: + '@noble/hashes': 1.3.3 + '@noble/curves@1.4.0': dependencies: '@noble/hashes': 1.4.0 @@ -6960,6 +7095,8 @@ snapshots: '@noble/hashes@1.3.2': {} + '@noble/hashes@1.3.3': {} + '@noble/hashes@1.4.0': {} '@noble/hashes@1.5.0': {} @@ -7152,6 +7289,11 @@ snapshots: '@noble/hashes': 1.5.0 '@scure/base': 1.1.8 + '@scure/starknet@1.0.0': + dependencies: + '@noble/curves': 1.3.0 + '@noble/hashes': 1.3.3 + '@shikijs/core@1.16.1': dependencies: '@shikijs/vscode-textmate': 9.2.0 @@ -7347,6 +7489,8 @@ snapshots: - encoding - utf-8-validate + '@starknet-io/types-js@0.7.7': {} + '@supercharge/promise-pool@3.2.0': {} '@swc/counter@0.1.3': {} @@ -7685,6 +7829,13 @@ snapshots: abbrev@1.1.1: {} + abi-wan-kanabi@2.2.3: + dependencies: + ansicolors: 0.3.2 + cardinal: 2.1.1 + fs-extra: 10.1.0 + yargs: 17.7.2 + abitype@1.0.5(typescript@5.5.4): optionalDependencies: typescript: 5.5.4 @@ -7769,6 +7920,8 @@ snapshots: ansi-styles@6.2.1: {} + ansicolors@0.3.2: {} + any-promise@1.3.0: {} anymatch@3.1.3: @@ -8139,6 +8292,11 @@ snapshots: caniuse-lite@1.0.30001655: {} + cardinal@2.1.1: + dependencies: + ansicolors: 0.3.2 + redeyed: 2.1.1 + cbor@9.0.2: dependencies: nofilter: 3.1.0 @@ -8659,8 +8817,8 @@ snapshots: '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.5.4) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0) - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0) + eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0) eslint-plugin-jsx-a11y: 6.10.0(eslint@8.57.0) eslint-plugin-react: 7.35.2(eslint@8.57.0) eslint-plugin-react-hooks: 4.6.2(eslint@8.57.0) @@ -8679,37 +8837,47 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0): + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.3.6 enhanced-resolve: 5.17.1 eslint: 8.57.0 - eslint-module-utils: 2.9.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + eslint-module-utils: 2.9.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0))(eslint@8.57.0) fast-glob: 3.3.2 get-tsconfig: 4.8.0 is-bun-module: 1.1.0 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.9.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0): + eslint-module-utils@2.9.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0))(eslint@8.57.0): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.5.4) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0) transitivePeerDependencies: - supports-color - eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0): + eslint-module-utils@2.9.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): + dependencies: + debug: 3.2.7 + optionalDependencies: + '@typescript-eslint/parser': 8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4) + eslint: 8.57.0 + eslint-import-resolver-node: 0.3.9 + transitivePeerDependencies: + - supports-color + + eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -8720,7 +8888,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.9.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) + eslint-module-utils: 2.9.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -8731,7 +8899,7 @@ snapshots: semver: 6.3.1 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/parser': 8.4.0(eslint@9.9.1(jiti@1.21.6))(typescript@5.5.4) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -8916,7 +9084,7 @@ snapshots: esutils@2.0.3: {} - ethers@5.7.2: + ethers@5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10): dependencies: '@ethersproject/abi': 5.7.0 '@ethersproject/abstract-provider': 5.7.0 @@ -9033,6 +9201,11 @@ snapshots: dependencies: reusify: 1.0.4 + fetch-cookie@3.0.1: + dependencies: + set-cookie-parser: 2.7.1 + tough-cookie: 4.1.4 + figures@3.2.0: dependencies: escape-string-regexp: 1.0.5 @@ -9109,6 +9282,12 @@ snapshots: combined-stream: 1.0.8 mime-types: 2.1.35 + fs-extra@10.1.0: + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.1.0 + universalify: 2.0.1 + fs-extra@11.2.0: dependencies: graceful-fs: 4.2.11 @@ -9566,6 +9745,13 @@ snapshots: isexe@2.0.0: {} + isomorphic-fetch@3.0.0: + dependencies: + node-fetch: 2.7.0 + whatwg-fetch: 3.6.20 + transitivePeerDependencies: + - encoding + isomorphic-ws@4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)): dependencies: ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) @@ -9763,6 +9949,8 @@ snapshots: dependencies: js-tokens: 4.0.0 + lossless-json@4.0.2: {} + lowercase-keys@2.0.0: {} lru-cache@10.4.3: {} @@ -10086,6 +10274,8 @@ snapshots: package-json-from-dist@1.0.0: {} + pako@2.1.0: {} + parent-module@1.0.1: dependencies: callsites: 3.1.0 @@ -10251,6 +10441,8 @@ snapshots: pseudomap@1.0.2: {} + psl@1.9.0: {} + pump@3.0.0: dependencies: end-of-stream: 1.4.4 @@ -10260,6 +10452,8 @@ snapshots: punycode@2.3.1: {} + querystringify@2.2.0: {} + queue-microtask@1.2.3: {} quick-lru@5.1.1: {} @@ -10307,6 +10501,10 @@ snapshots: dependencies: picomatch: 2.3.1 + redeyed@2.1.1: + dependencies: + esprima: 4.0.1 + reflect.getprototypeof@1.0.6: dependencies: call-bind: 1.0.7 @@ -10355,6 +10553,8 @@ snapshots: require-relative@0.8.7: {} + requires-port@1.0.0: {} + resolve-alpn@1.2.1: {} resolve-cwd@3.0.0: @@ -10501,6 +10701,8 @@ snapshots: set-blocking@2.0.0: {} + set-cookie-parser@2.7.1: {} + set-function-length@1.2.2: dependencies: define-data-property: 1.1.4 @@ -10581,6 +10783,22 @@ snapshots: dependencies: escape-string-regexp: 2.0.0 + starknet@6.17.0: + dependencies: + '@noble/curves': 1.3.0 + '@noble/hashes': 1.3.2 + '@scure/base': 1.1.8 + '@scure/starknet': 1.0.0 + abi-wan-kanabi: 2.2.3 + fetch-cookie: 3.0.1 + isomorphic-fetch: 3.0.0 + lossless-json: 4.0.2 + pako: 2.1.0 + starknet-types-07: '@starknet-io/types-js@0.7.7' + ts-mixer: 6.0.4 + transitivePeerDependencies: + - encoding + stop-iteration-iterator@1.0.0: dependencies: internal-slot: 1.0.7 @@ -10801,6 +11019,13 @@ snapshots: dependencies: is-number: 7.0.0 + tough-cookie@4.1.4: + dependencies: + psl: 1.9.0 + punycode: 2.3.1 + universalify: 0.2.0 + url-parse: 1.5.10 + tr46@0.0.3: {} tree-kill@1.2.2: {} @@ -10811,6 +11036,8 @@ snapshots: ts-interface-checker@0.1.13: {} + ts-mixer@6.0.4: {} + ts-node@10.9.2(@types/node@20.16.4)(typescript@5.5.4): dependencies: '@cspotcode/source-map-support': 0.8.1 @@ -10983,6 +11210,8 @@ snapshots: universalify@0.1.2: {} + universalify@0.2.0: {} + universalify@2.0.1: {} update-browserslist-db@1.1.0(browserslist@4.23.3): @@ -10995,6 +11224,11 @@ snapshots: dependencies: punycode: 2.3.1 + url-parse@1.5.10: + dependencies: + querystringify: 2.2.0 + requires-port: 1.0.0 + utf-8-validate@5.0.10: dependencies: node-gyp-build: 4.8.2 @@ -11053,6 +11287,8 @@ snapshots: well-known-symbols@2.0.0: {} + whatwg-fetch@3.6.20: {} + whatwg-url@5.0.0: dependencies: tr46: 0.0.3 From 1059410bbfe8d86194bb08df78f1f9451b93489c Mon Sep 17 00:00:00 2001 From: Adegbite Ademola Kelvin Date: Mon, 4 Nov 2024 15:04:43 +0100 Subject: [PATCH 5/9] chore: change buffer slice method to subarray --- packages/starknet-node/src/token.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/starknet-node/src/token.ts b/packages/starknet-node/src/token.ts index 640faeb..249573f 100644 --- a/packages/starknet-node/src/token.ts +++ b/packages/starknet-node/src/token.ts @@ -108,8 +108,8 @@ export default class BaseSTRK20Token extends BaseNodeToken { const InjectedPublicKey = this.signer.publicKey; // Extracting the public key and address from the InjectedPublicKey - const extractedPublicKeyBuffer = InjectedPublicKey.slice.call(0, publicKeyLength); - const extractedAddressBuffer = InjectedPublicKey.slice.call(publicKeyLength, publicKeyLength + addressLength); + const extractedPublicKeyBuffer = InjectedPublicKey.subarray(0, publicKeyLength); + const extractedAddressBuffer = InjectedPublicKey.subarray(publicKeyLength, publicKeyLength + addressLength); // Convert extracted buffers to hex const extractedAddressHex = extractedAddressBuffer.toString('hex'); From 050f5d919560025164c1e2ef1a107cb06eef6904 Mon Sep 17 00:00:00 2001 From: Adegbite Ademola Kelvin Date: Tue, 12 Nov 2024 09:44:07 +0100 Subject: [PATCH 6/9] chore:fix build issue --- examples/node/package.json | 3 ++- examples/node/scripts/tokens/starknet.ts | 2 +- packages/aptos-web/src/token.ts | 6 +++--- packages/ethereum-web/src/ethereum.ts | 2 +- packages/solana-web/src/token.ts | 2 +- packages/upload-core/src/types.ts | 2 +- packages/upload-core/src/withdrawal.ts | 2 +- packages/upload-node/src/tokens/base.ts | 11 +++++++++-- packages/upload-web/src/tokens/base.ts | 11 ++++++++--- pnpm-lock.yaml | 3 +++ 10 files changed, 30 insertions(+), 14 deletions(-) diff --git a/examples/node/package.json b/examples/node/package.json index 7391428..c5cc4cf 100644 --- a/examples/node/package.json +++ b/examples/node/package.json @@ -9,7 +9,8 @@ "@irys/web-upload": "workspace:^", "@irys/web-upload-ethereum": "workspace:^", "@irys/web-upload-ethereum-ethers-v6": "workspace:^", - "@irys/web-upload-ethereum-viem-v2": "workspace:^" + "@irys/web-upload-ethereum-viem-v2": "workspace:^", + "@irys/upload-starknet-node":"workspace:^" }, "version": "1.0.2", "scripts": {}, diff --git a/examples/node/scripts/tokens/starknet.ts b/examples/node/scripts/tokens/starknet.ts index 88f51e3..63acb9b 100644 --- a/examples/node/scripts/tokens/starknet.ts +++ b/examples/node/scripts/tokens/starknet.ts @@ -7,7 +7,7 @@ import "dotenv/config"; * * @returns {Promise} Returns true if upload is successful, otherwise false. */ -export const canUploadStarknet = async (): Promise => { +export const canUploadStarknet = async (): Promise => {3 try { // Initialize the Irys Uploader with the Ethereum wallet const irysUploader = await Uploader(Starknet).withWallet("0x005d5c250b5c181684ae6d8ebfa0faeac3ad0c6f31a6c2f102a2fffddba00a05"); diff --git a/packages/aptos-web/src/token.ts b/packages/aptos-web/src/token.ts index 2fa42b6..cf71e8e 100644 --- a/packages/aptos-web/src/token.ts +++ b/packages/aptos-web/src/token.ts @@ -102,11 +102,11 @@ export default class AptosConfig extends BaseWebToken { }; } - ownerToAddress(owner: any): string { + async ownerToAddress(owner: any): Promise { const hash = sha3.sha3_256.create(); hash.update(Buffer.from(owner)); hash.update("\x00"); - return `0x${hash.hex()}`; + return await `0x${hash.hex()}`; } async sign(data: Uint8Array): Promise { @@ -249,7 +249,7 @@ export default class AptosConfig extends BaseWebToken { // this.providerUrl is a Network enum type represents the current configured network this.aptosConfig = new AptosSDKConfig({ network: this.providerUrl, ...this.config?.opts?.aptosSdkConfig }); this._publicKey = (await this.getPublicKey()) as Buffer; - this._address = this.ownerToAddress(this._publicKey); + this._address = await this.ownerToAddress(this._publicKey); const client = await this.getProvider(); diff --git a/packages/ethereum-web/src/ethereum.ts b/packages/ethereum-web/src/ethereum.ts index e9ca755..0f05ffb 100644 --- a/packages/ethereum-web/src/ethereum.ts +++ b/packages/ethereum-web/src/ethereum.ts @@ -42,7 +42,7 @@ export class EthereumConfig extends BaseWebToken { }; } - ownerToAddress(owner: any): string { + ownerToAddress(owner: any): Promise { // return ( // "0x" + // keccak256(Buffer.from(owner.slice(1))) diff --git a/packages/solana-web/src/token.ts b/packages/solana-web/src/token.ts index 6012123..3126344 100644 --- a/packages/solana-web/src/token.ts +++ b/packages/solana-web/src/token.ts @@ -61,7 +61,7 @@ export default class SolanaConfig extends BaseWebToken { return tx; } - ownerToAddress(owner: any): string { + async ownerToAddress(owner: any): Promise { if (typeof owner === "string") { owner = Buffer.from(owner); } diff --git a/packages/upload-core/src/types.ts b/packages/upload-core/src/types.ts index b5e245c..bf5d729 100644 --- a/packages/upload-core/src/types.ts +++ b/packages/upload-core/src/types.ts @@ -83,7 +83,7 @@ export type Token = { getTx(txId: string): Promise; - ownerToAddress(owner: any): string; + ownerToAddress(owner: any): Promise; price(): Promise; diff --git a/packages/upload-core/src/withdrawal.ts b/packages/upload-core/src/withdrawal.ts index d3d80e4..9ededf6 100644 --- a/packages/upload-core/src/withdrawal.ts +++ b/packages/upload-core/src/withdrawal.ts @@ -43,7 +43,7 @@ export async function withdrawBalance(utils: Utils, api: Api, amount: BigNumber. const dh2 = await deepHash([stringToBuffer(data.currency), stringToBuffer(data.amount.toString()), stringToBuffer(data.nonce.toString())]); const isValid2 = await c.verify(cpk, dh2, csig); - const isValid3 = c.ownerToAddress(c.name == "arweave" ? base64url.decode(data.publicKey) : base64url.toBuffer(data.publicKey)) === c.address; + const isValid3 = await c.ownerToAddress(c.name == "arweave" ? base64url.decode(data.publicKey) : base64url.toBuffer(data.publicKey)) === c.address; if (!(isValid || isValid2 || isValid3)) { throw new Error(`Internal withdrawal validation failed - please report this!\nDebug Info:${JSON.stringify(data)}`); diff --git a/packages/upload-node/src/tokens/base.ts b/packages/upload-node/src/tokens/base.ts index f2a9f84..f9a7263 100644 --- a/packages/upload-node/src/tokens/base.ts +++ b/packages/upload-node/src/tokens/base.ts @@ -22,7 +22,8 @@ export abstract class BaseNodeToken implements NodeToken { constructor(config: TokenConfig) { Object.assign(this, config); - this._address = this.wallet ? this.ownerToAddress(this.getPublicKey()) : undefined; + this.initializeAddress() + // this._address = this.wallet ? this.ownerToAddress(this.getPublicKey()) : undefined; } // common methods @@ -31,11 +32,17 @@ export abstract class BaseNodeToken implements NodeToken { return this._address; } + private async initializeAddress() { + if (this.wallet) { + this._address = await this.ownerToAddress(this.getPublicKey()); + } + } + async price(): Promise { return getRedstonePrice(this.ticker); } abstract getTx(_txId: string): Promise; - abstract ownerToAddress(_owner: any): string; + abstract ownerToAddress(_owner: any): Promise; abstract sign(_data: Uint8Array): Promise; abstract getSigner(): Signer; abstract verify(_pub: any, _data: Uint8Array, _signature: Uint8Array): Promise; diff --git a/packages/upload-web/src/tokens/base.ts b/packages/upload-web/src/tokens/base.ts index efd5d7d..1445bf4 100644 --- a/packages/upload-web/src/tokens/base.ts +++ b/packages/upload-web/src/tokens/base.ts @@ -33,15 +33,20 @@ export abstract class BaseWebToken implements WebToken { return this._address; } + public async ready(): Promise { - this._address = this.wallet ? this.ownerToAddress(await this.getPublicKey()) : undefined; - } + if (this.wallet) { + this._address = await this.ownerToAddress(await this.getPublicKey()); + } else { + this._address = undefined; + } +} async price(): Promise { return getRedstonePrice(this.ticker); } abstract getTx(_txId: string): Promise; - abstract ownerToAddress(_owner: any): string; + abstract ownerToAddress(_owner: any): Promise; abstract sign(_data: Uint8Array): Promise; abstract getSigner(): Signer; abstract verify(_pub: any, _data: Uint8Array, _signature: Uint8Array): Promise; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 957547a..658cab4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -126,6 +126,9 @@ importers: '@irys/upload-solana': specifier: workspace:^ version: link:../../packages/solana-node + '@irys/upload-starknet-node': + specifier: workspace:^ + version: link:../../packages/starknet-node '@irys/web-upload': specifier: workspace:^ version: link:../../packages/upload-web From 005f627b6b2a5fa43c4c54fd21167f84bc1921a2 Mon Sep 17 00:00:00 2001 From: Adegbite Ademola Kelvin Date: Thu, 14 Nov 2024 23:02:53 +0100 Subject: [PATCH 7/9] chore: remove unused abi and add new properties to wallet config --- .../starknet-node/src/abi/argent.abi.json | 1674 +---------------- .../starknet-node/src/abi/braavos.abi.json | 1096 +---------- .../src/supportedWallets/walletConfig.ts | 31 +- packages/starknet-node/src/token.ts | 4 + 4 files changed, 51 insertions(+), 2754 deletions(-) diff --git a/packages/starknet-node/src/abi/argent.abi.json b/packages/starknet-node/src/abi/argent.abi.json index c52c392..d550b97 100644 --- a/packages/starknet-node/src/abi/argent.abi.json +++ b/packages/starknet-node/src/abi/argent.abi.json @@ -1,1657 +1,19 @@ [ - { - "name": "AccountImpl", - "type": "impl", - "interface_name": "argent::account::interface::IAccount" - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "core::starknet::account::Call", - "type": "struct", - "members": [ - { - "name": "to", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "selector", - "type": "core::felt252" - }, - { - "name": "calldata", - "type": "core::array::Span::" - } - ] - }, - { - "name": "argent::account::interface::IAccount", - "type": "interface", - "items": [ - { - "name": "__validate__", - "type": "function", - "inputs": [ - { - "name": "calls", - "type": "core::array::Array::" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "external" - }, - { - "name": "__execute__", - "type": "function", - "inputs": [ - { - "name": "calls", - "type": "core::array::Array::" - } - ], - "outputs": [ - { - "type": "core::array::Array::>" - } - ], - "state_mutability": "external" - }, - { - "name": "is_valid_signature", - "type": "function", - "inputs": [ - { - "name": "hash", - "type": "core::felt252" - }, - { - "name": "signature", - "type": "core::array::Array::" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "UpgradeableCallbackOldImpl", - "type": "impl", - "interface_name": "argent::upgrade::interface::IUpgradableCallbackOld" - }, - { - "name": "argent::upgrade::interface::IUpgradableCallbackOld", - "type": "interface", - "items": [ - { - "name": "execute_after_upgrade", - "type": "function", - "inputs": [ - { - "name": "data", - "type": "core::array::Array::" - } - ], - "outputs": [ - { - "type": "core::array::Array::" - } - ], - "state_mutability": "external" - } - ] - }, - { - "name": "UpgradeableCallbackImpl", - "type": "impl", - "interface_name": "argent::upgrade::interface::IUpgradableCallback" - }, - { - "name": "argent::upgrade::interface::IUpgradableCallback", - "type": "interface", - "items": [ - { - "name": "perform_upgrade", - "type": "function", - "inputs": [ - { - "name": "new_implementation", - "type": "core::starknet::class_hash::ClassHash" - }, - { - "name": "data", - "type": "core::array::Span::" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "name": "ArgentUserAccountImpl", - "type": "impl", - "interface_name": "argent::account::interface::IArgentUserAccount" - }, - { - "name": "argent::signer::signer_signature::StarknetSigner", - "type": "struct", - "members": [ - { - "name": "pubkey", - "type": "core::zeroable::NonZero::" - } - ] - }, - { - "name": "core::starknet::eth_address::EthAddress", - "type": "struct", - "members": [ - { - "name": "address", - "type": "core::felt252" - } - ] - }, - { - "name": "argent::signer::signer_signature::Secp256k1Signer", - "type": "struct", - "members": [ - { - "name": "pubkey_hash", - "type": "core::starknet::eth_address::EthAddress" - } - ] - }, - { - "name": "core::integer::u256", - "type": "struct", - "members": [ - { - "name": "low", - "type": "core::integer::u128" - }, - { - "name": "high", - "type": "core::integer::u128" - } - ] - }, - { - "name": "argent::signer::signer_signature::Secp256r1Signer", - "type": "struct", - "members": [ - { - "name": "pubkey", - "type": "core::zeroable::NonZero::" - } - ] - }, - { - "name": "argent::signer::signer_signature::Eip191Signer", - "type": "struct", - "members": [ - { - "name": "eth_address", - "type": "core::starknet::eth_address::EthAddress" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "argent::signer::signer_signature::WebauthnSigner", - "type": "struct", - "members": [ - { - "name": "origin", - "type": "core::array::Span::" - }, - { - "name": "rp_id_hash", - "type": "core::zeroable::NonZero::" - }, - { - "name": "pubkey", - "type": "core::zeroable::NonZero::" - } - ] - }, - { - "name": "argent::signer::signer_signature::Signer", - "type": "enum", - "variants": [ - { - "name": "Starknet", - "type": "argent::signer::signer_signature::StarknetSigner" - }, - { - "name": "Secp256k1", - "type": "argent::signer::signer_signature::Secp256k1Signer" - }, - { - "name": "Secp256r1", - "type": "argent::signer::signer_signature::Secp256r1Signer" - }, - { - "name": "Eip191", - "type": "argent::signer::signer_signature::Eip191Signer" - }, - { - "name": "Webauthn", - "type": "argent::signer::signer_signature::WebauthnSigner" - } - ] - }, - { - "name": "core::option::Option::", - "type": "enum", - "variants": [ - { - "name": "Some", - "type": "argent::signer::signer_signature::Signer" - }, - { - "name": "None", - "type": "()" - } - ] - }, - { - "name": "argent::signer::signer_signature::StarknetSignature", - "type": "struct", - "members": [ - { - "name": "r", - "type": "core::felt252" - }, - { - "name": "s", - "type": "core::felt252" - } - ] - }, - { - "name": "core::bool", - "type": "enum", - "variants": [ - { - "name": "False", - "type": "()" - }, - { - "name": "True", - "type": "()" - } - ] - }, - { - "name": "core::starknet::secp256_trait::Signature", - "type": "struct", - "members": [ - { - "name": "r", - "type": "core::integer::u256" - }, - { - "name": "s", - "type": "core::integer::u256" - }, - { - "name": "y_parity", - "type": "core::bool" - } - ] - }, - { - "name": "argent::signer::webauthn::Sha256Implementation", - "type": "enum", - "variants": [ - { - "name": "Cairo0", - "type": "()" - }, - { - "name": "Cairo1", - "type": "()" - } - ] - }, - { - "name": "argent::signer::webauthn::WebauthnSignature", - "type": "struct", - "members": [ - { - "name": "cross_origin", - "type": "core::bool" - }, - { - "name": "client_data_json_outro", - "type": "core::array::Span::" - }, - { - "name": "flags", - "type": "core::integer::u8" - }, - { - "name": "sign_count", - "type": "core::integer::u32" - }, - { - "name": "ec_signature", - "type": "core::starknet::secp256_trait::Signature" - }, - { - "name": "sha256_implementation", - "type": "argent::signer::webauthn::Sha256Implementation" - } - ] - }, - { - "name": "argent::signer::signer_signature::SignerSignature", - "type": "enum", - "variants": [ - { - "name": "Starknet", - "type": "(argent::signer::signer_signature::StarknetSigner, argent::signer::signer_signature::StarknetSignature)" - }, - { - "name": "Secp256k1", - "type": "(argent::signer::signer_signature::Secp256k1Signer, core::starknet::secp256_trait::Signature)" - }, - { - "name": "Secp256r1", - "type": "(argent::signer::signer_signature::Secp256r1Signer, core::starknet::secp256_trait::Signature)" - }, - { - "name": "Eip191", - "type": "(argent::signer::signer_signature::Eip191Signer, core::starknet::secp256_trait::Signature)" - }, - { - "name": "Webauthn", - "type": "(argent::signer::signer_signature::WebauthnSigner, argent::signer::webauthn::WebauthnSignature)" - } - ] - }, - { - "name": "argent::signer::signer_signature::SignerType", - "type": "enum", - "variants": [ - { - "name": "Starknet", - "type": "()" - }, - { - "name": "Secp256k1", - "type": "()" - }, - { - "name": "Secp256r1", - "type": "()" - }, - { - "name": "Eip191", - "type": "()" - }, - { - "name": "Webauthn", - "type": "()" - } - ] - }, - { - "name": "core::option::Option::", - "type": "enum", - "variants": [ - { - "name": "Some", - "type": "core::felt252" - }, - { - "name": "None", - "type": "()" - } - ] - }, - { - "name": "core::option::Option::", - "type": "enum", - "variants": [ - { - "name": "Some", - "type": "argent::signer::signer_signature::SignerType" - }, - { - "name": "None", - "type": "()" - } - ] - }, - { - "name": "argent::recovery::interface::LegacyEscapeType", - "type": "enum", - "variants": [ - { - "name": "None", - "type": "()" - }, - { - "name": "Guardian", - "type": "()" - }, - { - "name": "Owner", - "type": "()" - } - ] - }, - { - "name": "argent::signer::signer_signature::SignerStorageValue", - "type": "struct", - "members": [ - { - "name": "stored_value", - "type": "core::felt252" - }, - { - "name": "signer_type", - "type": "argent::signer::signer_signature::SignerType" - } - ] - }, - { - "name": "core::option::Option::", - "type": "enum", - "variants": [ - { - "name": "Some", - "type": "argent::signer::signer_signature::SignerStorageValue" - }, - { - "name": "None", - "type": "()" - } - ] - }, - { - "name": "argent::recovery::interface::LegacyEscape", - "type": "struct", - "members": [ - { - "name": "ready_at", - "type": "core::integer::u64" - }, - { - "name": "escape_type", - "type": "argent::recovery::interface::LegacyEscapeType" - }, - { - "name": "new_signer", - "type": "core::option::Option::" - } - ] - }, - { - "name": "argent::account::interface::Version", - "type": "struct", - "members": [ - { - "name": "major", - "type": "core::integer::u8" - }, - { - "name": "minor", - "type": "core::integer::u8" - }, - { - "name": "patch", - "type": "core::integer::u8" - } - ] - }, - { - "name": "argent::recovery::interface::EscapeStatus", - "type": "enum", - "variants": [ - { - "name": "None", - "type": "()" - }, - { - "name": "NotReady", - "type": "()" - }, - { - "name": "Ready", - "type": "()" - }, - { - "name": "Expired", - "type": "()" - } - ] - }, - { - "name": "argent::account::interface::IArgentUserAccount", - "type": "interface", - "items": [ - { - "name": "__validate_declare__", - "type": "function", - "inputs": [ - { - "name": "class_hash", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "__validate_deploy__", - "type": "function", - "inputs": [ - { - "name": "class_hash", - "type": "core::felt252" - }, - { - "name": "contract_address_salt", - "type": "core::felt252" - }, - { - "name": "owner", - "type": "argent::signer::signer_signature::Signer" - }, - { - "name": "guardian", - "type": "core::option::Option::" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "set_escape_security_period", - "type": "function", - "inputs": [ - { - "name": "new_security_period", - "type": "core::integer::u64" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "change_owner", - "type": "function", - "inputs": [ - { - "name": "signer_signature", - "type": "argent::signer::signer_signature::SignerSignature" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "change_guardian", - "type": "function", - "inputs": [ - { - "name": "new_guardian", - "type": "core::option::Option::" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "change_guardian_backup", - "type": "function", - "inputs": [ - { - "name": "new_guardian_backup", - "type": "core::option::Option::" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "trigger_escape_owner", - "type": "function", - "inputs": [ - { - "name": "new_owner", - "type": "argent::signer::signer_signature::Signer" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "trigger_escape_guardian", - "type": "function", - "inputs": [ - { - "name": "new_guardian", - "type": "core::option::Option::" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "escape_owner", - "type": "function", - "inputs": [], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "escape_guardian", - "type": "function", - "inputs": [], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "cancel_escape", - "type": "function", - "inputs": [], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "get_owner", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "get_owner_guid", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "get_owner_type", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "argent::signer::signer_signature::SignerType" - } - ], - "state_mutability": "view" - }, - { - "name": "get_guardian", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "is_guardian", - "type": "function", - "inputs": [ - { - "name": "guardian", - "type": "argent::signer::signer_signature::Signer" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - }, - { - "name": "get_guardian_guid", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::option::Option::" - } - ], - "state_mutability": "view" - }, - { - "name": "get_guardian_type", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::option::Option::" - } - ], - "state_mutability": "view" - }, - { - "name": "get_guardian_backup", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "get_guardian_backup_guid", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::option::Option::" - } - ], - "state_mutability": "view" - }, - { - "name": "get_guardian_backup_type", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::option::Option::" - } - ], - "state_mutability": "view" - }, - { - "name": "get_escape", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "argent::recovery::interface::LegacyEscape" - } - ], - "state_mutability": "view" - }, - { - "name": "get_name", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "get_version", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "argent::account::interface::Version" - } - ], - "state_mutability": "view" - }, - { - "name": "get_last_owner_trigger_escape_attempt", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u64" - } - ], - "state_mutability": "view" - }, - { - "name": "get_last_guardian_trigger_escape_attempt", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u64" - } - ], - "state_mutability": "view" - }, - { - "name": "get_last_owner_escape_attempt", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u64" - } - ], - "state_mutability": "view" - }, - { - "name": "get_last_guardian_escape_attempt", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u64" - } - ], - "state_mutability": "view" - }, - { - "name": "get_escape_and_status", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "(argent::recovery::interface::LegacyEscape, argent::recovery::interface::EscapeStatus)" - } - ], - "state_mutability": "view" - }, - { - "name": "get_escape_security_period", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u64" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "DeprecatedArgentAccountImpl", - "type": "impl", - "interface_name": "argent::account::interface::IDeprecatedArgentAccount" - }, - { - "name": "argent::account::interface::IDeprecatedArgentAccount", - "type": "interface", - "items": [ - { - "name": "getVersion", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "getName", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "isValidSignature", - "type": "function", - "inputs": [ - { - "name": "hash", - "type": "core::felt252" - }, - { - "name": "signatures", - "type": "core::array::Array::" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "Sessionable", - "type": "impl", - "interface_name": "argent::session::interface::ISessionable" - }, - { - "name": "argent::session::interface::ISessionable", - "type": "interface", - "items": [ - { - "name": "revoke_session", - "type": "function", - "inputs": [ - { - "name": "session_hash", - "type": "core::felt252" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "is_session_revoked", - "type": "function", - "inputs": [ - { - "name": "session_hash", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - }, - { - "name": "is_session_authorization_cached", - "type": "function", - "inputs": [ - { - "name": "session_hash", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "ExecuteFromOutside", - "type": "impl", - "interface_name": "argent::outside_execution::interface::IOutsideExecution" - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "argent::outside_execution::interface::OutsideExecution", - "type": "struct", - "members": [ - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "nonce", - "type": "core::felt252" - }, - { - "name": "execute_after", - "type": "core::integer::u64" - }, - { - "name": "execute_before", - "type": "core::integer::u64" - }, - { - "name": "calls", - "type": "core::array::Span::" - } - ] - }, - { - "name": "argent::outside_execution::interface::IOutsideExecution", - "type": "interface", - "items": [ - { - "name": "execute_from_outside", - "type": "function", - "inputs": [ - { - "name": "outside_execution", - "type": "argent::outside_execution::interface::OutsideExecution" - }, - { - "name": "signature", - "type": "core::array::Array::" - } - ], - "outputs": [ - { - "type": "core::array::Array::>" - } - ], - "state_mutability": "external" - }, - { - "name": "execute_from_outside_v2", - "type": "function", - "inputs": [ - { - "name": "outside_execution", - "type": "argent::outside_execution::interface::OutsideExecution" - }, - { - "name": "signature", - "type": "core::array::Span::" - } - ], - "outputs": [ - { - "type": "core::array::Array::>" - } - ], - "state_mutability": "external" - }, - { - "name": "is_valid_outside_execution_nonce", - "type": "function", - "inputs": [ - { - "name": "nonce", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - }, - { - "name": "get_outside_execution_message_hash_rev_0", - "type": "function", - "inputs": [ - { - "name": "outside_execution", - "type": "argent::outside_execution::interface::OutsideExecution" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "get_outside_execution_message_hash_rev_1", - "type": "function", - "inputs": [ - { - "name": "outside_execution", - "type": "argent::outside_execution::interface::OutsideExecution" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "SRC5", - "type": "impl", - "interface_name": "argent::introspection::interface::ISRC5" - }, - { - "name": "argent::introspection::interface::ISRC5", - "type": "interface", - "items": [ - { - "name": "supports_interface", - "type": "function", - "inputs": [ - { - "name": "interface_id", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "SRC5Legacy", - "type": "impl", - "interface_name": "argent::introspection::interface::ISRC5Legacy" - }, - { - "name": "argent::introspection::interface::ISRC5Legacy", - "type": "interface", - "items": [ - { - "name": "supportsInterface", - "type": "function", - "inputs": [ - { - "name": "interfaceId", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "Upgradable", - "type": "impl", - "interface_name": "argent::upgrade::interface::IUpgradeable" - }, - { - "name": "argent::upgrade::interface::IUpgradeable", - "type": "interface", - "items": [ - { - "name": "upgrade", - "type": "function", - "inputs": [ - { - "name": "new_implementation", - "type": "core::starknet::class_hash::ClassHash" - }, - { - "name": "data", - "type": "core::array::Array::" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "name": "constructor", - "type": "constructor", - "inputs": [ - { - "name": "owner", - "type": "argent::signer::signer_signature::Signer" - }, - { - "name": "guardian", - "type": "core::option::Option::" - } - ] - }, - { - "kind": "enum", - "name": "argent::outside_execution::outside_execution::outside_execution_component::Event", - "type": "event", - "variants": [] - }, - { - "kind": "enum", - "name": "argent::introspection::src5::src5_component::Event", - "type": "event", - "variants": [] - }, - { - "kind": "struct", - "name": "argent::upgrade::upgrade::upgrade_component::AccountUpgraded", - "type": "event", - "members": [ - { - "kind": "data", - "name": "new_implementation", - "type": "core::starknet::class_hash::ClassHash" - } - ] - }, - { - "kind": "enum", - "name": "argent::upgrade::upgrade::upgrade_component::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "AccountUpgraded", - "type": "argent::upgrade::upgrade::upgrade_component::AccountUpgraded" - } - ] - }, - { - "kind": "struct", - "name": "argent::session::session::session_component::SessionRevoked", - "type": "event", - "members": [ - { - "kind": "data", - "name": "session_hash", - "type": "core::felt252" - } - ] - }, - { - "kind": "enum", - "name": "argent::session::session::session_component::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "SessionRevoked", - "type": "argent::session::session::session_component::SessionRevoked" - } - ] - }, - { - "kind": "enum", - "name": "openzeppelin::security::reentrancyguard::ReentrancyGuardComponent::Event", - "type": "event", - "variants": [] - }, - { - "name": "core::array::Span::>", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::>" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::TransactionExecuted", - "type": "event", - "members": [ - { - "kind": "key", - "name": "hash", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "response", - "type": "core::array::Span::>" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::AccountCreated", - "type": "event", - "members": [ - { - "kind": "key", - "name": "owner", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "guardian", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::AccountCreatedGuid", - "type": "event", - "members": [ - { - "kind": "key", - "name": "owner_guid", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "guardian_guid", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::EscapeOwnerTriggeredGuid", - "type": "event", - "members": [ - { - "kind": "data", - "name": "ready_at", - "type": "core::integer::u64" - }, - { - "kind": "data", - "name": "new_owner_guid", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::EscapeGuardianTriggeredGuid", - "type": "event", - "members": [ - { - "kind": "data", - "name": "ready_at", - "type": "core::integer::u64" - }, - { - "kind": "data", - "name": "new_guardian_guid", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::OwnerEscapedGuid", - "type": "event", - "members": [ - { - "kind": "data", - "name": "new_owner_guid", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::GuardianEscapedGuid", - "type": "event", - "members": [ - { - "kind": "data", - "name": "new_guardian_guid", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::EscapeCanceled", - "type": "event", - "members": [] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::OwnerChanged", - "type": "event", - "members": [ - { - "kind": "data", - "name": "new_owner", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::OwnerChangedGuid", - "type": "event", - "members": [ - { - "kind": "data", - "name": "new_owner_guid", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::GuardianChanged", - "type": "event", - "members": [ - { - "kind": "data", - "name": "new_guardian", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::GuardianChangedGuid", - "type": "event", - "members": [ - { - "kind": "data", - "name": "new_guardian_guid", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::GuardianBackupChanged", - "type": "event", - "members": [ - { - "kind": "data", - "name": "new_guardian_backup", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::GuardianBackupChangedGuid", - "type": "event", - "members": [ - { - "kind": "data", - "name": "new_guardian_backup_guid", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::SignerLinked", - "type": "event", - "members": [ - { - "kind": "key", - "name": "signer_guid", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "signer", - "type": "argent::signer::signer_signature::Signer" - } - ] - }, - { - "kind": "struct", - "name": "argent::presets::argent_account::ArgentAccount::EscapeSecurityPeriodChanged", - "type": "event", - "members": [ - { - "kind": "data", - "name": "escape_security_period", - "type": "core::integer::u64" - } - ] - }, - { - "kind": "enum", - "name": "argent::presets::argent_account::ArgentAccount::Event", - "type": "event", - "variants": [ - { - "kind": "flat", - "name": "ExecuteFromOutsideEvents", - "type": "argent::outside_execution::outside_execution::outside_execution_component::Event" - }, - { - "kind": "flat", - "name": "SRC5Events", - "type": "argent::introspection::src5::src5_component::Event" - }, - { - "kind": "flat", - "name": "UpgradeEvents", - "type": "argent::upgrade::upgrade::upgrade_component::Event" - }, - { - "kind": "flat", - "name": "SessionableEvents", - "type": "argent::session::session::session_component::Event" - }, - { - "kind": "flat", - "name": "ReentrancyGuardEvent", - "type": "openzeppelin::security::reentrancyguard::ReentrancyGuardComponent::Event" - }, - { - "kind": "nested", - "name": "TransactionExecuted", - "type": "argent::presets::argent_account::ArgentAccount::TransactionExecuted" - }, - { - "kind": "nested", - "name": "AccountCreated", - "type": "argent::presets::argent_account::ArgentAccount::AccountCreated" - }, - { - "kind": "nested", - "name": "AccountCreatedGuid", - "type": "argent::presets::argent_account::ArgentAccount::AccountCreatedGuid" - }, - { - "kind": "nested", - "name": "EscapeOwnerTriggeredGuid", - "type": "argent::presets::argent_account::ArgentAccount::EscapeOwnerTriggeredGuid" - }, - { - "kind": "nested", - "name": "EscapeGuardianTriggeredGuid", - "type": "argent::presets::argent_account::ArgentAccount::EscapeGuardianTriggeredGuid" - }, - { - "kind": "nested", - "name": "OwnerEscapedGuid", - "type": "argent::presets::argent_account::ArgentAccount::OwnerEscapedGuid" - }, - { - "kind": "nested", - "name": "GuardianEscapedGuid", - "type": "argent::presets::argent_account::ArgentAccount::GuardianEscapedGuid" - }, - { - "kind": "nested", - "name": "EscapeCanceled", - "type": "argent::presets::argent_account::ArgentAccount::EscapeCanceled" - }, - { - "kind": "nested", - "name": "OwnerChanged", - "type": "argent::presets::argent_account::ArgentAccount::OwnerChanged" - }, - { - "kind": "nested", - "name": "OwnerChangedGuid", - "type": "argent::presets::argent_account::ArgentAccount::OwnerChangedGuid" - }, - { - "kind": "nested", - "name": "GuardianChanged", - "type": "argent::presets::argent_account::ArgentAccount::GuardianChanged" - }, - { - "kind": "nested", - "name": "GuardianChangedGuid", - "type": "argent::presets::argent_account::ArgentAccount::GuardianChangedGuid" - }, - { - "kind": "nested", - "name": "GuardianBackupChanged", - "type": "argent::presets::argent_account::ArgentAccount::GuardianBackupChanged" - }, - { - "kind": "nested", - "name": "GuardianBackupChangedGuid", - "type": "argent::presets::argent_account::ArgentAccount::GuardianBackupChangedGuid" - }, - { - "kind": "nested", - "name": "SignerLinked", - "type": "argent::presets::argent_account::ArgentAccount::SignerLinked" - }, - { - "kind": "nested", - "name": "EscapeSecurityPeriodChanged", - "type": "argent::presets::argent_account::ArgentAccount::EscapeSecurityPeriodChanged" - } - ] - } - ] \ No newline at end of file + { + "name": "argent::account::interface::IArgentUserAccount", + "type": "interface", + "items": [ + { + "name": "get_owner", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + } +] \ No newline at end of file diff --git a/packages/starknet-node/src/abi/braavos.abi.json b/packages/starknet-node/src/abi/braavos.abi.json index d9b59ed..48ddfb0 100644 --- a/packages/starknet-node/src/abi/braavos.abi.json +++ b/packages/starknet-node/src/abi/braavos.abi.json @@ -1,1089 +1,17 @@ -[ +[ { + "name": "braavos_account::signers::interface::ISignerManagement", + "type": "interface", + "items": [ { - "name": "ExternalMethods", - "type": "impl", - "interface_name": "braavos_account::account::interface::IBraavosAccount" - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "core::starknet::account::Call", - "type": "struct", - "members": [ - { - "name": "to", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "selector", - "type": "core::felt252" - }, - { - "name": "calldata", - "type": "core::array::Span::" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "braavos_account::signers::signers::StarkPubKey", - "type": "struct", - "members": [ - { - "name": "pub_key", - "type": "core::felt252" - } - ] - }, - { - "name": "braavos_account::account::interface::RequiredSigner", - "type": "enum", - "variants": [ - { - "name": "NA", - "type": "()" - }, - { - "name": "Stark", - "type": "()" - }, - { - "name": "Strong", - "type": "()" - }, - { - "name": "Multisig", - "type": "()" - } - ] - }, - { - "name": "braavos_account::account::interface::IBraavosAccount", - "type": "interface", - "items": [ - { - "name": "__validate__", - "type": "function", - "inputs": [ - { - "name": "calls", - "type": "core::array::Span::" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "external" - }, - { - "name": "__execute__", - "type": "function", - "inputs": [ - { - "name": "calls", - "type": "core::array::Span::" - } - ], - "outputs": [ - { - "type": "core::array::Array::>" - } - ], - "state_mutability": "external" - }, - { - "name": "is_valid_signature", - "type": "function", - "inputs": [ - { - "name": "hash", - "type": "core::felt252" - }, - { - "name": "signature", - "type": "core::array::Span::" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "__validate_deploy__", - "type": "function", - "inputs": [ - { - "name": "class_hash", - "type": "core::felt252" - }, - { - "name": "salt", - "type": "core::felt252" - }, - { - "name": "stark_pub_key", - "type": "braavos_account::signers::signers::StarkPubKey" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "__validate_declare__", - "type": "function", - "inputs": [ - { - "name": "class_hash", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "initializer", - "type": "function", - "inputs": [ - { - "name": "stark_pub_key", - "type": "braavos_account::signers::signers::StarkPubKey" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "get_version", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "get_required_signer", - "type": "function", - "inputs": [ - { - "name": "calls", - "type": "core::array::Span::" - }, - { - "name": "fee_amount", - "type": "core::integer::u128" - }, - { - "name": "tx_version", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "braavos_account::account::interface::RequiredSigner" - } - ], - "state_mutability": "external" - } - ] - }, - { - "name": "DwlExternalImpl", - "type": "impl", - "interface_name": "braavos_account::dwl::interface::IDwlExternal" - }, - { - "name": "braavos_account::dwl::interface::IDwlExternal", - "type": "interface", - "items": [ - { - "name": "set_withdrawal_limit_low", - "type": "function", - "inputs": [ - { - "name": "withdrawal_limit_low", - "type": "core::integer::u128" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_withdrawal_limit_high", - "type": "function", - "inputs": [ - { - "name": "withdrawal_limit_high", - "type": "core::integer::u128" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "get_withdrawal_limit_low", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - }, - { - "name": "get_withdrawal_limit_high", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - }, - { - "name": "get_daily_spend", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - }, - { - "name": "get_fee_token_rate", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - }, - { - "name": "get_stark_fee_token_rate", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "RateConfigImpl", - "type": "impl", - "interface_name": "braavos_account::dwl::interface::IRateServiceExternal" - }, - { - "name": "core::bool", - "type": "enum", - "variants": [ - { - "name": "False", - "type": "()" - }, - { - "name": "True", - "type": "()" - } - ] - }, - { - "name": "braavos_account::dwl::interface::TokenConfig", - "type": "struct", - "members": [ - { - "name": "is_threshold_currency", - "type": "core::bool" - }, - { - "name": "token_address", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "pool_key", - "type": "core::felt252" - }, - { - "name": "is_threshold_currency_token0", - "type": "core::bool" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "braavos_account::dwl::interface::WhitelistCallConfig", - "type": "struct", - "members": [ - { - "name": "to", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "selector", - "type": "core::felt252" - }, - { - "name": "whitelist_call_type", - "type": "core::integer::u8" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "braavos_account::dwl::interface::IRateServiceExternal", - "type": "interface", - "items": [ - { - "name": "update_rate_config", - "type": "function", - "inputs": [ - { - "name": "white_listed_tokens", - "type": "core::array::Span::" - }, - { - "name": "white_listed_calls_list", - "type": "core::array::Span::" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "name": "SignerManagementImpl", - "type": "impl", - "interface_name": "braavos_account::signers::interface::ISignerManagement" - }, - { - "name": "braavos_account::signers::interface::GetSignersResponse", - "type": "struct", - "members": [ - { - "name": "stark", - "type": "core::array::Array::" - }, - { - "name": "secp256r1", - "type": "core::array::Array::" - }, - { - "name": "webauthn", - "type": "core::array::Array::" - } - ] - }, - { - "name": "core::integer::u256", - "type": "struct", - "members": [ - { - "name": "low", - "type": "core::integer::u128" - }, - { - "name": "high", - "type": "core::integer::u128" - } - ] - }, - { - "name": "braavos_account::signers::signers::Secp256r1PubKey", - "type": "struct", - "members": [ - { - "name": "pub_x", - "type": "core::integer::u256" - }, - { - "name": "pub_y", - "type": "core::integer::u256" - } - ] - }, - { - "name": "braavos_account::signers::signer_type::SignerType", - "type": "enum", - "variants": [ - { - "name": "Empty", - "type": "()" - }, - { - "name": "Stark", - "type": "()" - }, - { - "name": "Secp256r1", - "type": "()" - }, - { - "name": "Webauthn", - "type": "()" - } - ] - }, - { - "name": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest", - "type": "struct", - "members": [ - { - "name": "expire_at", - "type": "core::integer::u64" - } - ] - }, - { - "name": "braavos_account::signers::interface::ISignerManagement", - "type": "interface", - "items": [ - { - "name": "get_public_key", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "get_signers", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "braavos_account::signers::interface::GetSignersResponse" - } - ], - "state_mutability": "view" - }, - { - "name": "add_secp256r1_signer", - "type": "function", - "inputs": [ - { - "name": "secp256r1_signer", - "type": "braavos_account::signers::signers::Secp256r1PubKey" - }, - { - "name": "signer_type", - "type": "braavos_account::signers::signer_type::SignerType" - }, - { - "name": "multisig_threshold", - "type": "core::integer::u32" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "remove_secp256r1_signer", - "type": "function", - "inputs": [ - { - "name": "guid", - "type": "core::felt252" - }, - { - "name": "signer_type", - "type": "braavos_account::signers::signer_type::SignerType" - }, - { - "name": "multisig_threshold", - "type": "core::integer::u32" - } - ], - "outputs": [], - "state_mutability": "external" - }, + "name": "get_public_key", + "type": "function", + "inputs": [], + "outputs": [ { - "name": "change_secp256r1_signer", - "type": "function", - "inputs": [ - { - "name": "secp256r1_signer", - "type": "braavos_account::signers::signers::Secp256r1PubKey" - }, - { - "name": "existing_guid", - "type": "core::felt252" - }, - { - "name": "signer_type", - "type": "braavos_account::signers::signer_type::SignerType" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "deferred_remove_signers", - "type": "function", - "inputs": [], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "cancel_deferred_remove_signers", - "type": "function", - "inputs": [], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "get_deferred_remove_signers", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest" - } - ], - "state_mutability": "view" - }, - { - "name": "set_execution_time_delay", - "type": "function", - "inputs": [ - { - "name": "time_delay", - "type": "core::integer::u64" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "get_execution_time_delay", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u64" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "MultisigImpl", - "type": "impl", - "interface_name": "braavos_account::signers::interface::IMultisig" - }, - { - "name": "braavos_account::signers::interface::IMultisig", - "type": "interface", - "items": [ - { - "name": "set_multisig_threshold", - "type": "function", - "inputs": [ - { - "name": "multisig_threshold", - "type": "core::integer::u32" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "get_multisig_threshold", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "UpgradableImpl", - "type": "impl", - "interface_name": "braavos_account::upgradable::interface::IUpgradable" - }, - { - "name": "braavos_account::upgradable::interface::IUpgradable", - "type": "interface", - "items": [ - { - "name": "upgrade", - "type": "function", - "inputs": [ - { - "name": "upgrade_to", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "name": "StorageMigrationImpl", - "type": "impl", - "interface_name": "braavos_account::upgradable::interface::IStorageMigration" - }, - { - "name": "braavos_account::upgradable::interface::IStorageMigration", - "type": "interface", - "items": [ - { - "name": "migrate_storage", - "type": "function", - "inputs": [ - { - "name": "from_version", - "type": "core::felt252" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "name": "SRC5Impl", - "type": "impl", - "interface_name": "braavos_account::introspection::interface::ISRC5WithCamelCase" - }, - { - "name": "braavos_account::introspection::interface::ISRC5WithCamelCase", - "type": "interface", - "items": [ - { - "name": "supports_interface", - "type": "function", - "inputs": [ - { - "name": "interface_id", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - }, - { - "name": "supportsInterface", - "type": "function", - "inputs": [ - { - "name": "interfaceId", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "OutsideExecImpl", - "type": "impl", - "interface_name": "braavos_account::outside_execution::interface::IOutsideExecution_V2" - }, - { - "name": "braavos_account::outside_execution::interface::OutsideExecution", - "type": "struct", - "members": [ - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "nonce", - "type": "core::felt252" - }, - { - "name": "execute_after", - "type": "core::integer::u64" - }, - { - "name": "execute_before", - "type": "core::integer::u64" - }, - { - "name": "calls", - "type": "core::array::Span::" - } - ] - }, - { - "name": "braavos_account::outside_execution::interface::IOutsideExecution_V2", - "type": "interface", - "items": [ - { - "name": "execute_from_outside_v2", - "type": "function", - "inputs": [ - { - "name": "outside_execution", - "type": "braavos_account::outside_execution::interface::OutsideExecution" - }, - { - "name": "signature", - "type": "core::array::Span::" - } - ], - "outputs": [ - { - "type": "core::array::Array::>" - } - ], - "state_mutability": "external" - }, - { - "name": "is_valid_outside_execution_nonce", - "type": "function", - "inputs": [ - { - "name": "nonce", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - } - ] - }, - { - "name": "constructor", - "type": "constructor", - "inputs": [] - }, - { - "kind": "struct", - "name": "braavos_account::signers::signer_management::SignerManagementComponent::OwnerAdded", - "type": "event", - "members": [ - { - "kind": "key", - "name": "new_owner_guid", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "signer_type", - "type": "braavos_account::signers::signer_type::SignerType" - }, - { - "kind": "data", - "name": "signer_data", - "type": "core::array::Span::" - } - ] - }, - { - "kind": "struct", - "name": "braavos_account::signers::signer_management::SignerManagementComponent::OwnerRemoved", - "type": "event", - "members": [ - { - "kind": "key", - "name": "removed_owner_guid", "type": "core::felt252" - }, - { - "kind": "data", - "name": "removed_signer_type", - "type": "braavos_account::signers::signer_type::SignerType" - } - ] - }, - { - "kind": "struct", - "name": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest", - "type": "event", - "members": [ - { - "kind": "data", - "name": "expire_at", - "type": "core::integer::u64" - } - ] - }, - { - "kind": "struct", - "name": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequestCancelled", - "type": "event", - "members": [ - { - "kind": "data", - "name": "cancelled_deferred_request", - "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest" - } - ] - }, - { - "kind": "struct", - "name": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequestExpired", - "type": "event", - "members": [ - { - "kind": "data", - "name": "expired_deferred_request", - "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest" - } - ] - }, - { - "kind": "enum", - "name": "braavos_account::signers::signer_management::SignerManagementComponent::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "OwnerAdded", - "type": "braavos_account::signers::signer_management::SignerManagementComponent::OwnerAdded" - }, - { - "kind": "nested", - "name": "OwnerRemoved", - "type": "braavos_account::signers::signer_management::SignerManagementComponent::OwnerRemoved" - }, - { - "kind": "nested", - "name": "DeferredRemoveSignerRequest", - "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequest" - }, - { - "kind": "nested", - "name": "DeferredRemoveSignerRequestCancelled", - "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequestCancelled" - }, - { - "kind": "nested", - "name": "DeferredRemoveSignerRequestExpired", - "type": "braavos_account::signers::signer_management::SignerManagementComponent::DeferredRemoveSignerRequestExpired" - } - ] - }, - { - "kind": "struct", - "name": "braavos_account::signers::multisig::MultisigComponent::MultisigSet", - "type": "event", - "members": [ - { - "kind": "data", - "name": "multisig_threshold", - "type": "core::integer::u32" - } - ] - }, - { - "kind": "enum", - "name": "braavos_account::signers::multisig::MultisigComponent::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "MultisigSet", - "type": "braavos_account::signers::multisig::MultisigComponent::MultisigSet" - } - ] - }, - { - "kind": "struct", - "name": "braavos_account::upgradable::upgradable::UpgradableComponent::Upgraded", - "type": "event", - "members": [ - { - "kind": "key", - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ] - }, - { - "kind": "enum", - "name": "braavos_account::upgradable::upgradable::UpgradableComponent::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "Upgraded", - "type": "braavos_account::upgradable::upgradable::UpgradableComponent::Upgraded" - } - ] - }, - { - "kind": "enum", - "name": "braavos_account::introspection::src5::SRC5Component::Event", - "type": "event", - "variants": [] - }, - { - "kind": "struct", - "name": "braavos_account::dwl::dwl::DwlComponent::WithdrawalLimitLowSet", - "type": "event", - "members": [ - { - "kind": "data", - "name": "withdrawal_limit_low", - "type": "core::integer::u128" - } - ] - }, - { - "kind": "struct", - "name": "braavos_account::dwl::dwl::DwlComponent::WithdrawalLimitHighSet", - "type": "event", - "members": [ - { - "kind": "data", - "name": "withdrawal_limit_high", - "type": "core::integer::u128" - } - ] - }, - { - "kind": "enum", - "name": "braavos_account::dwl::dwl::DwlComponent::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "WithdrawalLimitLowSet", - "type": "braavos_account::dwl::dwl::DwlComponent::WithdrawalLimitLowSet" - }, - { - "kind": "nested", - "name": "WithdrawalLimitHighSet", - "type": "braavos_account::dwl::dwl::DwlComponent::WithdrawalLimitHighSet" - } - ] - }, - { - "kind": "enum", - "name": "braavos_account::dwl::rate_service::RateComponent::Event", - "type": "event", - "variants": [] - }, - { - "kind": "enum", - "name": "braavos_account::outside_execution::outside_execution::OutsideExecComponent::Event", - "type": "event", - "variants": [] - }, - { - "kind": "enum", - "name": "braavos_account::presets::braavos_account::BraavosAccount::Event", - "type": "event", - "variants": [ - { - "kind": "flat", - "name": "SignerMgtEvt", - "type": "braavos_account::signers::signer_management::SignerManagementComponent::Event" - }, - { - "kind": "flat", - "name": "MultisigEvt", - "type": "braavos_account::signers::multisig::MultisigComponent::Event" - }, - { - "kind": "flat", - "name": "UpgradableEvt", - "type": "braavos_account::upgradable::upgradable::UpgradableComponent::Event" - }, - { - "kind": "flat", - "name": "Src5Evt", - "type": "braavos_account::introspection::src5::SRC5Component::Event" - }, - { - "kind": "flat", - "name": "DwlEvent", - "type": "braavos_account::dwl::dwl::DwlComponent::Event" - }, - { - "kind": "flat", - "name": "RateEvent", - "type": "braavos_account::dwl::rate_service::RateComponent::Event" - }, - { - "kind": "flat", - "name": "OutsideExecEvt", - "type": "braavos_account::outside_execution::outside_execution::OutsideExecComponent::Event" } - ] + ], + "state_mutability": "view" } - ] \ No newline at end of file + ] +}] \ No newline at end of file diff --git a/packages/starknet-node/src/supportedWallets/walletConfig.ts b/packages/starknet-node/src/supportedWallets/walletConfig.ts index edcca95..4aa77d9 100644 --- a/packages/starknet-node/src/supportedWallets/walletConfig.ts +++ b/packages/starknet-node/src/supportedWallets/walletConfig.ts @@ -1,16 +1,19 @@ -import argentAbi from "../abi/argent.abi.json"; -import braavosAbi from "../abi/braavos.abi.json"; +import argentAbi from '../abi/argent.abi.json'; +import braavosAbi from '../abi/braavos.abi.json'; export const walletConfigs = [ - { - name: 'Argent', - abi: argentAbi, - selector: 'get_owner', - }, - { - name: 'Braavos', - abi: braavosAbi, - selector: 'get_public_key', - }, - ]; - \ No newline at end of file + { + id: 1, + name: 'Argent', + abi: argentAbi, + selector: 'get_owner', + version: '1.0.0', + }, + { + id: 2, + name: 'Braavos', + abi: braavosAbi, + selector: 'get_public_key', + version: '1.0.0', + }, +]; diff --git a/packages/starknet-node/src/token.ts b/packages/starknet-node/src/token.ts index 249573f..b57724e 100644 --- a/packages/starknet-node/src/token.ts +++ b/packages/starknet-node/src/token.ts @@ -40,6 +40,10 @@ export default class BaseSTRK20Token extends BaseNodeToken { } } +// Set the base token for gas payments based on the token address provided in the setup. +// Starknet supports two tokens for gas payments: ETH and STRK, both implemented as ERC20 tokens. +// Since these tokens have the same contract address on both mainnet and testnet, +// we use the provided address directly to determine the base token for gas. async getContract(): Promise { if (!this.contractInstance) { this.contractInstance = new Contract( From ca7a84e1fe1f9c3c319b003275edbcd3f0eadf80 Mon Sep 17 00:00:00 2001 From: Adegbite Ademola Kelvin Date: Mon, 2 Dec 2024 10:23:48 +0100 Subject: [PATCH 8/9] chore: remove unused files and correct error handling --- examples/node/scripts/tokens/starknet.ts | 37 ----- packages/aptos-web/src/token.ts | 153 ++++++++++++------ .../src/supportedWallets/walletConfig.ts | 2 +- packages/starknet-node/src/token.ts | 123 +++++++------- 4 files changed, 175 insertions(+), 140 deletions(-) delete mode 100644 examples/node/scripts/tokens/starknet.ts diff --git a/examples/node/scripts/tokens/starknet.ts b/examples/node/scripts/tokens/starknet.ts deleted file mode 100644 index 63acb9b..0000000 --- a/examples/node/scripts/tokens/starknet.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Uploader } from "@irys/upload"; -import { Starknet, StarknetEth, StarknetToken } from "@irys/upload-starknet-node"; -import "dotenv/config"; - -/** - * Tests if data can be uploaded to Irys using USDCPolygon. - * - * @returns {Promise} Returns true if upload is successful, otherwise false. - */ -export const canUploadStarknet = async (): Promise => {3 - try { - // Initialize the Irys Uploader with the Ethereum wallet - const irysUploader = await Uploader(Starknet).withWallet("0x005d5c250b5c181684ae6d8ebfa0faeac3ad0c6f31a6c2f102a2fffddba00a05"); - - // Attempt to upload data to Irys - //@ts-ignore - const receipt = await irysUploader.upload("hirys", { - tags: [{ name: "Content-Type", value: "text/plain" }], - }); - - console.log('reciept:', receipt) - - // If an exception is not thrown, the upload was successful - // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); - return true; - } catch (error) { - console.error("Error during upload:", error); - return false; - } -}; -const privateKey = "0x005d5c250b5c181684ae6d8ebfa0faeac3ad0c6f31a6c2f102a2fffddba00a05"; -const address = "0x02F659cf8CCE41168B8c0A8BedCE468E33BE1B7bd26E920266C025Dc0F8FBD1b" - -const TokenConfigTrimmed = { - privateKey, - address, -} diff --git a/packages/aptos-web/src/token.ts b/packages/aptos-web/src/token.ts index cf71e8e..f37d5c5 100644 --- a/packages/aptos-web/src/token.ts +++ b/packages/aptos-web/src/token.ts @@ -1,4 +1,8 @@ -import type { Network, PendingTransactionResponse, UserTransactionResponse } from "@aptos-labs/ts-sdk"; +import type { + Network, + PendingTransactionResponse, + UserTransactionResponse, +} from '@aptos-labs/ts-sdk'; import { Aptos, AptosConfig as AptosSDKConfig, @@ -11,13 +15,13 @@ import { SignedTransaction, generateSignedTransaction, generateSigningMessageForTransaction, -} from "@aptos-labs/ts-sdk"; -import type { Signer } from "@irys/bundles"; -import { InjectedAptosSigner, AptosSigner } from "@irys/bundles/web"; -import BigNumber from "bignumber.js"; -import type { TokenConfig, Tx } from "@irys/upload-core"; -import sha3 from "js-sha3"; -import BaseWebToken from "@irys/web-upload/tokens/base"; +} from '@aptos-labs/ts-sdk'; +import type { Signer } from '@irys/bundles'; +import { InjectedAptosSigner, AptosSigner } from '@irys/bundles/web'; +import BigNumber from 'bignumber.js'; +import type { TokenConfig, Tx } from '@irys/upload-core'; +import sha3 from 'js-sha3'; +import BaseWebToken from '@irys/web-upload/tokens/base'; export type SignMessagePayload = { address?: boolean; // Should we include the address of the account in the message @@ -67,7 +71,7 @@ export default class AptosConfig extends BaseWebToken { super(config); this.signingFn = config?.opts?.signingFunction; - this.base = ["octa", 1e8]; + this.base = ['octa', 1e8]; } async getProvider(): Promise { @@ -76,23 +80,25 @@ export default class AptosConfig extends BaseWebToken { async getTx(txId: string): Promise { const client = await this.getProvider(); - const tx = (await client.waitForTransaction({ transactionHash: txId })) as any; + const tx = (await client.waitForTransaction({ + transactionHash: txId, + })) as any; const payload = tx?.payload as any; if (!tx.success) { - throw new Error(tx?.vm_status ?? "Unknown Aptos error"); + throw new Error(tx?.vm_status ?? 'Unknown Aptos error'); } if ( !( - payload?.function === "0x1::coin::transfer" && - payload?.type_arguments[0] === "0x1::aptos_coin::AptosCoin" && - tx?.vm_status === "Executed successfully" + payload?.function === '0x1::coin::transfer' && + payload?.type_arguments[0] === '0x1::aptos_coin::AptosCoin' && + tx?.vm_status === 'Executed successfully' ) ) { throw new Error(`Aptos tx ${txId} failed validation`); } - const isPending = tx.type === "pending_transaction"; + const isPending = tx.type === 'pending_transaction'; return { to: payload.arguments[0], from: tx.sender, @@ -102,11 +108,11 @@ export default class AptosConfig extends BaseWebToken { }; } - async ownerToAddress(owner: any): Promise { + async ownerToAddress(owner: any): Promise { const hash = sha3.sha3_256.create(); hash.update(Buffer.from(owner)); - hash.update("\x00"); - return await `0x${hash.hex()}`; + hash.update('\x00'); + return `0x${hash.hex()}`; } async sign(data: Uint8Array): Promise { @@ -116,59 +122,97 @@ export default class AptosConfig extends BaseWebToken { getSigner(): Signer { if (this.signerInstance) return this.signerInstance; if (this.signingFn) { - const signer = new AptosSigner("", "0x" + this._publicKey.toString("hex")); + const signer = new AptosSigner( + '', + '0x' + this._publicKey.toString('hex') + ); signer.sign = this.signingFn; // override signer fn return (this.signerInstance = signer); } - return (this.signerInstance = new InjectedAptosSigner(this.wallet, this._publicKey)); + return (this.signerInstance = new InjectedAptosSigner( + this.wallet, + this._publicKey + )); } - async verify(pub: any, data: Uint8Array, signature: Uint8Array): Promise { + async verify( + pub: any, + data: Uint8Array, + signature: Uint8Array + ): Promise { return await InjectedAptosSigner.verify(pub, data, signature); } async getCurrentHeight(): Promise { - return new BigNumber(((await (await this.getProvider()).getLedgerInfo()) as { block_height: string }).block_height); + return new BigNumber( + ( + (await (await this.getProvider()).getLedgerInfo()) as { + block_height: string; + } + ).block_height + ); } - async getFee(amount: BigNumber.Value, to?: string): Promise<{ gasUnitPrice: number; maxGasAmount: number }> { + async getFee( + amount: BigNumber.Value, + to?: string + ): Promise<{ gasUnitPrice: number; maxGasAmount: number }> { const client = await this.getProvider(); - if (!this.address) throw new Error("Address is undefined - you might be missing a wallet, or have not run Irys.ready()"); + if (!this.address) + throw new Error( + 'Address is undefined - you might be missing a wallet, or have not run Irys.ready()' + ); const transaction = await client.transaction.build.simple({ sender: this.address, data: { - function: "0x1::coin::transfer", - typeArguments: ["0x1::aptos_coin::AptosCoin"], - functionArguments: [to ?? "0x149f7dc9c8e43c14ab46d3a6b62cfe84d67668f764277411f98732bf6718acf9", new BigNumber(amount).toNumber()], + function: '0x1::coin::transfer', + typeArguments: ['0x1::aptos_coin::AptosCoin'], + functionArguments: [ + to ?? + '0x149f7dc9c8e43c14ab46d3a6b62cfe84d67668f764277411f98732bf6718acf9', + new BigNumber(amount).toNumber(), + ], }, }); const accountAuthenticator = new AccountAuthenticatorEd25519( new Ed25519PublicKey(await this.getPublicKey()), - new Ed25519Signature(new Uint8Array(64)), + new Ed25519Signature(new Uint8Array(64)) ); - const transactionAuthenticator = new TransactionAuthenticatorEd25519(accountAuthenticator.public_key, accountAuthenticator.signature); + const transactionAuthenticator = new TransactionAuthenticatorEd25519( + accountAuthenticator.public_key, + accountAuthenticator.signature + ); - const signedSimulation = new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes(); + const signedSimulation = new SignedTransaction( + transaction.rawTransaction, + transactionAuthenticator + ).bcsToBytes(); const queryParams = { estimate_gas_unit_price: true, estimate_max_gas_amount: true, }; - const { data } = await postAptosFullNode({ + const { data } = await postAptosFullNode< + Uint8Array, + UserTransactionResponse[] + >({ aptosConfig: this.aptosConfig, body: signedSimulation, - path: "transactions/simulate", + path: 'transactions/simulate', params: queryParams, - originMethod: "simulateTransaction", + originMethod: 'simulateTransaction', contentType: MimeType.BCS_SIGNED_TRANSACTION, }); - return { gasUnitPrice: +data[0].gas_unit_price, maxGasAmount: +data[0].max_gas_amount }; + return { + gasUnitPrice: +data[0].gas_unit_price, + maxGasAmount: +data[0].max_gas_amount, + }; // const simulationResult = await client.simulateTransaction(this.accountInstance, rawTransaction, { estimateGasUnitPrice: true, estimateMaxGasAmount: true }); // return new BigNumber(simulationResult?.[0].gas_unit_price).multipliedBy(simulationResult?.[0].gas_used); @@ -177,15 +221,19 @@ export default class AptosConfig extends BaseWebToken { } async sendTx(data: any): Promise { - if (!this.signingFn) return (await this.wallet.signAndSubmitTransaction(data)).hash; + if (!this.signingFn) + return (await this.wallet.signAndSubmitTransaction(data)).hash; // return (await (await (this.getProvider())).submitSignedBCSTransaction(data)).hash; const provider = await this.getProvider(); - const { data: postData } = await postAptosFullNode({ + const { data: postData } = await postAptosFullNode< + Uint8Array, + PendingTransactionResponse + >({ aptosConfig: this.aptosConfig, body: data, - path: "transactions", - originMethod: "submitTransaction", + path: 'transactions', + originMethod: 'submitTransaction', contentType: MimeType.BCS_SIGNED_TRANSACTION, }); @@ -196,13 +244,13 @@ export default class AptosConfig extends BaseWebToken { async createTx( amount: BigNumber.Value, to: string, - fee?: { gasUnitPrice: number; maxGasAmount: number }, + fee?: { gasUnitPrice: number; maxGasAmount: number } ): Promise<{ txId: string | undefined; tx: any }> { const txData = { sender: this.address!, data: { - function: "0x1::coin::transfer", - typeArguments: ["0x1::aptos_coin::AptosCoin"], + function: '0x1::coin::transfer', + typeArguments: ['0x1::aptos_coin::AptosCoin'], functionArguments: [to, new BigNumber(amount).toNumber()], }, options: { @@ -224,10 +272,13 @@ export default class AptosConfig extends BaseWebToken { const senderAuthenticator = new AccountAuthenticatorEd25519( new Ed25519PublicKey(await this.getPublicKey()), - new Ed25519Signature(signerSignature), + new Ed25519Signature(signerSignature) ); - const signedTransaction = generateSignedTransaction({ transaction, senderAuthenticator }); + const signedTransaction = generateSignedTransaction({ + transaction, + senderAuthenticator, + }); return { txId: undefined, tx: signedTransaction }; // const rawTransaction = await client.generateRawTransaction(this.accountInstance.address(), payload); // const bcsTxn = AptosClient.generateBCSTransaction(this.accountInstance, rawTransaction); @@ -239,26 +290,32 @@ export default class AptosConfig extends BaseWebToken { async getPublicKey(): Promise { return (this._publicKey ??= this.signingFn - ? (Buffer.from((this.wallet as unknown as string).slice(2), "hex") as unknown as Buffer) - : Buffer.from(this.wallet.account.publicKey.toString().slice(2), "hex")); + ? (Buffer.from( + (this.wallet as unknown as string).slice(2), + 'hex' + ) as unknown as Buffer) + : Buffer.from(this.wallet.account.publicKey.toString().slice(2), 'hex')); } public async ready(): Promise { // In the Aptos context, this.providerUrl is the Aptos Network enum type we want // to work with. read more https://github.com/aptos-labs/aptos-ts-sdk/blob/main/src/api/aptosConfig.ts#L14 // this.providerUrl is a Network enum type represents the current configured network - this.aptosConfig = new AptosSDKConfig({ network: this.providerUrl, ...this.config?.opts?.aptosSdkConfig }); + this.aptosConfig = new AptosSDKConfig({ + network: this.providerUrl, + ...this.config?.opts?.aptosSdkConfig, + }); this._publicKey = (await this.getPublicKey()) as Buffer; this._address = await this.ownerToAddress(this._publicKey); const client = await this.getProvider(); this._address = await client - .lookupOriginalAccountAddress({ authenticationKey: this.address ?? "" }) + .lookupOriginalAccountAddress({ authenticationKey: this.address ?? '' }) .then((hs) => hs.toString()) .catch((_) => this._address); // fallback to original - if (this._address?.length == 66 && this._address.charAt(2) === "0") { + if (this._address?.length == 66 && this._address.charAt(2) === '0') { this._address = this._address.slice(0, 2) + this._address.slice(3); } } diff --git a/packages/starknet-node/src/supportedWallets/walletConfig.ts b/packages/starknet-node/src/supportedWallets/walletConfig.ts index 4aa77d9..e98b1f5 100644 --- a/packages/starknet-node/src/supportedWallets/walletConfig.ts +++ b/packages/starknet-node/src/supportedWallets/walletConfig.ts @@ -1,7 +1,7 @@ import argentAbi from '../abi/argent.abi.json'; import braavosAbi from '../abi/braavos.abi.json'; -export const walletConfigs = [ +export const ID = [ { id: 1, name: 'Argent', diff --git a/packages/starknet-node/src/token.ts b/packages/starknet-node/src/token.ts index b57724e..7c624ac 100644 --- a/packages/starknet-node/src/token.ts +++ b/packages/starknet-node/src/token.ts @@ -1,11 +1,11 @@ -import type {TokenConfig, Tx} from "@irys/upload-core"; -import {BaseNodeToken} from "@irys/upload/tokens/base" +import type { TokenConfig, Tx } from '@irys/upload-core'; +import { BaseNodeToken } from '@irys/upload/tokens/base'; import { Contract, RpcProvider, Provider, Result } from 'starknet'; import { StarknetSigner, Signer } from '@irys/bundles'; import BigNumber from 'bignumber.js'; import { num, Account, uint256 } from 'starknet'; -import strkerc20token from "../src/abi/erc20.abi.json" -import { walletConfigs } from './supportedWallets/walletConfig'; +import strkerc20token from '../src/abi/erc20.abi.json'; +import { ID } from './supportedWallets/walletConfig'; const starknetSigner = StarknetSigner; export interface STRKTokenConfig extends TokenConfig { @@ -27,23 +27,33 @@ export default class BaseSTRK20Token extends BaseNodeToken { this.privateKey = config.privateKey; this._address = config.address; this.providerInstance = new RpcProvider({ nodeUrl: this.providerUrl }); - this.account = new Account(this.providerInstance,this._address, this.privateKey); - this.signer = new StarknetSigner(this.providerInstance,this._address,this.privateKey); + this.account = new Account( + this.providerInstance, + this._address, + this.privateKey + ); + this.signer = new StarknetSigner( + this.providerInstance, + this._address, + this.privateKey + ); } - async init(): Promise { + async ready(): Promise { try { - await this.signer.init(); + await this.signer.init(); } catch (error) { - console.error('Failed to initialize signer:', error); throw error; } } -// Set the base token for gas payments based on the token address provided in the setup. -// Starknet supports two tokens for gas payments: ETH and STRK, both implemented as ERC20 tokens. -// Since these tokens have the same contract address on both mainnet and testnet, -// we use the provided address directly to determine the base token for gas. + // Set the base token for gas payments based on the token address provided in the setup. + // Starknet supports two tokens for gas payments: ETH and STRK, both implemented as ERC20 tokens. + // Since these tokens have the same contract address on both mainnet and testnet, + // we use the provided address directly to determine the base token for gas. + // @notice: STRK AND ETH TOKEN HAVE THE SAME ADDRESS ON MAINNET AND TESTNET + // STARK TOKEN ON MAINNET : https://starkscan.co/token/0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d + // ETH TOKEN ON MAINNET: https://sepolia.starkscan.co/token/0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 async getContract(): Promise { if (!this.contractInstance) { this.contractInstance = new Contract( @@ -74,16 +84,17 @@ export default class BaseSTRK20Token extends BaseNodeToken { try { const receipt = await this.providerInstance.getTransactionReceipt(txId); const traces = await this.providerInstance.getTransactionTrace(txId); - + if (!receipt || !traces) { - throw new Error("Transaction does not exist or is still pending."); + throw new Error('Transaction does not exist or is still pending.'); } - + const receiptResponse = (receipt as unknown as Transaction).value; - const tracesResponse = (traces as FeeTransferInvocation).fee_transfer_invocation; - + const tracesResponse = (traces as FeeTransferInvocation) + .fee_transfer_invocation; + const amount = receiptResponse?.actual_fee.amount; - + return { from: tracesResponse?.caller_address as string, to: tracesResponse?.contract_address as string, @@ -93,61 +104,70 @@ export default class BaseSTRK20Token extends BaseNodeToken { confirmed: !!(receiptResponse?.finality_status === 'ACCEPTED_ON_L1'), }; } catch (error) { - console.error(`Error fetching transaction details: ${error}`); - throw error; + throw error; } } - - async ownerToAddress(_owner: any): Promise { + async ownerToAddress(owner: any): Promise { // Public key and address lengths const publicKeyLength = 33; const addressLength = 32; - + // Get the returned public key and convert to a buffer const returnedPubKey = await this.getAccountPublicKey(); const returnedPubKeyBuffer = Buffer.from(returnedPubKey.toString()); - + // Get the injected public key from the signer const InjectedPublicKey = this.signer.publicKey; - + // Extracting the public key and address from the InjectedPublicKey - const extractedPublicKeyBuffer = InjectedPublicKey.subarray(0, publicKeyLength); - const extractedAddressBuffer = InjectedPublicKey.subarray(publicKeyLength, publicKeyLength + addressLength); - + const extractedPublicKeyBuffer = InjectedPublicKey.subarray( + 0, + publicKeyLength + ); + const extractedAddressBuffer = InjectedPublicKey.subarray( + publicKeyLength, + publicKeyLength + addressLength + ); + // Convert extracted buffers to hex const extractedAddressHex = extractedAddressBuffer.toString('hex'); - + // Check if the returned public key matches the extracted public key if (returnedPubKeyBuffer.equals(extractedPublicKeyBuffer)) { - return extractedAddressHex; + return extractedAddressHex; } else { - return ""; + throw Error( + 'Returned public key buffer is not equal extracted public key buffer' + ); } } - - async getAccountPublicKey(): Promise { if (!this._address) { throw new Error('Address is not defined'); } - - for (const config of walletConfigs) { + + for (const config of ID) { try { - const contractInstance = new Contract(config.abi, this._address, this.providerInstance); + const contractInstance = new Contract( + config.abi, + this._address, + this.providerInstance + ); const publicKey = await contractInstance.call(config.selector); if (publicKey) { return publicKey; } } catch (error) { - console.log(`${config.name} method failed.`); + throw error; } } - - throw new Error(`Unable to retrieve the public key for address ${this._address}`); + + throw new Error( + `Unable to retrieve the public key for address ${this._address}` + ); } - async sign(data: Uint8Array): Promise { return this.signer.sign(data); @@ -174,22 +194,20 @@ export default class BaseSTRK20Token extends BaseNodeToken { try { const amountBigNumber = new BigNumber(amount); const _amount = uint256.bnToUint256(amountBigNumber.toString()); - + const suggestedMaxFee = await this.account.estimateInvokeFee({ contractAddress: this.contractAddress, entrypoint: 'transfer', calldata: [to || '', _amount.high, _amount.low], }); - + const result = suggestedMaxFee.suggestedMaxFee; const result_to_hex = num.toHex(result); return new BigNumber(result_to_hex); } catch (error) { - console.error('Error estimating fee:', error); - throw new Error('Failed to estimate fee. Please try again.'); + throw error } } - async createTx( amount: BigNumber.Value, @@ -199,14 +217,14 @@ export default class BaseSTRK20Token extends BaseNodeToken { try { const amountBigNumber = new BigNumber(amount); const _amount = uint256.bnToUint256(amountBigNumber.toString()); - + const calldata = [to, _amount.low, _amount.high]; const maxFeeEstimate = await this.account.estimateFee({ contractAddress: this.contractAddress, entrypoint: 'transfer', calldata, }); - + const { transaction_hash: txId } = await this.account.execute( { contractAddress: this.contractAddress, @@ -215,14 +233,13 @@ export default class BaseSTRK20Token extends BaseNodeToken { }, { maxFee: maxFeeEstimate.suggestedMaxFee } ); - + return { txId, tx: txId }; } catch (error) { - console.error('Transaction creation failed:', error); - throw new Error('Transaction failed. Please try again.'); + throw error; } } - + async sendTx(data: any): Promise { if (!this._address) { throw new Error('Address is not defined'); @@ -234,7 +251,6 @@ export default class BaseSTRK20Token extends BaseNodeToken { await this.providerInstance.waitForTransaction(response.transaction_hash); return response.transaction_hash; } catch (error) { - console.error(`Error occurred while sending transaction - ${error}`); throw error; } } @@ -265,4 +281,3 @@ interface Transaction { finality_status: 'ACCEPTED_ON_L1' | 'REJECTED'; }; } - From 66cdf4f1211481545e90c4c01647451c04399639 Mon Sep 17 00:00:00 2001 From: Adegbite Ademola Kelvin Date: Fri, 6 Dec 2024 01:07:29 +0100 Subject: [PATCH 9/9] chore: remove test import files --- examples/node/scripts/test-upload.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/node/scripts/test-upload.ts b/examples/node/scripts/test-upload.ts index 2ce9b54..784cd27 100644 --- a/examples/node/scripts/test-upload.ts +++ b/examples/node/scripts/test-upload.ts @@ -14,8 +14,6 @@ import { canUploadUsdcEth } from "./tokens/usdcEth"; import { canUploadUsdcPolygon } from "./tokens/usdcPolygon"; import { canUploadChainlink } from "./tokens/chainlink"; import { canUploadSolana } from "./tokens/solana"; -import {canUploadStarknet} from "./tokens/starknet" - const runTests = async () => { // Aptos