diff --git a/.changeset/khaki-seas-scream.md b/.changeset/khaki-seas-scream.md new file mode 100644 index 00000000..ca93ec3c --- /dev/null +++ b/.changeset/khaki-seas-scream.md @@ -0,0 +1,6 @@ +--- +"@fuels/connectors": minor +"@fuel-connectors/burner-wallet-connector": patch +--- + +burner wallet connector implemented diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 58a47529..c74e1924 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -20,6 +20,7 @@ jobs: uses: FuelLabs/github-actions/setups/node@master with: node-version: 20.11.0 + pnpm-version: 8.9.0 - uses: FuelLabs/github-actions/setups/docker@master with: diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 2be68416..9e9f6f87 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -44,6 +44,8 @@ jobs: - name: CI Setup uses: FuelLabs/github-actions/setups/node@master + with: + pnpm-version: 8.9.0 - name: Validate Changeset run: pnpm changeset status --since=origin/${{ github.base_ref }} @@ -54,6 +56,9 @@ jobs: steps: - uses: actions/checkout@v3 - uses: FuelLabs/github-actions/setups/node@master + with: + pnpm-version: 8.9.0 + - run: pnpm audit --prod lint: @@ -69,6 +74,8 @@ jobs: - name: Setup Node uses: FuelLabs/github-actions/setups/node@master + with: + pnpm-version: 8.9.0 - name: Run lint & ts:check run: | diff --git a/packages/burner-wallet-connector/package.json b/packages/burner-wallet-connector/package.json new file mode 100644 index 00000000..4744481d --- /dev/null +++ b/packages/burner-wallet-connector/package.json @@ -0,0 +1,30 @@ +{ + "name": "@fuel-connectors/burner-wallet-connector", + "version": "0.0.0", + "private": true, + "type": "module", + "types": "./dist/index.d.ts", + "exports": { + ".": "./src/index.ts" + }, + "scripts": { + "build": "tsup --dts-only", + "build:watch": "tsup --watch --dts-only", + "ts:check": "tsc --noEmit", + "test": "vitest" + }, + "peerDependencies": { + "fuels": ">=0.77.0" + }, + "devDependencies": { + "@fuel-ts/account": "^0.79.0", + "@fuel-ts/fuel-core": "^0.79.0", + "fuels": "^0.79.0", + "jsdom": "24.0.0", + "tsup": "8.0.2", + "typescript": "5.4.3", + "vite": "^5.0.10", + "vite-plugin-dts": "^3.6.4", + "vitest": "^1.4.0" + } +} diff --git a/packages/burner-wallet-connector/src/BurnerWalletConnector.ts b/packages/burner-wallet-connector/src/BurnerWalletConnector.ts new file mode 100644 index 00000000..2fd8a41d --- /dev/null +++ b/packages/burner-wallet-connector/src/BurnerWalletConnector.ts @@ -0,0 +1,279 @@ +import { + type AbiMap, + type Asset, + type ConnectorMetadata, + FuelConnector, + FuelConnectorEventTypes, + type JsonAbi, + type Network, + Provider, + type StorageAbstract, + type TransactionRequestLike, + type Version, + Wallet, + type WalletUnlocked, +} from 'fuels'; +import { + BETA_5_URL, + BURNER_WALLET_CONNECTED, + BURNER_WALLET_ICON, + BURNER_WALLET_PRIVATE_KEY, + WINDOW, +} from './constants'; +import type { BurnerWalletConfig } from './types'; + +export class BurnerWalletConnector extends FuelConnector { + name = 'Burner Wallet'; + + connected = false; + installed = false; + + events = FuelConnectorEventTypes; + + metadata: ConnectorMetadata = { + image: BURNER_WALLET_ICON, + install: { + action: '', + description: 'Burner Wallet to connect to Fuel', + link: '', + }, + }; + + burnerWallet: WalletUnlocked | null = null; + burnerWalletProvider: Provider | null = null; + burnerWalletPrivateKey: string | null = null; + + private config: BurnerWalletConfig = {}; + private storage: StorageAbstract; + + constructor(config: BurnerWalletConfig = {}) { + super(); + + this.config = config; + this.storage = this.getStorage(config.storage); + + this.configFuelProvider(config); + this.setupBurnerWallet(); + } + + private async configFuelProvider(config: BurnerWalletConfig = {}) { + this.config.fuelProvider = + config.fuelProvider || Provider.create(BETA_5_URL); + } + + private async setupBurnerWallet() { + const privateKey = await this.storage.getItem(BURNER_WALLET_PRIVATE_KEY); + + if (privateKey) { + this.storage.setItem(BURNER_WALLET_ICON, privateKey); + } + + if (!privateKey) { + this.burnerWallet = Wallet.generate({ + provider: await this.config.fuelProvider, + }); + + this.burnerWalletProvider = this.burnerWallet.provider; + this.burnerWalletPrivateKey = this.burnerWallet.privateKey; + + this.storage.setItem( + BURNER_WALLET_PRIVATE_KEY, + this.burnerWalletPrivateKey, + ); + + return this.burnerWallet; + } + + this.burnerWallet = Wallet.fromPrivateKey( + privateKey, + await this.config.fuelProvider, + ); + + this.burnerWalletProvider = this.burnerWallet.provider; + this.burnerWalletPrivateKey = this.burnerWallet.privateKey; + + return this.burnerWallet; + } + + private getStorage(storage?: StorageAbstract) { + const _storage = + storage ?? (WINDOW.sessionStorage as unknown as StorageAbstract); + if (!_storage) { + throw new Error('No storage provided'); + } + + return _storage; + } + + /** + * ============================================================ + * Connector methods + * ============================================================ + */ + async ping(): Promise { + await this.configFuelProvider(); + await this.setupBurnerWallet(); + + return true; + } + + async version(): Promise { + return { app: '0.0.0', network: '0.0.0' }; + } + + async isConnected(): Promise { + const connected = + (await this.storage.getItem(BURNER_WALLET_CONNECTED)) === 'true'; + + if (!connected) { + return false; + } + + const account = this.burnerWallet?.address.toString(); + + return !!account && account.length > 0; + } + + async connect(): Promise { + if (!(await this.isConnected())) { + if (!this.burnerWalletProvider) { + throw Error('Burner Wallet Provider not found'); + } + + await this.setupBurnerWallet(); + + this.burnerWalletProvider = this.burnerWallet?.connect( + this.burnerWalletProvider, + ) as Provider; + + this.storage.setItem(BURNER_WALLET_CONNECTED, 'true'); + } + + this.emit(this.events.connection, true); + this.emit( + this.events.currentAccount, + this.burnerWallet?.address.toAddress(), + ); + this.emit(this.events.accounts, [this.burnerWallet?.address.toAddress()]); + + return this.connected; + } + + async accounts(): Promise { + if (!this.burnerWallet) { + throw Error('Wallet not connected'); + } + + const account = this.burnerWallet.address.toAddress(); + + if (!account) { + return []; + } + + return [account as `fuel${string}`]; + } + + async disconnect(): Promise { + if (await this.isConnected()) { + this.burnerWalletPrivateKey = null; + this.burnerWalletProvider = null; + this.burnerWallet = null; + } + + this.storage.setItem(BURNER_WALLET_CONNECTED, 'false'); + this.storage.removeItem(BURNER_WALLET_PRIVATE_KEY); + + this.emit(this.events.connection, false); + this.emit(this.events.currentAccount, null); + this.emit(this.events.accounts, []); + + return this.connected; + } + + async signMessage(_address: string, _message: string): Promise { + if (!this.burnerWallet) { + throw Error('Wallet not connected'); + } + + if (_address !== this.burnerWallet.address.toString()) { + throw Error('Address not found for the connector'); + } + + const signMessage = await this.burnerWallet.signMessage(_message); + + return signMessage; + } + + async sendTransaction( + _address: string, + transaction: TransactionRequestLike, + ): Promise { + if (!this.burnerWallet) { + throw Error('Wallet not connected'); + } + + if (_address !== this.burnerWallet.address.toString()) { + throw Error('Address not found for the connector'); + } + + const transactionRequest = await this.burnerWallet.sendTransaction( + transaction, + { awaitExecution: true }, + ); + + return transactionRequest.id; + } + + async currentAccount(): Promise { + if (!this.burnerWallet) { + throw Error('Wallet not connected'); + } + + return this.burnerWallet.address.toString() || null; + } + + async addAssets(_assets: Asset[]): Promise { + throw new Error('Method not implemented.'); + } + + async addAsset(_asset: Asset): Promise { + throw new Error('Method not implemented.'); + } + + async assets(): Promise> { + return []; + } + + async addNetwork(_networkUrl: string): Promise { + throw new Error('Method not implemented.'); + } + + async selectNetwork(_network: Network): Promise { + throw new Error('Method not implemented.'); + } + + async networks(): Promise { + return [await this.currentNetwork()]; + } + + async currentNetwork(): Promise { + const network = await this.burnerWalletProvider?.getNetwork(); + + return { + chainId: Number(network?.chainId), + url: this.burnerWalletProvider?.url ?? '', + }; + } + + async addAbi(_abiMap: AbiMap): Promise { + throw new Error('Method not implemented.'); + } + + async getAbi(_contractId: string): Promise { + throw Error('Method not implemented.'); + } + + async hasAbi(_contractId: string): Promise { + throw Error('Method not implemented.'); + } +} diff --git a/packages/burner-wallet-connector/src/constants.ts b/packages/burner-wallet-connector/src/constants.ts new file mode 100644 index 00000000..832e9039 --- /dev/null +++ b/packages/burner-wallet-connector/src/constants.ts @@ -0,0 +1,11 @@ +export const BURNER_WALLET_ICON = + 'data:image/svg+xml;utf8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0Ny41IDQ3LjUiPjxkZWZzPjxjbGlwUGF0aCBpZD0iYSI+PHBhdGggZD0iTTAgMzhoMzhWMEgwdjM4WiIvPjwvY2xpcFBhdGg+PGNsaXBQYXRoIGlkPSJiIj48cGF0aCBkPSJNMTguNTgzIDI3LjgzM2MtMi45NTctLjIzMS01LjY2NiAyLjU0Mi00LjY2NiA3LjA0Mi0zLjIzOS0yLjM4Ni0zLjMzMi02LjQwMy0yLjMzMy05IDEuMDQxLTIuNzA4LS4wNDItNC45NTgtMi41ODQtNS4yMDgtMi44MzktLjI4LTQuNDE2IDMuMDQyLTIuOTYyIDguMzMzQTE2LjkzNiAxNi45MzYgMCAwIDEgMiAxOEMyIDguNjExIDkuNjExIDEgMTkgMXMxNyA3LjYxMSAxNyAxN2MwIDIuMDYzLS4zNjcgNC4wMzktMS4wNCA1Ljg2OC0uNDYtNS4zODgtMy4zMzMtOC4xNTctNi4zMzUtNi44NjgtMi44MTIgMS4yMDgtLjkxNyA1LjkxNy0uNzc3IDguMTY0LjIzNiAzLjgwOS0uMDEyIDguMTY5LTYuOTMxIDExLjc5NCAyLjg3NS01LjQ5OS4zMzMtOC45MTctMi4zMzQtOS4xMjUiLz48L2NsaXBQYXRoPjwvZGVmcz48ZyBjbGlwLXBhdGg9InVybCgjYSkiIHRyYW5zZm9ybT0ibWF0cml4KDEuMjUgMCAwIC0xLjI1IDAgNDcuNSkiPjxwYXRoIGZpbGw9IiNmNDkwMGMiIGQ9Ik0zNiAxOGMwIDIuMDYzLS4zNjcgNC4wMzktMS4wNCA1Ljg2OC0uNDYtNS4zODktMy4zMzMtOC4xNTctNi4zMzUtNi44NjgtMi44MTMgMS4yMDgtLjkxNyA1LjkxNy0uNzc3IDguMTY0LjIzNiAzLjgwOS0uMDEyIDguMTY5LTYuOTMxIDExLjc5NCAyLjg3NS01LjUuMzMzLTguOTE2LTIuMzM0LTkuMTI1LTIuOTU4LS4yMy01LjY2NiAyLjU0Mi00LjY2NiA3LjA0Mi0zLjIzOC0yLjM4Ni0zLjMzMy02LjQwMi0yLjMzNC05IDEuMDQyLTIuNzA4LS4wNDEtNC45NTgtMi41ODMtNS4yMDgtMi44MzktLjI4LTQuNDE3IDMuMDQxLTIuOTYyIDguMzMzQTE2LjkzNiAxNi45MzYgMCAwIDEgMiAxOEMyIDguNjExIDkuNjExIDEgMTkgMXMxNyA3LjYxMSAxNyAxNyIvPjwvZz48ZyBjbGlwLXBhdGg9InVybCgjYikiIHRyYW5zZm9ybT0ibWF0cml4KDEuMjUgMCAwIC0xLjI1IDAgNDcuNSkiPjxwYXRoIGZpbGw9IiNmZmNjNGQiIGQ9Ik0zMSA3YzAgMi4xODctLjU4NCA0LjIzNi0xLjYwNSA2LjAwMS4xNDctMy4wODQtMi41NjItNC4yOTMtNC4wMi0zLjcwOS0yLjEwNS44NDMtMS41NDEgMi4yOTEtMi4wODMgNS4yOTEtLjU0MiAzLTIuNjI1IDUuMDg0LTUuNzA5IDYgMi4yNS02LjMzMy0xLjI0Ny04LjY2Ny0zLjA4LTkuMDg0LTEuODcyLS40MjYtMy43NTMuMDAxLTMuOTY4IDQuMDA3QTExLjk2NyAxMS45NjcgMCAwIDEgNyA3QzcgLjM3MyAxMi4zNzMtNSAxOS01UzMxIC4zNzMgMzEgNyIvPjwvZz48L3N2Zz4='; + +export const BETA_5_URL = 'https://beta-5.fuel.network/graphql'; + +export const HAS_WINDOW = typeof window !== 'undefined'; +// biome-ignore lint/suspicious/noExplicitAny: +export const WINDOW: any = HAS_WINDOW ? window : {}; + +export const BURNER_WALLET_CONNECTED = 'burner-wallet-connected'; +export const BURNER_WALLET_PRIVATE_KEY = 'burner-wallet-private-key'; diff --git a/packages/burner-wallet-connector/src/index.ts b/packages/burner-wallet-connector/src/index.ts new file mode 100644 index 00000000..75ccad37 --- /dev/null +++ b/packages/burner-wallet-connector/src/index.ts @@ -0,0 +1 @@ +export * from './BurnerWalletConnector'; diff --git a/packages/burner-wallet-connector/src/tests/burnerWalletConnector.test.ts b/packages/burner-wallet-connector/src/tests/burnerWalletConnector.test.ts new file mode 100644 index 00000000..809cab16 --- /dev/null +++ b/packages/burner-wallet-connector/src/tests/burnerWalletConnector.test.ts @@ -0,0 +1,290 @@ +import path from 'node:path'; +import { launchNodeAndGetWallets } from '@fuel-ts/account/test-utils'; +import { + type Asset, + type Network, + type Provider, + type StorageAbstract, + Wallet, +} from 'fuels'; +import { + afterAll, + beforeAll, + beforeEach, + describe, + expect, + test, +} from 'vitest'; +import { BurnerWalletConnector } from '../BurnerWalletConnector'; +import { BURNER_WALLET_PRIVATE_KEY } from '../constants'; +import type { BurnerWalletConfig } from '../types'; +import { mockedStorage } from './mockedStorage'; + +describe('Burner Wallet Connector', () => { + let fuelProvider: Provider; + let connector: BurnerWalletConnector; + + let stopProvider: () => void; + + const chainConfigPath = path.join(__dirname, 'chainConfig.json'); + + beforeAll(async () => { + Object.defineProperty(global, 'sessionStorage', { + value: mockedStorage, + }); + + Object.defineProperty(global, 'localStorage', { + value: mockedStorage, + }); + + process.env.GENESIS_SECRET = + '0x6e48a022f9d4ae187bca4e2645abd62198ae294ee484766edbdaadf78160dc68'; + const { stop, provider } = await launchNodeAndGetWallets({ + launchNodeOptions: { + args: ['--chain', chainConfigPath], + loggingEnabled: false, + }, + }); + + fuelProvider = provider; + stopProvider = stop; + }); + + afterAll(() => { + stopProvider?.(); + }); + + beforeEach(async () => { + connector = new BurnerWalletConnector({ + fuelProvider, + }); + }); + + describe('constructor()', () => { + test('creates a new BurnerWalletConnector instance', () => { + expect(connector).to.be.an.instanceOf(BurnerWalletConnector); + + expect(connector.name).to.be.equal('Burner Wallet'); + expect(connector.connected).to.be.false; + expect(connector.installed).to.be.false; + }); + + test('creates a new BurnerWalletConnector instance with config using localStorage', async () => { + const wallet = Wallet.generate({ + provider: fuelProvider, + }); + + localStorage.setItem(BURNER_WALLET_PRIVATE_KEY, wallet.privateKey); + + const config: BurnerWalletConfig = { + fuelProvider, + storage: localStorage as unknown as StorageAbstract, + }; + const connector = new BurnerWalletConnector(config); + await connector.connect(); + + expect(connector).to.be.an.instanceOf(BurnerWalletConnector); + expect(connector.burnerWalletPrivateKey).to.be.equal(wallet.privateKey); + }); + + test('creates a new BurnerWalletConnector instance with config using sessionStorage', async () => { + const wallet = Wallet.generate({ + provider: fuelProvider, + }); + + sessionStorage.setItem(BURNER_WALLET_PRIVATE_KEY, wallet.privateKey); + + const config: BurnerWalletConfig = { + fuelProvider, + storage: sessionStorage as unknown as StorageAbstract, + }; + const connector = new BurnerWalletConnector(config); + await connector.connect(); + + expect(connector).to.be.an.instanceOf(BurnerWalletConnector); + expect(connector.burnerWalletPrivateKey).to.be.equal(wallet.privateKey); + }); + }); + + describe('connect()', () => { + test('connect to burner wallet', async () => { + await connector.connect(); + + const connectedAfterConnect = await connector.isConnected(); + expect(connectedAfterConnect).to.be.true; + }); + }); + + describe('isConnected()', () => { + test('false when not connected', async () => { + const burnerWalletConnector = new BurnerWalletConnector(); + const connected = await burnerWalletConnector.isConnected(); + + expect(connected).to.be.false; + }); + test('true when connected', async () => { + await connector.connect(); + const connected = await connector.isConnected(); + + expect(connected).to.be.true; + }); + }); + + describe('disconnect()', () => { + test('disconnect from burner wallet', async () => { + await connector.connect(); + await connector.disconnect(); + + const connected = await connector.isConnected(); + const privateKey = sessionStorage.getItem(BURNER_WALLET_PRIVATE_KEY); + + expect(connected).to.be.false; + expect(privateKey).toBeNull(); + }); + }); + + describe('accounts()', () => { + test('throws error when not connected', async () => { + const burnerWalletConnector = new BurnerWalletConnector(); + + await expect(() => burnerWalletConnector.accounts()).rejects.toThrow( + 'Wallet not connected', + ); + }); + + test('get accounts', async () => { + await connector.connect(); + + const accounts = await connector.accounts(); + + expect(accounts).to.deep.equal([ + connector.burnerWallet?.address.toString(), + ]); + }); + }); + + describe('currentAccount()', () => { + test('throws error when not connected', async () => { + const burnerWalletConnector = new BurnerWalletConnector(); + + await expect(() => + burnerWalletConnector.currentAccount(), + ).rejects.toThrow('Wallet not connected'); + }); + + test('get current account', async () => { + await connector.connect(); + + const account = await connector.currentAccount(); + + expect(account).to.be.equal(connector.burnerWallet?.address.toString()); + }); + }); + + describe('network()', () => { + test('returns fuel network info', async () => { + await connector.connect(); + + const network = await connector.currentNetwork(); + + expect(network.chainId).to.be.equal( + Number((await fuelProvider.getNetwork()).chainId), + ); + expect(network.url).to.be.equal(fuelProvider.url); + }); + }); + + describe('networks()', () => { + test('returns an array of fuel network info', async () => { + await connector.connect(); + + const networks = await connector.networks(); + const network = networks.pop(); + + const networkChainId = network?.chainId; + const connectorNetwork = await fuelProvider.getNetwork(); + const expectedChainId = connectorNetwork + ? Number(connectorNetwork.chainId) + : undefined; + + expect(networks).to.be.an('array'); + + expect(networkChainId).to.be.equal(expectedChainId); + expect(network?.url).to.be.equal(fuelProvider.url); + }); + }); + + describe('assets()', () => { + test('returns an empty array', async () => { + expect(await connector.assets()).to.deep.equal([]); + }); + }); + + describe('addAsset()', () => { + test('throws error', async () => { + const asset: Asset = { + name: '', + symbol: '', + icon: '', + networks: [], + }; + await expect(() => connector.addAsset(asset)).rejects.toThrowError( + 'Method not implemented.', + ); + }); + }); + + describe('addAssets()', () => { + test('throws error', async () => { + await expect(() => connector.addAssets([])).rejects.toThrowError( + 'Method not implemented.', + ); + }); + }); + + describe('addAbi()', () => { + test('throws error', async () => { + await expect(() => connector.addAbi({})).rejects.toThrowError( + 'Method not implemented.', + ); + }); + }); + + describe('getAbi()', () => { + test('throws error', async () => { + await expect(() => connector.getAbi('contractId')).rejects.toThrowError( + 'Method not implemented.', + ); + }); + }); + + describe('hasAbi()', () => { + test('throws error', async () => { + const connector = new BurnerWalletConnector(); + + await expect( + async () => await connector.hasAbi('contractId'), + ).rejects.toThrow('Method not implemented.'); + }); + }); + + describe('addNetwork()', () => { + test('throws error', async () => { + await expect(() => connector.addNetwork('')).rejects.toThrowError( + 'Method not implemented.', + ); + }); + }); + + describe('selectNetwork()', () => { + const network: Network = { + chainId: 1, + url: '', + }; + test('throws error', async () => { + await expect(() => connector.selectNetwork(network)).rejects.toThrowError( + 'Method not implemented.', + ); + }); + }); +}); diff --git a/packages/burner-wallet-connector/src/tests/chainConfig.json b/packages/burner-wallet-connector/src/tests/chainConfig.json new file mode 100644 index 00000000..e9736df4 --- /dev/null +++ b/packages/burner-wallet-connector/src/tests/chainConfig.json @@ -0,0 +1,520 @@ +{ + "chain_name": "local_testnet", + "block_gas_limit": 5000000000, + "initial_state": { + "coins": [ + { + "owner": "0x94ffcc53b892684acefaebc8a3d4a595e528a8cf664eeb3ef36f1020b0809d0d", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x6e8ec14985922d2b5daf0a9ae68ca63d849e72f09fbc8ab2ddbb88b779a083a0", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x09c0b2d1a486c439a87bcba6b46a7a1a23f3897cc83a94521a96da5c23bc58db", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x09c0b2d1a486c439a87bcba6b46a7a1a23f3897cc83a94521a96da5c23bc58db", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x09c0b2d1a486c439a87bcba6b46a7a1a23f3897cc83a94521a96da5c23bc58db", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0x5d99ee966b42cd8fc7bdd1364b389153a9e78b42b7d4a691470674e817888d4e", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x5d99ee966b42cd8fc7bdd1364b389153a9e78b42b7d4a691470674e817888d4e", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x5d99ee966b42cd8fc7bdd1364b389153a9e78b42b7d4a691470674e817888d4e", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0xbdaad6a89e073e177895b3e5a9ccd15806749eda134a6438dae32fc5b6601f3f", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0xbdaad6a89e073e177895b3e5a9ccd15806749eda134a6438dae32fc5b6601f3f", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0xbdaad6a89e073e177895b3e5a9ccd15806749eda134a6438dae32fc5b6601f3f", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0x95a7aa6cc32743f8706c40ef49a7423b47da763bb4bbc055b1f07254dc729036", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x95a7aa6cc32743f8706c40ef49a7423b47da763bb4bbc055b1f07254dc729036", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x95a7aa6cc32743f8706c40ef49a7423b47da763bb4bbc055b1f07254dc729036", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0xcee104acd38b940c8f1c62c6d7ea00a0ad2241d6dee0509a4bf27297508870d3", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0xcee104acd38b940c8f1c62c6d7ea00a0ad2241d6dee0509a4bf27297508870d3", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0xcee104acd38b940c8f1c62c6d7ea00a0ad2241d6dee0509a4bf27297508870d3", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0x7e3626e306588eba79cafab73f0709e55ab8f4bdfe8c8b75034a430fc56ece89", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x7e3626e306588eba79cafab73f0709e55ab8f4bdfe8c8b75034a430fc56ece89", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x7e3626e306588eba79cafab73f0709e55ab8f4bdfe8c8b75034a430fc56ece89", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0x1c31df52b6df56407dd95f83082e8beb9cfc9532ac111d5bd8491651d95ba775", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x1c31df52b6df56407dd95f83082e8beb9cfc9532ac111d5bd8491651d95ba775", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x1c31df52b6df56407dd95f83082e8beb9cfc9532ac111d5bd8491651d95ba775", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0x09dd7a49174d6fcc9f4c6f7942c18060a935ddd03ee69b594189b8c3581276ea", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x09dd7a49174d6fcc9f4c6f7942c18060a935ddd03ee69b594189b8c3581276ea", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x09dd7a49174d6fcc9f4c6f7942c18060a935ddd03ee69b594189b8c3581276ea", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0x86604282dc604481b809845be49667607c470644f6822fc01eb0d22f167e08cf", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x86604282dc604481b809845be49667607c470644f6822fc01eb0d22f167e08cf", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x86604282dc604481b809845be49667607c470644f6822fc01eb0d22f167e08cf", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0xbca334a06d19db5041c78fe2f465b07be5bec828f38b7796b2877e7d1542c950", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0xbca334a06d19db5041c78fe2f465b07be5bec828f38b7796b2877e7d1542c950", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0xbca334a06d19db5041c78fe2f465b07be5bec828f38b7796b2877e7d1542c950", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0xbd9a1dc8d3ec3521c43f6c2c01611b4d0204c7610204ff0178488c8738a30bd2", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0xbd9a1dc8d3ec3521c43f6c2c01611b4d0204c7610204ff0178488c8738a30bd2", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0xbd9a1dc8d3ec3521c43f6c2c01611b4d0204c7610204ff0178488c8738a30bd2", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0xb32197cf75efe05bf453c26178139f09b391582065549c1422bc92555ecffb64", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0xb32197cf75efe05bf453c26178139f09b391582065549c1422bc92555ecffb64", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0xb32197cf75efe05bf453c26178139f09b391582065549c1422bc92555ecffb64", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0x3b24509ed4ab3c7959f5c9391c1445c59290cdb5f13d6f780922f376b7029f30", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x3b24509ed4ab3c7959f5c9391c1445c59290cdb5f13d6f780922f376b7029f30", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x3b24509ed4ab3c7959f5c9391c1445c59290cdb5f13d6f780922f376b7029f30", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0x77c6f40b7da70d885f68efaad7c661327482a63ea10dcb4271de819438254ae1", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x77c6f40b7da70d885f68efaad7c661327482a63ea10dcb4271de819438254ae1", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x77c6f40b7da70d885f68efaad7c661327482a63ea10dcb4271de819438254ae1", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0x6a2c4691c547c43924650dbd30620b184b5fe3fb6dbe5c4446110b08f6f405bf", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x6a2c4691c547c43924650dbd30620b184b5fe3fb6dbe5c4446110b08f6f405bf", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x6a2c4691c547c43924650dbd30620b184b5fe3fb6dbe5c4446110b08f6f405bf", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + }, + { + "owner": "0x49075a7538e2c88ebe1926ce4d898198a2a4e790d14512943a9864bc536b3c82", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "owner": "0x49075a7538e2c88ebe1926ce4d898198a2a4e790d14512943a9864bc536b3c82", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0101010101010101010101010101010101010101010101010101010101010101" + }, + { + "owner": "0x49075a7538e2c88ebe1926ce4d898198a2a4e790d14512943a9864bc536b3c82", + "amount": "0xFFFFFFFFFFFFFFFF", + "asset_id": "0x0202020202020202020202020202020202020202020202020202020202020202" + } + ], + "messages": [ + { + "sender": "0xc43454aa38dd91f88109a4b7aef5efb96ce34e3f24992fe0f81d233ca686f80f", + "recipient": "0x69a2b736b60159b43bb8a4f98c0589f6da5fa3a3d101e8e269c499eb942753ba", + "nonce": "0101010101010101010101010101010101010101010101010101010101010101", + "amount": "0x000000000000FFFF", + "data": "", + "da_height": "0x00" + }, + { + "sender": "0x69a2b736b60159b43bb8a4f98c0589f6da5fa3a3d101e8e269c499eb942753ba", + "recipient": "0xc43454aa38dd91f88109a4b7aef5efb96ce34e3f24992fe0f81d233ca686f80f", + "nonce": "0e1ef2963832068b0e1ef2963832068b0e1ef2963832068b0e1ef2963832068b", + "amount": "0xb04f3c08f59b309e", + "data": "", + "da_height": "0x00" + } + ] + }, + "consensus_parameters": { + "tx_params": { + "max_inputs": 255, + "max_outputs": 255, + "max_witnesses": 255, + "max_gas_per_tx": 10000000, + "max_size": 17825792 + }, + "predicate_params": { + "max_predicate_length": 1048576, + "max_predicate_data_length": 1048576, + "max_gas_per_predicate": 10000000, + "max_message_data_length": 1048576 + }, + "script_params": { + "max_script_length": 1048576, + "max_script_data_length": 1048576 + }, + "contract_params": { + "contract_max_size": 16777216, + "max_storage_slots": 255 + }, + "fee_params": { + "gas_price_factor": 92, + "gas_per_byte": 4 + } + }, + "gas_costs": { + "add": 1, + "addi": 1, + "aloc": 1, + "and": 1, + "andi": 1, + "bal": 13, + "bhei": 1, + "bhsh": 1, + "burn": 132, + "cb": 1, + "cfei": 1, + "cfsi": 1, + "croo": 16, + "div": 1, + "divi": 1, + "ecr1": 3000, + "eck1": 951, + "ed19": 3000, + "eq": 1, + "exp": 1, + "expi": 1, + "flag": 1, + "gm": 1, + "gt": 1, + "gtf": 1, + "ji": 1, + "jmp": 1, + "jne": 1, + "jnei": 1, + "jnzi": 1, + "jmpf": 1, + "jmpb": 1, + "jnzf": 1, + "jnzb": 1, + "jnef": 1, + "jneb": 1, + "lb": 1, + "log": 9, + "lt": 1, + "lw": 1, + "mint": 135, + "mlog": 1, + "modOp": 1, + "modi": 1, + "moveOp": 1, + "movi": 1, + "mroo": 2, + "mul": 1, + "muli": 1, + "mldv": 1, + "noop": 1, + "not": 1, + "or": 1, + "ori": 1, + "poph": 2, + "popl": 2, + "pshh": 2, + "pshl": 2, + "ret": 13, + "rvrt": 13, + "sb": 1, + "sll": 1, + "slli": 1, + "srl": 1, + "srli": 1, + "srw": 12, + "sub": 1, + "subi": 1, + "sw": 1, + "sww": 67, + "time": 1, + "tr": 105, + "tro": 60, + "wdcm": 1, + "wqcm": 1, + "wdop": 1, + "wqop": 1, + "wdml": 1, + "wqml": 1, + "wddv": 1, + "wqdv": 2, + "wdmd": 3, + "wqmd": 4, + "wdam": 2, + "wqam": 3, + "wdmm": 3, + "wqmm": 3, + "xor": 1, + "xori": 1, + "call": { + "LightOperation": { + "base": 144, + "units_per_gas": 214 + } + }, + "ccp": { + "LightOperation": { + "base": 15, + "units_per_gas": 103 + } + }, + "csiz": { + "LightOperation": { + "base": 17, + "units_per_gas": 790 + } + }, + "k256": { + "LightOperation": { + "base": 11, + "units_per_gas": 214 + } + }, + "ldc": { + "LightOperation": { + "base": 15, + "units_per_gas": 272 + } + }, + "logd": { + "LightOperation": { + "base": 26, + "units_per_gas": 64 + } + }, + "mcl": { + "LightOperation": { + "base": 1, + "units_per_gas": 3333 + } + }, + "mcli": { + "LightOperation": { + "base": 1, + "units_per_gas": 3333 + } + }, + "mcp": { + "LightOperation": { + "base": 1, + "units_per_gas": 2000 + } + }, + "mcpi": { + "LightOperation": { + "base": 3, + "units_per_gas": 2000 + } + }, + "meq": { + "LightOperation": { + "base": 1, + "units_per_gas": 2500 + } + }, + "retd": { + "LightOperation": { + "base": 29, + "units_per_gas": 62 + } + }, + "s256": { + "LightOperation": { + "base": 2, + "units_per_gas": 214 + } + }, + "scwq": { + "LightOperation": { + "base": 13, + "units_per_gas": 5 + } + }, + "smo": { + "LightOperation": { + "base": 209, + "units_per_gas": 55 + } + }, + "srwq": { + "LightOperation": { + "base": 47, + "units_per_gas": 5 + } + }, + "swwq": { + "LightOperation": { + "base": 44, + "units_per_gas": 5 + } + }, + "contract_root": { + "LightOperation": { + "base": 75, + "units_per_gas": 1 + } + }, + "state_root": { + "LightOperation": { + "base": 412, + "units_per_gas": 1 + } + }, + "vm_initialization": { + "HeavyOperation": { + "base": 2000, + "gas_per_unit": 0 + } + }, + "new_storage_per_byte": 1 + }, + "consensus": { + "PoA": { + "signing_key": "0x94ffcc53b892684acefaebc8a3d4a595e528a8cf664eeb3ef36f1020b0809d0d" + } + } +} diff --git a/packages/burner-wallet-connector/src/tests/index.test.ts b/packages/burner-wallet-connector/src/tests/index.test.ts new file mode 100644 index 00000000..5d96e0e4 --- /dev/null +++ b/packages/burner-wallet-connector/src/tests/index.test.ts @@ -0,0 +1,9 @@ +import { describe, expect, test } from 'vitest'; + +import { BurnerWalletConnector } from '../index'; + +describe('index', () => { + test('should export BurnerWalletConnector', () => { + expect(BurnerWalletConnector).toBeDefined(); + }); +}); diff --git a/packages/burner-wallet-connector/src/tests/mockedStorage.ts b/packages/burner-wallet-connector/src/tests/mockedStorage.ts new file mode 100644 index 00000000..1b2b7440 --- /dev/null +++ b/packages/burner-wallet-connector/src/tests/mockedStorage.ts @@ -0,0 +1,18 @@ +export const mockedStorage: Storage = (() => { + let store: Record = {}; + + return { + getItem: (key: string): string => store[key] ?? null, + setItem: (key: string, value: string): void => { + store[key] = value.toString(); + }, + removeItem: (key: string): void => { + delete store[key]; + }, + clear: (): void => { + store = {}; + }, + key: (_index: number): string | null => '', + length: Object.keys(store).length, + }; +})(); diff --git a/packages/burner-wallet-connector/src/types.ts b/packages/burner-wallet-connector/src/types.ts new file mode 100644 index 00000000..1f2e4a72 --- /dev/null +++ b/packages/burner-wallet-connector/src/types.ts @@ -0,0 +1,6 @@ +import type { Provider as FuelProvider, StorageAbstract } from 'fuels'; + +export type BurnerWalletConfig = { + fuelProvider?: FuelProvider | Promise; + storage?: StorageAbstract; +}; diff --git a/packages/burner-wallet-connector/tsconfig.json b/packages/burner-wallet-connector/tsconfig.json new file mode 100644 index 00000000..85ef6b99 --- /dev/null +++ b/packages/burner-wallet-connector/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "baseUrl": ".", + "rootDir": "." + }, + "exclude": ["dist"] +} diff --git a/packages/burner-wallet-connector/tsup.config.js b/packages/burner-wallet-connector/tsup.config.js new file mode 100644 index 00000000..8e0c2622 --- /dev/null +++ b/packages/burner-wallet-connector/tsup.config.js @@ -0,0 +1,9 @@ +import baseConfig from '@fuels/tsup-config'; +import { defineConfig } from 'tsup'; + +export default defineConfig((options) => ({ + ...baseConfig(options, { withReact: false }), + format: ['cjs'], + external: ['fuels'], + entry: ['src/index.ts'], +})); diff --git a/packages/burner-wallet-connector/vite.config.ts b/packages/burner-wallet-connector/vite.config.ts new file mode 100644 index 00000000..4493096f --- /dev/null +++ b/packages/burner-wallet-connector/vite.config.ts @@ -0,0 +1,22 @@ +// vite.config.js +import { resolve } from 'node:path'; +import { defineConfig } from 'vite'; +import dts from 'vite-plugin-dts'; + +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +export default defineConfig({ + plugins: [ + dts({ + include: [resolve(__dirname, 'src/')], + }), + ], + define: { + __dirname: JSON.stringify(path.dirname(__filename)), + __filename: JSON.stringify(fileURLToPath(import.meta.url)), + }, + test: { + environment: 'jsdom', + }, +}); diff --git a/packages/connectors/package.json b/packages/connectors/package.json index 9411cf10..b505206b 100644 --- a/packages/connectors/package.json +++ b/packages/connectors/package.json @@ -25,6 +25,7 @@ "@fuel-connectors/fuel-wallet": "workspace:*", "@fuel-connectors/fuelet-wallet": "workspace:*", "@fuel-connectors/evm-connector": "workspace:*", + "@fuel-connectors/burner-wallet-connector": "workspace:*", "fuels": "0.79.0", "terser": "5.29.2", "tsup": "8.0.2", diff --git a/packages/connectors/src/defaultConnectors.ts b/packages/connectors/src/defaultConnectors.ts index 510d1a57..5f39f3b3 100644 --- a/packages/connectors/src/defaultConnectors.ts +++ b/packages/connectors/src/defaultConnectors.ts @@ -1,3 +1,4 @@ +import { BurnerWalletConnector } from '@fuel-connectors/burner-wallet-connector'; import { EVMWalletConnector } from '@fuel-connectors/evm-connector'; import { FuelWalletDevelopmentConnector } from '@fuel-connectors/fuel-development-wallet'; import { FuelWalletConnector } from '@fuel-connectors/fuel-wallet'; @@ -15,6 +16,7 @@ export function defaultConnectors({ new FuelWalletConnector(), new FueletWalletConnector(), new EVMWalletConnector(), + new BurnerWalletConnector(), ]; if (devMode) { diff --git a/packages/connectors/src/index.ts b/packages/connectors/src/index.ts index af6f3b5d..da866d11 100644 --- a/packages/connectors/src/index.ts +++ b/packages/connectors/src/index.ts @@ -3,3 +3,4 @@ export * from '@fuel-connectors/fuel-development-wallet'; export * from '@fuel-connectors/fuel-wallet'; export * from '@fuel-connectors/fuelet-wallet'; export * from '@fuel-connectors/evm-connector'; +export * from '@fuel-connectors/burner-wallet-connector'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 60f53799..6cf54ee5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,7 +40,7 @@ importers: version: 1.13.0 vitest: specifier: 1.4.0 - version: 1.4.0(@types/node@20.12.4)(jsdom@24.0.0) + version: 1.4.0(jsdom@24.0.0) examples/react-app: dependencies: @@ -97,8 +97,41 @@ importers: specifier: 5.2.6 version: 5.2.6(@types/node@20.12.4) + packages/burner-wallet-connector: + devDependencies: + '@fuel-ts/account': + specifier: ^0.79.0 + version: 0.79.0(dexie@4.0.1) + '@fuel-ts/fuel-core': + specifier: ^0.79.0 + version: 0.79.0 + fuels: + specifier: ^0.79.0 + version: 0.79.0(dexie@4.0.1) + jsdom: + specifier: 24.0.0 + version: 24.0.0 + tsup: + specifier: 8.0.2 + version: 8.0.2(ts-node@10.9.2)(typescript@5.4.3) + typescript: + specifier: 5.4.3 + version: 5.4.3 + vite: + specifier: ^5.0.10 + version: 5.2.6(@types/node@20.12.4) + vite-plugin-dts: + specifier: ^3.6.4 + version: 3.7.3(@types/node@20.12.4)(typescript@5.4.3)(vite@5.2.6) + vitest: + specifier: ^1.4.0 + version: 1.4.0(jsdom@24.0.0) + packages/connectors: devDependencies: + '@fuel-connectors/burner-wallet-connector': + specifier: workspace:* + version: link:../burner-wallet-connector '@fuel-connectors/evm-connector': specifier: workspace:* version: link:../evm-connector @@ -2513,7 +2546,7 @@ packages: /@types/bn.js@5.1.5: resolution: {integrity: sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A==} dependencies: - '@types/node': 20.11.30 + '@types/node': 20.12.4 /@types/eslint-scope@3.7.7: resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==} @@ -2569,12 +2602,12 @@ packages: resolution: {integrity: sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==} dependencies: undici-types: 5.26.5 + dev: true /@types/node@20.12.4: resolution: {integrity: sha512-E+Fa9z3wSQpzgYQdYmme5X3OTuejnnTx88A6p6vkkJosR3KBz+HpE3kqNm98VE6cfLFcISx7zW7MsJkH6KwbTw==} dependencies: undici-types: 5.26.5 - dev: true /@types/normalize-package-data@2.4.4: resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} @@ -2637,7 +2670,7 @@ packages: strip-literal: 2.0.0 test-exclude: 6.0.0 v8-to-istanbul: 9.2.0 - vitest: 1.4.0(@types/node@20.12.4)(jsdom@24.0.0) + vitest: 1.4.0(jsdom@24.0.0) transitivePeerDependencies: - supports-color dev: true @@ -6391,7 +6424,7 @@ packages: jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.2 - terser: 5.30.3 + terser: 5.29.2 webpack: 5.91.0(esbuild@0.19.12) dev: true @@ -6406,17 +6439,6 @@ packages: source-map-support: 0.5.21 dev: true - /terser@5.30.3: - resolution: {integrity: sha512-STdUgOUx8rLbMGO9IOwHLpCqolkDITFFQSMYYwKE1N2lY6MVSaeoi10z/EhWxRc6ybqoVmKSkhKYH/XUpl7vSA==} - engines: {node: '>=10'} - hasBin: true - dependencies: - '@jridgewell/source-map': 0.3.6 - acorn: 8.11.3 - commander: 2.20.3 - source-map-support: 0.5.21 - dev: true - /test-exclude@6.0.0: resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} engines: {node: '>=8'} @@ -7121,6 +7143,62 @@ packages: - terser dev: true + /vitest@1.4.0(jsdom@24.0.0): + resolution: {integrity: sha512-gujzn0g7fmwf83/WzrDTnncZt2UiXP41mHuFYFrdwaLRVQ6JYQEiME2IfEjU3vcFL3VKa75XhI3lFgn+hfVsQw==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/node': ^18.0.0 || >=20.0.0 + '@vitest/browser': 1.4.0 + '@vitest/ui': 1.4.0 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + dependencies: + '@vitest/expect': 1.4.0 + '@vitest/runner': 1.4.0 + '@vitest/snapshot': 1.4.0 + '@vitest/spy': 1.4.0 + '@vitest/utils': 1.4.0 + acorn-walk: 8.3.2 + chai: 4.4.1 + debug: 4.3.4 + execa: 8.0.1 + jsdom: 24.0.0 + local-pkg: 0.5.0 + magic-string: 0.30.8 + pathe: 1.1.2 + picocolors: 1.0.0 + std-env: 3.7.0 + strip-literal: 2.0.0 + tinybench: 2.6.0 + tinypool: 0.8.3 + vite: 5.2.6(@types/node@20.12.4) + vite-node: 1.4.0(@types/node@20.12.4) + why-is-node-running: 2.2.2 + transitivePeerDependencies: + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + /vue-template-compiler@2.7.16: resolution: {integrity: sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==} dependencies: