diff --git a/package.json b/package.json index d97f831bbb..905268c6c0 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "@typescript-eslint/eslint-plugin": "^5.59.7", "@typescript-eslint/parser": "^5.59.7", "@vercel/routing-utils": "^3.1.0", - "@vitest/coverage-v8": "^0.33.0", + "@vitest/coverage-v8": "^2.0.5", "buffer": "^5.5.0", "chalk": "^5.2.0", "command-line-args": "^5.2.1", @@ -113,7 +113,7 @@ "stream-browserify": "^3.0.0", "tty-browserify": "^0.0.1", "util": "^0.12.3", - "vitest": "^0.33.0", + "vitest": "^2.0.5", "vm-browserify": "^1.1.2" }, "resolutions": { diff --git a/wallets/core/package.json b/wallets/core/package.json index f4677acf99..a2fc835480 100644 --- a/wallets/core/package.json +++ b/wallets/core/package.json @@ -14,6 +14,22 @@ "./legacy": { "types": "./dist/legacy/mod.d.ts", "default": "./dist/legacy/mod.js" + }, + "./utils": { + "types": "./dist/utils/mod.d.ts", + "default": "./dist/utils/mod.js" + }, + "./namespaces/common": { + "types": "./dist/namespaces/common/mod.d.ts", + "default": "./dist/namespaces/common/mod.js" + }, + "./namespaces/evm": { + "types": "./dist/namespaces/evm/mod.d.ts", + "default": "./dist/namespaces/evm/mod.js" + }, + "./namespaces/solana": { + "types": "./dist/namespaces/solana/mod.d.ts", + "default": "./dist/namespaces/solana/mod.js" } }, "files": [ @@ -22,11 +38,13 @@ "legacy" ], "scripts": { - "build": "node ../../scripts/build/command.mjs --path wallets/core --inputs src/mod.ts,src/legacy/mod.ts", + "build": "node ../../scripts/build/command.mjs --path wallets/core --inputs src/mod.ts,src/utils/mod.ts,src/legacy/mod.ts,src/namespaces/evm/mod.ts,src/namespaces/solana/mod.ts,src/namespaces/common/mod.ts", "ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json", "clean": "rimraf dist", "format": "prettier --write '{.,src}/**/*.{ts,tsx}'", - "lint": "eslint \"**/*.{ts,tsx}\" --ignore-path ../../.eslintignore" + "lint": "eslint \"**/*.{ts,tsx}\" --ignore-path ../../.eslintignore", + "test": "vitest", + "coverage": "vitest run --coverage" }, "peerDependencies": { "@types/react": "^17.0.0 || ^18.0.0", @@ -34,7 +52,10 @@ "react-dom": "^17.0.0 || ^18.0.0" }, "dependencies": { - "rango-types": "^0.1.69" + "caip": "^1.1.1", + "immer": "^10.0.4", + "rango-types": "^0.1.69", + "zustand": "^4.5.2" }, "publishConfig": { "access": "public" diff --git a/wallets/core/src/builders/action.ts b/wallets/core/src/builders/action.ts new file mode 100644 index 0000000000..fb09246d09 --- /dev/null +++ b/wallets/core/src/builders/action.ts @@ -0,0 +1,86 @@ +import type { Actions, Context, Operators } from '../hub/namespaces/types.js'; +import type { AnyFunction, FunctionWithContext } from '../types/actions.js'; + +export interface ActionByBuilder { + actionName: keyof T; + and: Operators; + or: Operators; + after: Operators; + before: Operators; + action: FunctionWithContext; +} + +/* + * TODO: + * Currently, to use this builder you will write something like this: + * new ActionBuilder('disconnect').after(....) + * + * I couldn't figure it out to be able typescript infer the constructor value as key of actions. + * Ideal usage: + * new ActionBuilder('disconnect').after(....) + * + */ +export class ActionBuilder, K extends keyof T> { + readonly name: K; + #and: Operators = new Map(); + #or: Operators = new Map(); + #after: Operators = new Map(); + #before: Operators = new Map(); + #action: FunctionWithContext> | undefined; + + constructor(name: K) { + this.name = name; + } + + public and(action: FunctionWithContext>) { + if (!this.#and.has(this.name)) { + this.#and.set(this.name, []); + } + this.#and.get(this.name)?.push(action); + return this; + } + + public or(action: FunctionWithContext>) { + if (!this.#or.has(this.name)) { + this.#or.set(this.name, []); + } + this.#or.get(this.name)?.push(action); + return this; + } + + public before(action: FunctionWithContext>) { + if (!this.#before.has(this.name)) { + this.#before.set(this.name, []); + } + this.#before.get(this.name)?.push(action); + return this; + } + + public after(action: FunctionWithContext>) { + if (!this.#after.has(this.name)) { + this.#after.set(this.name, []); + } + this.#after.get(this.name)?.push(action); + return this; + } + + public action(action: FunctionWithContext>) { + this.#action = action; + return this; + } + + public build(): ActionByBuilder> { + if (!this.#action) { + throw new Error('Your action builder should includes an action.'); + } + + return { + actionName: this.name, + action: this.#action, + before: this.#before, + after: this.#after, + and: this.#and, + or: this.#or, + }; + } +} diff --git a/wallets/core/src/builders/mod.ts b/wallets/core/src/builders/mod.ts new file mode 100644 index 0000000000..ce8394e228 --- /dev/null +++ b/wallets/core/src/builders/mod.ts @@ -0,0 +1,5 @@ +export type { ProxiedNamespace, FindProxiedNamespace } from './types.js'; + +export { NamespaceBuilder } from './namespace.js'; +export { ProviderBuilder } from './provider.js'; +export { ActionBuilder } from './action.js'; diff --git a/wallets/core/src/builders/namespace.ts b/wallets/core/src/builders/namespace.ts new file mode 100644 index 0000000000..aeb3e8ae9f --- /dev/null +++ b/wallets/core/src/builders/namespace.ts @@ -0,0 +1,229 @@ +import type { ActionByBuilder } from './action.js'; +import type { ProxiedNamespace } from './types.js'; +import type { Actions, ActionsMap, Context } from '../hub/namespaces/mod.js'; +import type { NamespaceConfig } from '../hub/store/mod.js'; +import type { FunctionWithContext } from '../types/actions.js'; + +import { Namespace } from '../hub/mod.js'; + +/** + * There are Namespace's methods that should be called directly on Proxy object. + * The Proxy object is creating in `.build`. + */ +export const allowedMethods = [ + 'init', + 'state', + 'after', + 'before', + 'and_then', + 'or_else', + 'store', +] as const; + +export class NamespaceBuilder> { + #id: string; + #providerId: string; + #actions: ActionsMap = new Map(); + /* + * We keep a list of `ActionBuilder` outputs here to use them in separate phases. + * Actually, `ActionBuilder` is packing action and its hooks in one place, here we should expand them and them in appropriate places. + * Eventually, action will be added to `#actions` and its hooks will be added to `Namespace`. + */ + #actionBuilders: ActionByBuilder>[] = []; + #configs: NamespaceConfig; + + constructor(id: string, providerId: string) { + this.#id = id; + this.#providerId = providerId; + this.#configs = {}; + } + + /** There are some predefined configs that can be set for each namespace separately */ + public config( + name: K, + value: NamespaceConfig[K] + ) { + this.#configs[name] = value; + return this; + } + + /** + * Getting a list of actions. + * + * e.g.: + * ```ts + * .action([ + * ["connect", () => {}], + * ["disconnect", () => {}] + * ]) + * ``` + * + */ + public action( + action: (readonly [K, FunctionWithContext>])[] + ): NamespaceBuilder; + + /** + * + * Add a single action + * + * e.g.: + * ```ts + * .action( ["connect", () => {}] ) + * ``` + */ + public action( + action: K, + actionFn: FunctionWithContext> + ): NamespaceBuilder; + + public action(action: ActionByBuilder>): NamespaceBuilder; + + /** + * + * Actions are piece of functionality that a namespace can have, for example it can be a `connect` function + * or a sign function or even a function for updating namespace's internal state. Actions are flexible and can be anything. + * + * Generally, each standard namespace (e.g. evm) has an standard interface defined in `src/namespaces/` + * and provider (which includes namespaces) authors will implement those actions. + * + * You can call this function by a list of actions or a single action. + * + */ + public action( + action: (readonly [K, FunctionWithContext>])[] | K, + actionFn?: FunctionWithContext> + ) { + // List mode + if (Array.isArray(action)) { + action.forEach(([name, actionFnForItem]) => { + this.#actions.set(name, actionFnForItem); + }); + return this; + } + + // Action builder mode + + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + if (typeof action === 'object' && !!action?.actionName) { + this.#actionBuilders.push(action); + return this; + } + + // Single action mode + if (!!actionFn) { + this.#actions.set(action, actionFn); + } + + return this; + } + + /** + * By calling build, an instance of Namespace will be built. + * + * Note: it's not exactly a `Namespace`, it returns a Proxy which add more convenient use like `namespace.connect()` instead of `namespace.run("connect")` + */ + public build(): ProxiedNamespace { + if (this.#isConfigsValid(this.#configs)) { + return this.#buildApi(this.#configs); + } + + throw new Error(`You namespace config isn't valid.`); + } + + // Currently, namespace doesn't has any config. + #isConfigsValid(_config: NamespaceConfig): boolean { + return true; + } + + /* + * Extracting hooks and add them to `Namespace` for the action. + * + * Note: this should be called after `addActionsFromActionBuilders` to ensure the action is added first. + */ + #addHooksFromActionBuilders(namespace: Namespace) { + this.#actionBuilders.forEach((actionByBuild) => { + actionByBuild.after.forEach((afterHooks) => { + afterHooks.map((action) => { + namespace.after(actionByBuild.actionName, action); + }); + }); + + actionByBuild.before.forEach((beforeHooks) => { + beforeHooks.map((action) => { + namespace.before(actionByBuild.actionName, action); + }); + }); + + actionByBuild.and.forEach((andHooks) => { + andHooks.map((action) => { + namespace.and_then(actionByBuild.actionName, action); + }); + }); + + actionByBuild.or.forEach((orHooks) => { + orHooks.map((action) => { + namespace.or_else(actionByBuild.actionName, action); + }); + }); + }); + } + + /** + * Iterate over `actionBuilders` and add them to exists `actions`. + * Note: Hooks will be added in a separate phase. + */ + #addActionsFromActionBuilders() { + this.#actionBuilders.forEach((actionByBuild) => { + this.#actions.set(actionByBuild.actionName, actionByBuild.action); + }); + } + + /** + * Build a Proxy object to call actions in a more convenient way. e.g `.connect()` instead of `.run(connect)` + */ + #buildApi(configs: NamespaceConfig): ProxiedNamespace { + this.#addActionsFromActionBuilders(); + const namespace = new Namespace(this.#id, this.#providerId, { + configs, + actions: this.#actions, + }); + this.#addHooksFromActionBuilders(namespace); + + const api = new Proxy(namespace, { + get: (_, property) => { + if (typeof property !== 'string') { + throw new Error( + 'You can use string as your property on Namespace instance.' + ); + } + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore-next-line + const targetValue = namespace[property]; + + if ( + allowedMethods.includes(property as (typeof allowedMethods)[number]) + ) { + return targetValue.bind(namespace); + } + + /* + * This is useful accessing values like `version`, If we don't do this, we should whitelist + * All the values as well, So it can be confusing for someone that only wants to add a public value to `Namespace` + */ + const allowedPublicValues = ['string', 'number']; + if (allowedPublicValues.includes(typeof targetValue)) { + return targetValue; + } + + return namespace.run.bind(namespace, property as keyof T); + }, + set: () => { + throw new Error('You can not set anything on this object.'); + }, + }); + + return api as unknown as ProxiedNamespace; + } +} diff --git a/wallets/core/src/builders/provider.ts b/wallets/core/src/builders/provider.ts new file mode 100644 index 0000000000..0e6646c05a --- /dev/null +++ b/wallets/core/src/builders/provider.ts @@ -0,0 +1,61 @@ +import type { FindProxiedNamespace } from './types.js'; +import type { + CommonNamespaces, + ExtendableInternalActions, + ProviderBuilderOptions, +} from '../hub/provider/mod.js'; +import type { ProviderConfig } from '../hub/store/mod.js'; + +import { Provider } from '../hub/provider/mod.js'; + +export class ProviderBuilder { + #id: string; + #namespaces = new Map(); + #methods: ExtendableInternalActions = {}; + #configs: Partial = {}; + #options: Partial; + + constructor(id: string, options?: ProviderBuilderOptions) { + this.#id = id; + this.#options = options || {}; + } + + public add( + id: K, + namespace: FindProxiedNamespace + ) { + if (this.#options.store) { + namespace.store(this.#options.store); + } + this.#namespaces.set(id, namespace); + return this; + } + + public config( + name: K, + value: ProviderConfig[K] + ) { + this.#configs[name] = value; + return this; + } + + public init(cb: Exclude) { + this.#methods.init = cb; + return this; + } + + public build(): Provider { + if (this.#isConfigsValid(this.#configs)) { + return new Provider(this.#id, this.#namespaces, this.#configs, { + extendInternalActions: this.#methods, + store: this.#options.store, + }); + } + + throw new Error('You need to set all required configs.'); + } + + #isConfigsValid(config: Partial): config is ProviderConfig { + return !!config.info; + } +} diff --git a/wallets/core/src/builders/types.ts b/wallets/core/src/builders/types.ts new file mode 100644 index 0000000000..a70cf9fc04 --- /dev/null +++ b/wallets/core/src/builders/types.ts @@ -0,0 +1,29 @@ +import type { allowedMethods } from './namespace.js'; +import type { Actions, Namespace } from '../hub/namespaces/mod.js'; + +// These should be matched with `/hub/namespace.ts` public values. +type NamespacePublicValues = { + namespaceId: string; + providerId: string; +}; + +/** + * NamespaceBuilder is creating a proxy instead of return Namespace instance. + * The reason is improving access to actions. e.g `.connect()` instead of `.run('connect')` + */ +export type ProxiedNamespace> = T & + Pick, (typeof allowedMethods)[number]> & + NamespacePublicValues; + +/** + * This is useful when you gave a list of namespaces and want to map a key to corresponding namespace. + * + * e.g: + * Type List = { evm: EvmActions, solana: SolanaActions}; + * FindProxiedNamespace<"solana", List> + */ +export type FindProxiedNamespace = T[K] extends Actions< + T[K] +> + ? ProxiedNamespace + : never; diff --git a/wallets/core/src/hub/helpers.ts b/wallets/core/src/hub/helpers.ts new file mode 100644 index 0000000000..f0c0dfc9a8 --- /dev/null +++ b/wallets/core/src/hub/helpers.ts @@ -0,0 +1,11 @@ +/** + * Note: This only works native async, if we are going to support for old transpilers like Babel. + */ +// eslint-disable-next-line @typescript-eslint/ban-types +export function isAsync(fn: Function) { + return fn.constructor.name === 'AsyncFunction'; +} + +export function generateStoreId(providerId: string, namespace: string) { + return `${providerId}$$${namespace}`; +} diff --git a/wallets/core/src/hub/hub.ts b/wallets/core/src/hub/hub.ts new file mode 100644 index 0000000000..760dab26c0 --- /dev/null +++ b/wallets/core/src/hub/hub.ts @@ -0,0 +1,122 @@ +import type { Namespace, State as NamespaceState } from './namespaces/mod.js'; +import type { Provider, State as ProviderState } from './provider/mod.js'; +import type { Store } from './store/mod.js'; + +type HubState = { + [key in string]: ProviderState & { + namespaces: NamespaceState[]; + }; +}; + +type RunAllResult = { + id: string; + provider: unknown; + namespaces: unknown[]; +}; + +interface HubOptions { + store?: Store; +} +export class Hub { + #providers = new Map(); + #options: HubOptions; + + constructor(options?: HubOptions) { + this.#options = options ?? {}; + /* + * TODO: + * config: + * isEagerConnectEnabled? (warning if explicitly calls eagerConnect) + * + */ + this.init(); + } + + init() { + this.runAll('init'); + } + + /* + * Running a specific action (e.g. init) on all namespaces and providers one by one. + * + * TODO: Some of methods may accepts args, with this implementation we only limit to those one without any argument. + */ + runAll(action: string): RunAllResult[] { + const output: RunAllResult[] = []; + + // run action on all providers eagerConnect, disconnect + const providers = this.#providers.values(); + + for (const provider of providers) { + // Calling `action` on `Provider` if exists. + const providerOutput: RunAllResult = { + id: provider.id, + provider: undefined, + namespaces: [], + }; + + const providerMethod = provider[action as keyof Provider]; + if (typeof providerMethod === 'function') { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore-next-line + providerOutput.provider = providerMethod.call(provider); + } + + // Namespace instances can have their own `action` as well. we will call them as well. + const namespaces = provider.getAll().values(); + for (const namespace of namespaces) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore-next-line + const namespaceMethod = namespace[action]; + if (typeof namespaceMethod === 'function') { + const result = namespaceMethod(); + providerOutput.namespaces.push(result); + } + } + + output.push(providerOutput); + } + + return output; + } + + add(id: string, provider: Provider) { + if (this.#options.store) { + provider.store(this.#options.store); + } + this.#providers.set(id, provider); + return this; + } + + get(providerId: string): Provider | undefined { + return this.#providers.get(providerId); + } + + getAll() { + return this.#providers; + } + + state(): HubState { + const output = this.runAll('state'); + const res: HubState = {}; + + output.forEach((result) => { + const namespaces: NamespaceState[] = []; + result.namespaces.forEach((b) => { + const [getNamespaceState] = b as ReturnType['state']>; + + namespaces.push(getNamespaceState()); + }); + + const [getProviderState] = result.provider as ReturnType< + Provider['state'] + >; + + res[result.id] = { + ...(getProviderState() || {}), + namespaces: namespaces, + }; + }); + return res; + } +} diff --git a/wallets/core/src/hub/mod.ts b/wallets/core/src/hub/mod.ts new file mode 100644 index 0000000000..0845450dc9 --- /dev/null +++ b/wallets/core/src/hub/mod.ts @@ -0,0 +1,10 @@ +export { Namespace } from './namespaces/mod.js'; +export { Provider } from './provider/mod.js'; +export { Hub } from './hub.js'; +export type { Store, State, ProviderInfo } from './store/mod.js'; +export { + createStore, + guessProviderStateSelector, + namespaceStateSelector, +} from './store/mod.js'; +export { generateStoreId } from './helpers.js'; diff --git a/wallets/core/src/hub/namespaces/errors.ts b/wallets/core/src/hub/namespaces/errors.ts new file mode 100644 index 0000000000..dba48628ea --- /dev/null +++ b/wallets/core/src/hub/namespaces/errors.ts @@ -0,0 +1,8 @@ +export const ACTION_NOT_FOUND_ERROR = (name: string) => + `Couldn't find "${name}" action. Are you sure you've added the action?`; + +export const OR_ELSE_ACTION_FAILED_ERROR = (name: string) => + `An error occurred during running ${name}`; + +export const NO_STORE_FOUND_ERROR = + 'For setup store, you should set `store` first.'; diff --git a/wallets/core/src/hub/namespaces/mod.ts b/wallets/core/src/hub/namespaces/mod.ts new file mode 100644 index 0000000000..0e7f4d1a39 --- /dev/null +++ b/wallets/core/src/hub/namespaces/mod.ts @@ -0,0 +1,9 @@ +export type { + Subscriber, + State, + RegisteredActions as ActionsMap, + Context, + Actions, +} from './types.js'; + +export { Namespace } from './namespace.js'; diff --git a/wallets/core/src/hub/namespaces/namespace.test.ts b/wallets/core/src/hub/namespaces/namespace.test.ts new file mode 100644 index 0000000000..e779faca82 --- /dev/null +++ b/wallets/core/src/hub/namespaces/namespace.test.ts @@ -0,0 +1,333 @@ +import { describe, expect, test, vi } from 'vitest'; + +import { createStore } from '../mod.js'; + +import { OR_ELSE_ACTION_FAILED_ERROR } from './errors.js'; +import { Namespace } from './namespace.js'; + +interface TestNamespaceActions { + connect: () => void; + disconnect: () => void; +} + +describe('check initializing Namespace', () => { + const NAMESPACE = 'evm'; + const PROVIDER_ID = 'garbage provider'; + + test('initialize a namespace and run an action', () => { + const connect = vi.fn(); + const disconnect = vi.fn(); + const actions = new Map(); + actions.set('connect', connect); + actions.set('disconnect', disconnect); + + const ns = new Namespace(NAMESPACE, PROVIDER_ID, { + actions: actions, + }); + + ns.run('connect'); + + expect(disconnect).toBeCalledTimes(0); + expect(connect).toBeCalledTimes(1); + }); + + test('init action should be called once', () => { + const connect = vi.fn(); + const disconnect = vi.fn(); + const init = vi.fn(); + const actions = new Map(); + actions.set('connect', connect); + actions.set('disconnect', disconnect); + actions.set('init', init); + + const ns = new Namespace(NAMESPACE, PROVIDER_ID, { + actions: actions, + }); + + expect(init).toBeCalledTimes(0); + + ns.run('connect'); + ns.init(); + ns.init(); + + expect(disconnect).toBeCalledTimes(0); + expect(connect).toBeCalledTimes(1); + expect(init).toBeCalledTimes(1); + }); + + test('state should be updated and actions have access to them', () => { + const connect = vi.fn((context) => { + const [, setState] = context.state(); + setState('connected', true); + }); + const init = vi.fn((context) => { + const [, setState] = context.state(); + setState('connecting', true); + }); + const actions = new Map(); + actions.set('connect', connect); + actions.set('init', init); + + const store = createStore(); + const ns = new Namespace(NAMESPACE, PROVIDER_ID, { + actions: actions, + store, + }); + + ns.run('connect'); + ns.init(); + ns.init(); + + const [currentState] = ns.state(); + expect(currentState().connected).toBe(true); + expect(currentState('connecting')).toBe(true); + }); + + test("throw an error if store doesn't set", () => { + const ns = new Namespace(NAMESPACE, PROVIDER_ID, { + actions: new Map(), + }); + + expect(() => ns.state()).toThrowError(); + }); +}); + +describe('check actions with hooks and operators', () => { + const NAMESPACE = 'bip122'; + const PROVIDER_ID = 'garbage provider'; + + test('add actions and run them.', () => { + const actions = new Map(); + actions.set('hello', () => 'hello world'); + actions.set('bye', () => 'bye bye'); + actions.set('chainable', () => "it's also chainable"); + actions.set('chain2', () => "it's also chainable"); + + const ns = new Namespace<{ + hello: () => string; + bye: () => string; + chainable: () => void; + chain2: () => void; + }>(NAMESPACE, PROVIDER_ID, { actions }); + + expect(ns.run('hello')).toBe('hello world'); + expect(ns.run('bye')).toBe('bye bye'); + + expect(() => { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore-next-line + return ns.run('some_action_name_that_has_not_added'); + }).toThrowError(); + }); + + test('should be called before/after target action correctly even with multiple hook assigned to an action name', () => { + const beforeAction = vi.fn(); + const anotherBeforeAction = vi.fn(); + const afterAction = vi.fn(); + const anotherAfterAction = vi.fn(); + const connectAction = vi.fn(); + const disconnectAction = vi.fn(); + + const actions = new Map(); + actions.set('connect', connectAction); + actions.set('disconnect', disconnectAction); + + const ns = new Namespace(NAMESPACE, PROVIDER_ID, { + actions, + }); + + ns.run('connect'); + expect(connectAction).toBeCalledTimes(1); + expect(beforeAction).toBeCalledTimes(0); + expect(anotherBeforeAction).toBeCalledTimes(0); + expect(afterAction).toBeCalledTimes(0); + expect(anotherAfterAction).toBeCalledTimes(0); + + ns.before('connect', beforeAction); + ns.before('connect', anotherBeforeAction); + ns.run('connect'); + expect(connectAction).toBeCalledTimes(2); + expect(beforeAction).toBeCalledTimes(1); + expect(anotherBeforeAction).toBeCalledTimes(1); + expect(afterAction).toBeCalledTimes(0); + expect(anotherAfterAction).toBeCalledTimes(0); + + ns.after('connect', afterAction); + ns.after('connect', anotherAfterAction); + ns.run('connect'); + expect(beforeAction).toBeCalledTimes(2); + expect(anotherBeforeAction).toBeCalledTimes(2); + expect(afterAction).toBeCalledTimes(1); + expect(anotherAfterAction).toBeCalledTimes(1); + }); + + test('should call `and_then` sequentially.', () => { + const andActionFirst = vi.fn((_ctx, result) => result + 1); + const andActionSecond = vi.fn((_ctx, result) => result + 1); + + const connectAction = vi.fn(() => 0); + const disconnectAction = vi.fn(); + + const actions = new Map(); + actions.set('connect', connectAction); + actions.set('disconnect', disconnectAction); + + const ns = new Namespace(NAMESPACE, PROVIDER_ID, { + actions: actions, + }); + ns.and_then('connect', andActionFirst); + ns.and_then('connect', andActionSecond); + + const result = ns.run('connect'); + + expect(connectAction).toBeCalledTimes(1); + expect(andActionFirst).toBeCalledTimes(1); + expect(andActionSecond).toBeCalledTimes(1); + + expect(result).toBe(2); + + ns.run('connect'); + expect(connectAction).toBeCalledTimes(2); + expect(andActionFirst).toBeCalledTimes(2); + expect(andActionSecond).toBeCalledTimes(2); + }); + + test("shouldn't run other `and_then` hooks if one of them fails then fallback to `or_else`.", () => { + const andActionFirst = vi.fn((_ctx, _result) => { + throw new Error('Oops!'); + }); + const andActionSecond = vi.fn((_ctx, result) => result + 1); + + const orAction = vi.fn((_ctx, e) => e instanceof Error); + + const connectAction = vi.fn(() => 0); + const actions = new Map(); + actions.set('connect', connectAction); + + const ns = new Namespace<{ + connect: () => void; + }>(NAMESPACE, PROVIDER_ID, { + actions: actions, + configs: {}, + }); + ns.and_then('connect', andActionFirst); + ns.and_then('connect', andActionSecond); + + ns.or_else('connect', orAction); + + const result = ns.run('connect'); + + expect(connectAction).toBeCalledTimes(1); + expect(andActionFirst).toBeCalledTimes(1); + expect(andActionSecond).toBeCalledTimes(0); + expect(orAction).toBeCalledTimes(1); + expect(result).toBe(true); + }); + + test('should throw error if there are no `or` to handle error', () => { + const andActionFirst = vi.fn((_ctx, _result) => { + throw new Error('Oops!'); + }); + const andActionSecond = vi.fn((_ctx, result) => result + 1); + + const connectAction = vi.fn(() => 0); + const actions = new Map(); + actions.set('connect', connectAction); + + const ns = new Namespace<{ + connect: () => void; + }>(NAMESPACE, PROVIDER_ID, { + actions: actions, + configs: {}, + }); + + ns.and_then('connect', andActionFirst); + ns.and_then('connect', andActionSecond); + + expect(() => ns.run('connect')).toThrowError(); + }); + + test('ensure `or_else` has access to error', () => { + const actions = new Map(); + actions.set('connect', () => { + throw new Error('Oops!'); + }); + + const ns = new Namespace<{ + connect: () => void; + }>(NAMESPACE, PROVIDER_ID, { + actions: actions, + configs: {}, + }); + + ns.or_else('connect', (_ctx: any, err: any) => { + return err instanceof Error; + }); + + const result = ns.run('connect'); + expect(result).toBe(true); + }); + + test('should call `or_else` sequentially.', () => { + const orActionFirst = vi.fn((_ctx, _err) => 1); + const orActionSecond = vi.fn((_ctx, _err) => _err + 1); + + const connectAction = vi.fn(() => { + throw new Error('Oops!'); + }); + + const actions = new Map(); + actions.set('connect', connectAction); + + const ns = new Namespace<{ + connect: () => void; + }>(NAMESPACE, PROVIDER_ID, { + actions: actions, + }); + + ns.or_else('connect', orActionFirst); + ns.or_else('connect', orActionSecond); + + const result = ns.run('connect'); + + expect(connectAction).toBeCalledTimes(1); + expect(orActionFirst).toBeCalledTimes(1); + expect(orActionSecond).toBeCalledTimes(1); + + expect(result).toBe(2); + + ns.run('connect'); + expect(connectAction).toBeCalledTimes(2); + expect(orActionFirst).toBeCalledTimes(2); + expect(orActionSecond).toBeCalledTimes(2); + }); + test('throw error if `or_else` itself failed to run.', () => { + const orActionFirst = vi.fn((_ctx, _err) => 1); + const orActionSecond = vi.fn((_ctx, _err) => { + throw new Error('This is actually a bad situation'); + }); + + const connectAction = vi.fn(() => { + throw new Error('Oops!'); + }); + + const actions = new Map(); + actions.set('connect', connectAction); + + const ns = new Namespace<{ + connect: () => void; + }>(NAMESPACE, PROVIDER_ID, { + actions: actions, + }); + + ns.or_else('connect', orActionFirst); + ns.or_else('connect', orActionSecond); + + expect(() => { + ns.run('connect'); + }).toThrowError(OR_ELSE_ACTION_FAILED_ERROR('connect')); + expect(orActionFirst).toBeCalledTimes(1); + expect(connectAction).toBeCalledTimes(1); + expect(orActionSecond).toBeCalledTimes(1); + }); +}); diff --git a/wallets/core/src/hub/namespaces/namespace.ts b/wallets/core/src/hub/namespaces/namespace.ts new file mode 100644 index 0000000000..00923bed65 --- /dev/null +++ b/wallets/core/src/hub/namespaces/namespace.ts @@ -0,0 +1,443 @@ +import type { + Actions, + Context, + GetState, + HooksWithOptions, + Operators, + RegisteredActions, + SetState, + State, +} from './types.js'; +import type { + AndFunction, + AnyFunction, + FunctionWithContext, +} from '../../types/actions.js'; +import type { NamespaceConfig, Store } from '../store/mod.js'; + +import { generateStoreId, isAsync } from '../helpers.js'; + +import { + ACTION_NOT_FOUND_ERROR, + NO_STORE_FOUND_ERROR, + OR_ELSE_ACTION_FAILED_ERROR, +} from './errors.js'; + +/** + * + * A Namespace is a unit of wallets where usually handles connecting, signing, accounts, ... + * It will be injected by wallet in its object, for example, `window.phantom.ethereum` or `window.phantom.solana` + * Each namespace (like solana) has its own functionality which is not shared between all the blockchains. + * For example in EVM namespaces, you can have different networks (e.g. Ethereum,Polygon, ...) and there are specific flows to handle connecting to them or add a network and etc. + * But Solana doesn't have this concept and you will directly always connect to solana itself. + * This is true for signing a transaction, getting information about blockchain and more. + * So by creating a namespace for each of these, we can define a custom namespace based on blockchain's properties. + * + */ +class Namespace> { + /** it will be used for `store` and accessing to store by its id mainly. */ + public readonly namespaceId: string; + /** it will be used for `store` and accessing to store by its id mainly. */ + public readonly providerId: string; + + #actions: RegisteredActions; + #andOperators: Operators = new Map(); + #orOperators: Operators = new Map(); + // `context` for these two can be Namespace context or Provider context + #beforeHooks: HooksWithOptions = new Map(); + #afterHooks: HooksWithOptions = new Map(); + + #initiated = false; + #store: Store | undefined; + // Namespace doesn't has any configs now, but we will need the feature in future + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore noUnusedParameters + #configs: NamespaceConfig; + + constructor( + id: string, + providerId: string, + options: { + store?: Store; + configs?: NamespaceConfig; + actions: RegisteredActions; + } + ) { + const { configs, actions } = options; + + this.namespaceId = id; + this.providerId = providerId; + + this.#configs = configs || new Map(); + this.#actions = actions; + + if (options.store) { + this.store(options.store); + } + } + + /** + * This is an special action that will be called **only once**. + * We don't call this in `constructor` and developer should call this manually. we only ensure it will be called once. + * + * ```ts + * const myInit = () => { whatever; } + * const actions = new Map(); + * actions.set("init", myInit) + * const ns = new Namespace(..., {actions}); + * + * // Will run `myInit` + * ns.init() + * + * // Will not run `myInit` anymore. + * ns.init() + * ns.init() + * ``` + */ + public init(): void { + if (this.#initiated) { + return; + } + + const definedInitByUser = this.#actions.get('init'); + + if (definedInitByUser) { + definedInitByUser(this.#context()); + } + // else, this namespace doesn't have any `init` implemented. + + this.#initiated = true; + } + + /** + * Reading states from store and also update them. + * + * @example + * ```ts + * const ns = new Namespace(...); + * const [getState, setState] = ns.state(); + * ``` + */ + public state(): [GetState, SetState] { + const store = this.#store; + if (!store) { + throw new Error( + 'You need to set your store using `.store` method first.' + ); + } + + const id = this.#storeId(); + const setState: SetState = (name, value) => { + store.getState().namespaces.updateStatus(id, name, value); + }; + + const getState: GetState = (name?: K) => { + const state: State = store.getState().namespaces.getNamespaceData(id); + + if (!name) { + return state; + } + + return state[name]; + }; + + return [getState, setState]; + } + + /** + * For keeping state, we need a store. all the states will be write to/read from store. + * + * Note: Store can be setup on constructor as well. + * + * @example + * ```ts + * const myStore = createStore(); + * const ns = new Namespace(...); + * ns.store(myStore); + * ``` + */ + public store(store: Store): this { + if (this.#store) { + console.warn( + "You've already set an store for your Namespace. Old store will be replaced by the new one." + ); + } + this.#store = store; + this.#setupStore(); + + return this; + } + + /** + * It's a boolean operator to run a sync function if action ran successfully. + * For example, if we have a `connect` action, we can add function to be run after `connect` if it ran successfully. + * + * @example + * ```ts + * const ns = new Namespace(..); + * + * ns.and_then('connect', (context) => { + * ... + * }); + * ``` + * + */ + public and_then( + actionName: K, + operatorFn: FunctionWithContext, Context> + ): this { + const currentAndOperators = this.#andOperators.get(actionName) || []; + this.#andOperators.set(actionName, currentAndOperators.concat(operatorFn)); + + return this; + } + + /** + * It's a boolean operator to run a function to handle when an action fails. + * For example, if we have a `connect` action, we can add function to be run when `connect` fails (throw an error). + * + * @example + * ```ts + * const ns = new Namespace(..); + * + * ns.or_else('connect', (context, error) => { + * ... + * }); + * ``` + */ + public or_else( + actionName: K, + operatorFn: FunctionWithContext + ): this { + const currentOrOperators = this.#orOperators.get(actionName) || []; + this.#orOperators.set(actionName, currentOrOperators.concat(operatorFn)); + + return this; + } + + /** + * Running a function after a specific action + * + * Note: the context can be set from outside as well. this is useful for Provider to set its context instead of namespace context. + * + * @example + * ```ts + * const ns = new Namespace(...); + * + * ns.after("connect", (context) => {}); + * ``` + */ + public after( + actionName: K, + hook: FunctionWithContext, + options?: { context?: C } + ): this { + const currentAfterHooks = this.#afterHooks.get(actionName) || []; + const hookWithOptions = { + hook, + options: { + context: options?.context, + }, + }; + + this.#afterHooks.set(actionName, currentAfterHooks.concat(hookWithOptions)); + return this; + } + + /** + * Running a function before a specific action + * + * Note: the context can be set from outside as well. this is useful for Provider to set its context instead of using namespace context. + * + * @example + * ```ts + * const ns = new Namespace(...); + * + * ns.before("connect", (context) => {}); + * ``` + */ + public before( + actionName: K, + hook: FunctionWithContext, + options?: { context?: C } + ): this { + const currentBeforeHooks = this.#beforeHooks.get(actionName) || []; + const hookWithOptions = { + hook, + options: { + context: options?.context, + }, + }; + this.#beforeHooks.set( + actionName, + currentBeforeHooks.concat(hookWithOptions) + ); + + return this; + } + + /** + * + * Registered actions will be called using `run`. it will run an action and all the operators or hooks that assigned. + * + * @example + * ```ts + * const actions = new Map(); + * actions.set('connect', connectAction); + * + * const ns = new Namespace(NAMESPACE, PROVIDER_ID, { + * actions: actions, + * }); + * + * ns.run("action"); + * ``` + */ + public run( + actionName: K, + ...args: any[] + ): unknown | Promise { + const action = this.#actions.get(actionName); + if (!action) { + throw new Error(ACTION_NOT_FOUND_ERROR(actionName.toString())); + } + + /* + * Action can be both, sync or async. To simplify the process we can not make `sync` mode to async + * Since every user's sync action will be an async function and affect what user expect, + * it makes all the actions async and it doesn't match with Namespace interface (e.g. EvmActions) + * + * To avoid this issue and also not duplicating code, I broke the process into smaller methods + * and two main methods to run actions: tryRunAsyncAction & tryRunAction. + */ + const result = isAsync(action) + ? this.#tryRunAsyncAction(actionName, args) + : this.#tryRunAction(actionName, args); + + return result; + } + + #tryRunAction(actionName: K, params: any[]): unknown { + this.#tryRunBeforeHooks(actionName); + + const action = this.#actions.get(actionName); + if (!action) { + throw new Error(ACTION_NOT_FOUND_ERROR(actionName.toString())); + } + + const context = this.#context(); + + let result; + try { + result = action(context, ...params); + result = this.#tryRunAndOperators(actionName, result); + } catch (e) { + result = this.#tryRunOrOperators(actionName, e); + } finally { + this.#tryRunAfterHooks(actionName); + } + + return result; + } + + async #tryRunAsyncAction( + actionName: K, + params: any[] + ): Promise { + this.#tryRunBeforeHooks(actionName); + + const action = this.#actions.get(actionName); + if (!action) { + throw new Error(ACTION_NOT_FOUND_ERROR(actionName.toString())); + } + + const context = this.#context(); + return await action(context, ...params) + .then((result: unknown) => this.#tryRunAndOperators(actionName, result)) + .catch((e: unknown) => this.#tryRunOrOperators(actionName, e)) + .finally(() => this.#tryRunAfterHooks(actionName)); + } + + #tryRunAfterHooks(actionName: K) { + const afterActions = this.#afterHooks.get(actionName); + + if (afterActions) { + afterActions.forEach((afterAction) => { + const context = afterAction.options?.context || this.#context(); + afterAction.hook(context); + }); + } + } + + #tryRunBeforeHooks(actionName: K): void { + const beforeActions = this.#beforeHooks.get(actionName); + if (beforeActions) { + beforeActions.forEach((beforeAction) => { + const context = beforeAction.options?.context || this.#context(); + beforeAction.hook(context); + }); + } + } + + #tryRunAndOperators( + actionName: K, + result: unknown + ): unknown { + const andActions = this.#andOperators.get(actionName); + + if (andActions) { + const context = this.#context(); + result = andActions.reduce((prev, andAction) => { + return andAction(context, prev); + }, result); + } + return result; + } + + #tryRunOrOperators( + actionName: K, + actionError: unknown + ): unknown { + const orActions = this.#orOperators.get(actionName); + + if (orActions) { + try { + const context = this.#context(); + return orActions.reduce((prev, orAction) => { + return orAction(context, prev); + }, actionError); + } catch (orError) { + throw new Error(OR_ELSE_ACTION_FAILED_ERROR(actionName.toString()), { + cause: actionError, + }); + } + } else { + throw actionError; + } + } + + #setupStore(): void { + const store = this.#store; + if (!store) { + throw new Error(NO_STORE_FOUND_ERROR); + } + + const id = this.#storeId(); + store.getState().namespaces.addNamespace(id, { + namespaceId: this.namespaceId, + providerId: this.providerId, + }); + } + + #storeId() { + return generateStoreId(this.providerId, this.namespaceId); + } + + #context(): Context { + return { + state: this.state.bind(this), + action: this.run.bind(this), + }; + } +} + +export { Namespace }; diff --git a/wallets/core/src/hub/namespaces/types.ts b/wallets/core/src/hub/namespaces/types.ts new file mode 100644 index 0000000000..7d4df3f1df --- /dev/null +++ b/wallets/core/src/hub/namespaces/types.ts @@ -0,0 +1,50 @@ +import type { AnyFunction, FunctionWithContext } from '../../types/actions.js'; +import type { NamespaceData } from '../store/mod.js'; + +type ActionName = K | Omit; + +export type Subscriber> = ( + context: Context, + ...args: any[] +) => void; +export type SubscriberCleanUp> = ( + context: Context, + ...args: any[] +) => void; +export type State = NamespaceData; +export type SetState = ( + name: K, + value: State[K] +) => void; +export type GetState = { + (): State; + (name: K): State[K]; +}; +export type RegisteredActions> = Map< + ActionName, + FunctionWithContext> +>; + +export type AndUseActions = Map; +export type Operators = Map; +export type HooksWithOptions = Map< + keyof T, + { + hook: AnyFunction; + options?: { + context?: unknown; + }; + }[] +>; +export type Context = object> = { + state: () => [GetState, SetState]; + action: (name: keyof T, ...args: any[]) => any; +}; + +/** + * This actually define what kind of action will be implemented in namespaces. + * For example evm namespace will have .connect(chain: string) and .switchNetwork + * But solana namespace only have: `.connect()`. + * This actions will be passed to this generic. + */ +export type Actions = Record; diff --git a/wallets/core/src/hub/provider/mod.ts b/wallets/core/src/hub/provider/mod.ts new file mode 100644 index 0000000000..92da36f4d7 --- /dev/null +++ b/wallets/core/src/hub/provider/mod.ts @@ -0,0 +1,9 @@ +export type { + ExtendableInternalActions, + CommonNamespaces, + State, + Context, + ProviderBuilderOptions, +} from './types.js'; + +export { Provider } from './provider.js'; diff --git a/wallets/core/src/hub/provider/provider.test.ts b/wallets/core/src/hub/provider/provider.test.ts new file mode 100644 index 0000000000..013e21389a --- /dev/null +++ b/wallets/core/src/hub/provider/provider.test.ts @@ -0,0 +1,231 @@ +import type { EvmActions } from '../../namespaces/evm/types.js'; +import type { SolanaActions } from '../../namespaces/solana/types.js'; +import type { Store } from '../store/mod.js'; + +import { beforeEach, describe, expect, test, vi } from 'vitest'; + +import { NamespaceBuilder } from '../../builders/namespace.js'; +import { ProviderBuilder } from '../../builders/provider.js'; +import { garbageWalletInfo } from '../../test-utils/fixtures.js'; +import { createStore } from '../store/mod.js'; + +import { Provider } from './provider.js'; + +describe('check providers', () => { + let namespaces: { + evm: NamespaceBuilder; + solana: NamespaceBuilder; + }; + let namespacesMap: Map; + let store: Store; + + beforeEach(() => { + store = createStore(); + const evmNamespace = new NamespaceBuilder('eip155', 'garbage'); + const solanaNamespace = new NamespaceBuilder( + 'solana', + 'garbage' + ); + + namespaces = { + evm: evmNamespace, + solana: solanaNamespace, + }; + + namespacesMap = new Map(); + namespacesMap.set('evm', evmNamespace.build()); + namespacesMap.set('solana', solanaNamespace.build()); + + return () => { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore-next-line + (store = undefined), (namespaces = undefined); + }; + }); + + test('Initialize providers correctly', () => { + const provider = new Provider('garbage', namespacesMap, { + info: garbageWalletInfo, + }); + + const allNamespaces = provider.getAll(); + + expect(allNamespaces.size).toBe(2); + }); + + test("throw an error if store hasn't set and try to access .state() and .info()", () => { + const provider = new Provider('garbage', namespacesMap, { + info: garbageWalletInfo, + }); + + expect(() => provider.state()).toThrowError(); + expect(() => provider.info()).toThrowError(); + }); + + test('access state correctly', () => { + const provider = new Provider( + 'garbage', + namespacesMap, + { + info: garbageWalletInfo, + }, + { + store: createStore(), + } + ); + + const [getState, setState] = provider.state(); + + expect(getState().connected).toBe(false); + expect(getState('connected')).toBe(false); + expect(() => { + // @ts-expect-error intentionally using an state that doesn't exist. + getState('not_exist_state'); + }).toThrowError(); + expect(() => { + // @ts-expect-error intentionally using an state that doesn't exist and try to update. + setState('another_not_exist_state'); + }).toThrowError(); + }); + test('update state properly', () => { + const store = createStore(); + const provider = new Provider( + 'garbage', + namespacesMap, + { + info: garbageWalletInfo, + }, + { + store, + } + ); + + const [getState, setState] = provider.state(); + + provider.store(store); + setState('installed', true); + const isInstalled = getState('installed'); + expect(isInstalled).toBe(true); + }); + + test('run namespace actions from provider', async () => { + const { evm, solana } = namespaces; + solana.action('connect', async () => [ + 'solana:mainnet:0x000000000000000000000000000000000000dead', + ]); + const testNamespaces = new Map(); + testNamespaces.set('evm', evm.build()); + testNamespaces.set('solana', solana.build()); + + const provider = new Provider('garbage', testNamespaces, { + info: garbageWalletInfo, + }); + + const result = await provider.get('solana')?.connect(); + + expect(result).toStrictEqual([ + 'solana:mainnet:0x000000000000000000000000000000000000dead', + ]); + // Since we didn't add any action regarding connect for `evm` + await expect(async () => + provider.get('evm')?.connect('0x1') + ).rejects.toThrowError(); + }); + + test('sets config properly', () => { + const builder = new ProviderBuilder('garbage'); + builder.config('info', garbageWalletInfo); + const provider = builder.build().store(store); + + expect(provider.info()).toStrictEqual(garbageWalletInfo); + }); + + test('.init should works on Provider', () => { + const builder = new ProviderBuilder('garbage').config( + 'info', + garbageWalletInfo + ); + let count = 0; + builder.init(() => { + count++; + }); + const provider = builder.build().store(store); + expect(count).toBe(0); + provider.init(); + provider.init(); + provider.init(); + expect(count).toBe(1); + }); + + test(".init shouldn't do anything when use hasn't set anything", () => { + const builder = new ProviderBuilder('garbage').config( + 'info', + garbageWalletInfo + ); + const provider = builder.build().store(store); + expect(() => { + provider.init(); + provider.init(); + provider.init(); + }).not.toThrow(); + }); + + test('A provider can be found using its namespace', () => { + const builder = new ProviderBuilder('garbage', { store }).config( + 'info', + garbageWalletInfo + ); + + const { evm, solana } = namespaces; + builder.add('evm', evm.build()).add('solana', solana.build()); + const provider = builder.build(); + + const result = provider.findByNamespace('solana'); + expect(result).toBeDefined(); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore-next-line + expect(result?.namespaceId).toBe('solana'); + + const result2 = provider.findByNamespace('evm'); + expect(result2).toBeUndefined(); + }); + + test('`before/after` is calling with correct context ', () => { + const connect = vi.fn(); + const before = vi.fn(function (context) { + const [, setState] = context.state(); + setState('installed', true); + }); + const after = vi.fn(function (context) { + const [, setState] = context.state(); + setState('installed', false); + }); + + const { evm } = namespaces; + const evmNamespace = evm.action('connect', connect).build(); + + const builder = new ProviderBuilder('garbage', { store }) + .add('evm', evmNamespace) + .config('info', garbageWalletInfo); + const provider = builder.build(); + + const [getState] = provider.state(); + const result = provider.get('evm'); + + // Adding `after` then make it will run + provider.before('connect', before); + void result?.connect('whatever'); + + expect(connect).toBeCalledTimes(1); + expect(before).toBeCalledTimes(1); + expect(getState('installed')).toBe(true); + + // Adding `after` then make it will run + provider.after('connect', after); + void result?.connect('whatever'); + expect(connect).toBeCalledTimes(2); + expect(after).toBeCalledTimes(1); + + expect(getState('installed')).toBe(false); + }); +}); diff --git a/wallets/core/src/hub/provider/provider.ts b/wallets/core/src/hub/provider/provider.ts new file mode 100644 index 0000000000..7e5f4b873c --- /dev/null +++ b/wallets/core/src/hub/provider/provider.ts @@ -0,0 +1,330 @@ +import type { + CommonNamespaces, + Context, + ExtendableInternalActions, + GetState, + RegisteredNamespaces, + SetState, + State, +} from './types.js'; +import type { FindProxiedNamespace } from '../../builders/mod.js'; +import type { AnyFunction, FunctionWithContext } from '../../types/actions.js'; +import type { ProviderConfig, Store } from '../store/mod.js'; + +const VERSION = '1.0'; + +export class Provider { + public readonly id: string; + public readonly version = VERSION; + + #namespaces: RegisteredNamespaces; + #initiated = false; + #extendInternalActions: ExtendableInternalActions = {}; + #store: Store | undefined; + #configs: ProviderConfig; + + constructor( + id: string, + namespaces: RegisteredNamespaces, + configs: ProviderConfig, + options?: { + /** + * There are some cases we need to have a behavior like initializing a provider which will be run when we are creating an instance. + * These internal steps and behaviors will be useful for library user to extend the behavior by running a specific code. + */ + extendInternalActions?: ExtendableInternalActions; + store?: Store; + } + ) { + this.id = id; + this.#configs = configs; + // it should be only created here, to make sure `after/before` will work properly. + this.#extendInternalActions = options?.extendInternalActions || {}; + this.#namespaces = namespaces; + + if (options?.store) { + this.#store = options.store; + this.#setupStore(); + } + } + + /** + * This is an special callback that will be called **only once**. + * We don't call this in `constructor` and developer should call this manually. we only ensure it will be called once. + * + * ```ts + * const myInit = () => { whatever; } * + * const provider = new Provider(..., {extendInternalActions: {init: myInit} }); + * + * // Will run `myInit` + * provider.init() + * + * // Will not run `myInit` anymore. + * provider.init() + * provider.init() + * ``` + */ + public init(): void { + if (this.#initiated) { + return; + } + + const definedInitByUser = this.#extendInternalActions.init; + if (definedInitByUser) { + definedInitByUser(this.#context()); + } + + this.#initiated = true; + } + + /** + * Getting state of a provider + * + * **Note:** + * Each namespace has it's own state as well, in Legacy we didn't have this separation and all of them was accessible through Provider itself + * To be compatible with legacy, `getState` has a logic to guess the final state to produce same state as legacy. + * + * @example + * ```ts + * const provider = new Provider(...); + * const [getState, setState] = provider.state(); + * + * getState('installed'); + * // or + * getState().installed; + * ``` + * + */ + public state(): [GetState, SetState] { + const store = this.#store; + if (!store) { + throw new Error( + `Any store detected for ${this.id}. You need to set your store using '.store' method first.` + ); + } + + /** + * State updater + */ + const setState: SetState = (name, value) => { + switch (name) { + case 'installed': + return store.getState().providers.updateStatus(this.id, name, value); + default: + throw new Error( + `Unhandled state update for provider. (provider id: ${this.id}, state name: ${name})` + ); + } + }; + + /** + * State getter + */ + const getState: GetState = (name?: K) => { + const state: State = store + .getState() + .providers.guessNamespacesState(this.id); + + if (!name) { + return state; + } + + switch (name) { + case 'installed': + case 'connected': + case 'connecting': + return state[name]; + default: + throw new Error('Unhandled state for provider'); + } + }; + + return [getState, setState]; + } + + /** + * For keeping state, we need a store. all the states will be write to/read from store. + * + * **Note: When you are setting an store for provider, it will be set for its namespaces automatically as well** + * + * @example + * ```ts + * const myStore = createStore(); + * const provider = new Provider(...); + * provider.store(myStore); // or it can be passed to Provider constructor; + * ``` + */ + public store(store: Store): this { + if (this.#store) { + console.warn( + "You've already set an store for your Provider. Old store will be replaced by the new one." + ); + } + this.#store = store; + this.#setupStore(); + return this; + } + + /** + * Getting information about a provider which has been set on constructing Provider. + * + * @example + * ```ts + * const walletInfo = {name: "Garbage wallet", ...} + * const provider = new Provider(..., {info: walletInfo}); + * + * provider.info(); + * ``` + */ + public info(): ProviderConfig['info'] | undefined { + const store = this.#store; + if (!store) { + throw new Error( + 'You need to set your store using `.store` method first.' + ); + } + + return store.getState().providers.list[this.id].config.info; + } + + /** + * A list of registered _proxied_ namespaces. + * + * @example + * ```ts + * const provider = new Provider(...); + * const allNamespaces = provider.getAll(); + * ``` + */ + public getAll(): RegisteredNamespaces< + keyof CommonNamespaces, + CommonNamespaces + > { + return this.#namespaces; + } + + /** + * Get a registered namespace in provider by its **namespace key**. + * + * Note: difference between namespace key and namespace id is the first one is setting from a predefined list the second one can be anything and will be chosen by library's user. + * + * @param {string} id - evm, solana, cosmos, ... (CommonActions) + */ + public get( + id: K + ): FindProxiedNamespace | undefined { + return this.#namespaces.get(id) as unknown as + | FindProxiedNamespace + | undefined; + } + + /** + * + * Get a registered namespace by its **namespaceId**. + * + * Note: difference between namespace key and namespace id is the first one is setting from a predefined list the second one can be anything and will be chosen by library's user. + * + * @example + * ```ts + * const provider = new Provider(...); + * provider.findByNamespace("whatever-id-i-set-for-namespace") + * ``` + */ + public findByNamespace( + namespaceLookingFor: K | string + ): FindProxiedNamespace | undefined { + // If we didn't found any match, we will return `undefined`. + let result: object | undefined = undefined; + + this.#namespaces.forEach((namespace) => { + if (namespace.namespaceId === namespaceLookingFor) { + result = namespace; + } + }); + + return result; + } + + /** + * Running a hook function _after_ a specific action for **all registered namespaces**. + * + * **Note:** the context can be set from outside as well. this is useful for Provider to set its context instead of namespace context. + * + * @example + * ```ts + * const provider = new Provider(...); + * + * provider.after("connect", (context) => {}); + * ``` + */ + public before( + actionName: string, + hookFn: FunctionWithContext + ): this { + this.#addHook('before', actionName, hookFn); + return this; + } + + /** + * Running a hook function _before_ a specific action for **all registered namespaces**. + * + * **Note:** the context can be set from outside as well. this is useful for Provider to set its context instead of namespace context. + * + * @example + * ```ts + * const provider = new Provider(...); + * + * provider.after("connect", (context) => {}); + * ``` + */ + public after( + actionName: string, + hookFn: FunctionWithContext + ): this { + this.#addHook('after', actionName, hookFn); + return this; + } + + #addHook( + hookName: 'after' | 'before', + actionName: string, + cb: FunctionWithContext + ): this { + const context = { + state: this.state.bind(this), + }; + + this.#namespaces.forEach((namespace) => { + if (hookName === 'after') { + namespace.after(actionName as any, cb, { + context, + }); + } else if (hookName === 'before') { + namespace.before(actionName as any, cb, { + context, + }); + } else { + throw new Error(`You hook name is invalid: ${hookName}`); + } + }); + + return this; + } + + #setupStore(): void { + const store = this.#store; + if (!store) { + throw new Error('For setup store, you should set `store` first.'); + } + store.getState().providers.addProvider(this.id, this.#configs); + this.#namespaces.forEach((provider) => { + provider.store(store); + }); + } + + #context(): Context { + return { + state: this.state.bind(this), + }; + } +} diff --git a/wallets/core/src/hub/provider/types.ts b/wallets/core/src/hub/provider/types.ts new file mode 100644 index 0000000000..c227d64484 --- /dev/null +++ b/wallets/core/src/hub/provider/types.ts @@ -0,0 +1,37 @@ +import type { LegacyState } from '../../legacy/mod.js'; +import type { NamespaceInterface, Store } from '../../mod.js'; +import type { CosmosActions } from '../../namespaces/cosmos/mod.js'; +import type { EvmActions } from '../../namespaces/evm/mod.js'; +import type { SolanaActions } from '../../namespaces/solana/mod.js'; +import type { AnyFunction, FunctionWithContext } from '../../types/actions.js'; + +export type Context = { + state: () => [GetState, SetState]; +}; + +export type State = Omit; +export type SetState = >( + name: K, + value: State[K] +) => void; +export type GetState = { + (): State; + (name: K): State[K]; +}; + +export interface CommonNamespaces { + evm: EvmActions; + solana: SolanaActions; + cosmos: CosmosActions; +} + +export interface ExtendableInternalActions { + init?: FunctionWithContext; +} + +export type RegisteredNamespaces = Map< + K, + NamespaceInterface +>; + +export type ProviderBuilderOptions = { store?: Store }; diff --git a/wallets/core/src/hub/store/hub.ts b/wallets/core/src/hub/store/hub.ts new file mode 100644 index 0000000000..569f5eeef4 --- /dev/null +++ b/wallets/core/src/hub/store/hub.ts @@ -0,0 +1,18 @@ +/************ Hub ************/ + +import type { State } from './mod.js'; +import type { StateCreator } from 'zustand'; + +type HubConfig = object; + +export interface HubStore { + config: HubConfig; +} + +type HubStateCreator = StateCreator; + +const hubStore: HubStateCreator = () => ({ + config: {}, +}); + +export { hubStore }; diff --git a/wallets/core/src/hub/store/mod.ts b/wallets/core/src/hub/store/mod.ts new file mode 100644 index 0000000000..08193d4e4a --- /dev/null +++ b/wallets/core/src/hub/store/mod.ts @@ -0,0 +1,8 @@ +export { + guessProviderStateSelector, + namespaceStateSelector, +} from './selectors.js'; +export type { Store, State } from './store.js'; +export type { ProviderInfo, ProviderConfig } from './providers.js'; +export type { NamespaceConfig, NamespaceData } from './namespaces.js'; +export { createStore } from './store.js'; diff --git a/wallets/core/src/hub/store/namespaces.ts b/wallets/core/src/hub/store/namespaces.ts new file mode 100644 index 0000000000..f2bbcc7b36 --- /dev/null +++ b/wallets/core/src/hub/store/namespaces.ts @@ -0,0 +1,90 @@ +/************ Namespace ************/ + +import type { StateCreator } from 'zustand'; + +import { produce } from 'immer'; + +import { namespaceStateSelector, type State } from './mod.js'; + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface NamespaceConfig { + // Currently, namespace doesn't has any config. +} + +export interface NamespaceData { + accounts: null | string[]; + network: null | string; + connected: boolean; + connecting: boolean; +} + +interface NamespaceInfo { + providerId: string; + namespaceId: string; +} + +type NamespaceState = { + list: Record< + string, + { + info: NamespaceInfo; + data: NamespaceData; + error: unknown; + } + >; +}; + +interface NamespaceActions { + addNamespace: (id: string, config: NamespaceInfo) => void; + updateStatus: ( + id: string, + key: K, + value: NamespaceData[K] + ) => void; +} +interface NamespaceSelectors { + getNamespaceData(storeId: string): NamespaceData; +} + +export type NamespaceStore = NamespaceState & + NamespaceActions & + NamespaceSelectors; +type NamespaceStateCreator = StateCreator; + +const namespacesStore: NamespaceStateCreator = (set, get) => ({ + list: {}, + addNamespace: (id, info) => { + const item = { + data: { + accounts: null, + network: null, + connected: false, + connecting: false, + }, + error: '', + info, + }; + + set( + produce((state: State) => { + state.namespaces.list[id] = item; + }) + ); + }, + updateStatus: (id, key, value) => { + if (!get().namespaces.list[id]) { + throw new Error(`No namespace with '${id}' found.`); + } + + set( + produce((state: State) => { + state.namespaces.list[id].data[key] = value; + }) + ); + }, + getNamespaceData(storeId) { + return namespaceStateSelector(get(), storeId); + }, +}); + +export { namespacesStore }; diff --git a/wallets/core/src/hub/store/providers.ts b/wallets/core/src/hub/store/providers.ts new file mode 100644 index 0000000000..470e3d20c5 --- /dev/null +++ b/wallets/core/src/hub/store/providers.ts @@ -0,0 +1,97 @@ +import type { + CommonNamespaces, + State as InternalProviderState, +} from '../provider/mod.js'; +import type { StateCreator } from 'zustand'; + +import { produce } from 'immer'; + +import { guessProviderStateSelector, type State } from './mod.js'; + +type NamespaceName = + | keyof CommonNamespaces + | Omit; + +type Browsers = 'firefox' | 'chrome' | 'edge' | 'brave' | 'homepage'; +type Property = { name: N; value: V }; +type DetachedInstances = Property<'detached', NamespaceName[]>; + +export type ProviderInfo = { + name: string; + icon: string; + extensions: Partial>; + properties?: DetachedInstances[]; +}; + +export interface ProviderConfig { + info: ProviderInfo; +} + +interface ProviderData { + installed: boolean; +} + +type ProviderState = { + list: Record< + string, + { + config: ProviderConfig; + data: ProviderData; + error: unknown; + } + >; +}; +interface ProviderActions { + addProvider: (id: string, config: ProviderConfig) => void; + updateStatus: ( + id: string, + key: K, + value: ProviderData[K] + ) => void; +} + +interface ProviderSelectors { + /** + * Provider has a limited state to itself, to be compatible with legacy, we try to produce same object as legacy + * which includes namespace state as well. + */ + guessNamespacesState: (id: string) => InternalProviderState; +} + +export type ProviderStore = ProviderState & ProviderActions & ProviderSelectors; +type ProvidersStateCreator = StateCreator; + +const providersStore: ProvidersStateCreator = (set, get) => ({ + list: {}, + addProvider: (id, config) => { + const item = { + data: { + installed: false, + }, + error: '', + config, + }; + + set( + produce((state: State) => { + state.providers.list[id] = item; + }) + ); + }, + updateStatus: (id, key, value) => { + if (!get().providers.list[id]) { + throw new Error(`No namespace namespace with '${id}' found.`); + } + + set( + produce((state: State) => { + state.providers.list[id].data[key] = value; + }) + ); + }, + guessNamespacesState: (providerId: string): InternalProviderState => { + return guessProviderStateSelector(get(), providerId); + }, +}); + +export { providersStore }; diff --git a/wallets/core/src/hub/store/selectors.ts b/wallets/core/src/hub/store/selectors.ts new file mode 100644 index 0000000000..a124032d1e --- /dev/null +++ b/wallets/core/src/hub/store/selectors.ts @@ -0,0 +1,59 @@ +/** + * Note: Zustand has some difficulty when you are trying to `previous` state on `subscribe`. + * If these selectors define inside store directly and use `get()` for accessing state, it will get the latest state + * instead of previous state which desired. + * So make them a helper will let us to reuse them both in store and outside of store in a `subscribe`. + */ +import type { State } from '../mod.js'; +import type { State as InternalProviderState } from '../provider/mod.js'; + +/** + * Legacy provider state includes `connecting` and `connected` values. It hadn't a separation layer for `namespaces`. + * For compatibility reasons, we should produce these two values somehow. + * + * Currently, We return `true` if any of namespaces return true. We are missing failed namespace here. + * But if we want to solve that, we should migrate our client code to use `namespace` state directly and not from `provider` + */ +export function guessProviderStateSelector( + state: State, + providerId: string +): InternalProviderState { + /* + * We keep namespaces in a separate branch than providers. + * We should look at all of them and find all the namespaces that for our current proivder. + */ + const allNamespaces = state.namespaces.list; + const currentProviderNamespaces = Object.keys(allNamespaces).filter( + (key) => allNamespaces[key].info.providerId === providerId + ); + + // Returning provider state value directly. + const installed = state.providers.list[providerId].data.installed; + + /* + * If any namespaces returns `true`, we consider the whole provider for this field to be `true`. + * it has a downside regarding errors which explained on top of the function. + */ + const connected = + currentProviderNamespaces.length > 0 + ? currentProviderNamespaces.some( + (key) => allNamespaces[key].data.connected + ) + : false; + const connecting = + currentProviderNamespaces.length > 0 + ? currentProviderNamespaces.some( + (key) => allNamespaces[key].data.connecting + ) + : false; + + return { + installed, + connected, + connecting, + }; +} + +export function namespaceStateSelector(state: State, storeId: string) { + return state.namespaces.list[storeId].data; +} diff --git a/wallets/core/src/hub/store/store.test.ts b/wallets/core/src/hub/store/store.test.ts new file mode 100644 index 0000000000..a1a8fc4ceb --- /dev/null +++ b/wallets/core/src/hub/store/store.test.ts @@ -0,0 +1,32 @@ +import type { Store } from './store.js'; + +import { beforeEach, describe, expect, test } from 'vitest'; + +import { createStore } from './store.js'; + +describe('checking store', () => { + let hubStore: Store; + + beforeEach(() => { + hubStore = createStore(); + }); + + test('new providers can be added to store', () => { + const id = 'sol-or-something'; + const info = { + info: { + name: 'sol grabage wallet', + icon: 'http://somewhere.world', + extensions: { + homepage: 'http://somewhere.world', + }, + }, + }; + + const { getState } = hubStore; + getState().providers.addProvider(id, info); + + expect(getState().providers.list[id]).toBeDefined(); + expect(Object.keys(getState().providers.list).length).toBe(1); + }); +}); diff --git a/wallets/core/src/hub/store/store.ts b/wallets/core/src/hub/store/store.ts new file mode 100644 index 0000000000..17211cca26 --- /dev/null +++ b/wallets/core/src/hub/store/store.ts @@ -0,0 +1,26 @@ +import type { StoreApi } from 'zustand/vanilla'; + +import { createStore as createZustandStore } from 'zustand/vanilla'; + +import { hubStore, type HubStore } from './hub.js'; +import { namespacesStore, type NamespaceStore } from './namespaces.js'; +import { providersStore, type ProviderStore } from './providers.js'; + +/************ State ************/ + +export interface State { + hub: HubStore; + providers: ProviderStore; + namespaces: NamespaceStore; +} + +export type Store = StoreApi; +export const createStore = (): Store => { + return createZustandStore((...api) => { + return { + hub: hubStore(...api), + providers: providersStore(...api), + namespaces: namespacesStore(...api), + }; + }); +}; diff --git a/wallets/core/src/mod.ts b/wallets/core/src/mod.ts index a5e19b20a2..a84c47092b 100644 --- a/wallets/core/src/mod.ts +++ b/wallets/core/src/mod.ts @@ -1 +1,35 @@ -// This file will be updated to export Hub methods and types. +export type { Store, State, ProviderInfo } from './hub/mod.js'; +export { + Hub, + Provider, + Namespace, + createStore, + guessProviderStateSelector, + namespaceStateSelector, +} from './hub/mod.js'; +export type { + ProxiedNamespace, + FindProxiedNamespace as NamespaceInterface, +} from './builders/mod.js'; +export { + NamespaceBuilder, + ProviderBuilder, + ActionBuilder, +} from './builders/mod.js'; + +/* + * Our `embedded` hasn't been migrated to NodeNext yet so it doesn't support `exports` field. + * There are two approach to make `NodeNext` which is used for our libs with old moduleResolution: + * + * 1. Use direct paths, e.g. '@rango-dev/wallets-core/dist/legacy/mod' + * 2. Add types and function that are using in `embedded` to package entry point (this file). + * + * The first one is better since we don't need to deprecate or having a breaking change in future, + * But Parcel has weird behavior on resolving ESM exports. We enabled exports for Parcel using `packageExports: true` option, + * But it will use `exports` fields whenever it finds the field in package.json and ignore `moduleResolution` in tsconfig. + * + * To make it work for Parcel, we should go with second mentioned option. + * + */ +export type { Versions } from './utils/mod.js'; +export { defineVersions, pickVersion } from './utils/mod.js'; diff --git a/wallets/core/src/namespaces/common/actions.ts b/wallets/core/src/namespaces/common/actions.ts new file mode 100644 index 0000000000..f520932638 --- /dev/null +++ b/wallets/core/src/namespaces/common/actions.ts @@ -0,0 +1,11 @@ +import type { Context } from '../../hub/namespaces/mod.js'; + +export function disconnect(context: Context): void { + const [, setState] = context.state(); + setState('network', null); + setState('accounts', null); + setState('connected', false); + setState('connecting', false); +} + +export const recommended = [['disconnect', disconnect] as const]; diff --git a/wallets/core/src/namespaces/common/after.ts b/wallets/core/src/namespaces/common/after.ts new file mode 100644 index 0000000000..9f66c6ba23 --- /dev/null +++ b/wallets/core/src/namespaces/common/after.ts @@ -0,0 +1,8 @@ +import type { Context } from '../../hub/namespaces/mod.js'; + +export function intoConnectionFinished(context: Context) { + const [, setState] = context.state(); + setState('connecting', false); +} + +export const recommended = [['connect', intoConnectionFinished] as const]; diff --git a/wallets/core/src/namespaces/common/and.ts b/wallets/core/src/namespaces/common/and.ts new file mode 100644 index 0000000000..7b6a219871 --- /dev/null +++ b/wallets/core/src/namespaces/common/and.ts @@ -0,0 +1,42 @@ +import type { + Accounts, + AccountsWithActiveChain, +} from './../../types/accounts.js'; +import type { Context } from '../../hub/namespaces/mod.js'; + +import { isValidCaipAddress } from './helpers.js'; + +export function connectAndUpdateStateForSingleNetwork( + context: Context, + accounts: Accounts +) { + if (!accounts.every(isValidCaipAddress)) { + throw new Error( + `Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${accounts}` + ); + } + + const [, setState] = context.state(); + setState('accounts', accounts); + setState('connected', true); + return accounts; +} + +export function connectAndUpdateStateForMultiNetworks( + context: Context, + accounts: AccountsWithActiveChain +) { + if (!accounts.accounts.every(isValidCaipAddress)) { + throw new Error( + `Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${accounts.accounts}` + ); + } + + const [, setState] = context.state(); + setState('accounts', accounts.accounts); + setState('network', accounts.network); + setState('connected', true); + return accounts; +} + +export const recommended = []; diff --git a/wallets/core/src/namespaces/common/before.ts b/wallets/core/src/namespaces/common/before.ts new file mode 100644 index 0000000000..6945b36dfc --- /dev/null +++ b/wallets/core/src/namespaces/common/before.ts @@ -0,0 +1,9 @@ +import type { Context } from '../../hub/namespaces/mod.js'; + +export function intoConnecting(context: Context) { + const [, setState] = context.state(); + setState('connecting', true); +} + +// Please consider if you are going to add something here, make sure it works on all namespaces. +export const recommended = [['connect', intoConnecting] as const]; diff --git a/wallets/core/src/namespaces/common/builders.ts b/wallets/core/src/namespaces/common/builders.ts new file mode 100644 index 0000000000..1f4f60c64e --- /dev/null +++ b/wallets/core/src/namespaces/common/builders.ts @@ -0,0 +1,19 @@ +import type { AutoImplementedActionsByRecommended } from './types.js'; +import type { Actions } from '../../hub/namespaces/types.js'; + +import { ActionBuilder } from '../../mod.js'; + +import { disconnect as disconnectAction } from './actions.js'; + +export const disconnect = < + T extends Actions & + Record<'disconnect', AutoImplementedActionsByRecommended['disconnect']> +>() => + new ActionBuilder( + 'disconnect' + ) + .after((c) => { + c; + // + }) + .action(disconnectAction) as unknown as ActionBuilder; diff --git a/wallets/core/src/namespaces/common/helpers.ts b/wallets/core/src/namespaces/common/helpers.ts new file mode 100644 index 0000000000..29f85b68a7 --- /dev/null +++ b/wallets/core/src/namespaces/common/helpers.ts @@ -0,0 +1,10 @@ +import { AccountId } from 'caip'; + +export function isValidCaipAddress(address: string): boolean { + try { + AccountId.parse(address); + return true; + } catch { + return false; + } +} diff --git a/wallets/core/src/namespaces/common/mod.ts b/wallets/core/src/namespaces/common/mod.ts new file mode 100644 index 0000000000..bf9cf00906 --- /dev/null +++ b/wallets/core/src/namespaces/common/mod.ts @@ -0,0 +1,12 @@ +export * as actions from './actions.js'; +export * as builders from './builders.js'; +export { + intoConnectionFinished, + recommended as afterRecommended, +} from './after.js'; +export { + connectAndUpdateStateForMultiNetworks, + connectAndUpdateStateForSingleNetwork, + recommended as andRecommended, +} from './and.js'; +export { intoConnecting, recommended as beforeRecommended } from './before.js'; diff --git a/wallets/core/src/namespaces/common/types.ts b/wallets/core/src/namespaces/common/types.ts new file mode 100644 index 0000000000..2e8f563cc7 --- /dev/null +++ b/wallets/core/src/namespaces/common/types.ts @@ -0,0 +1,7 @@ +export interface CommonActions { + init: () => void; +} + +export interface AutoImplementedActionsByRecommended { + disconnect: () => void; +} diff --git a/wallets/core/src/namespaces/cosmos/mod.ts b/wallets/core/src/namespaces/cosmos/mod.ts new file mode 100644 index 0000000000..38b10b297f --- /dev/null +++ b/wallets/core/src/namespaces/cosmos/mod.ts @@ -0,0 +1 @@ +export type { CosmosActions } from './types.js'; diff --git a/wallets/core/src/namespaces/cosmos/types.ts b/wallets/core/src/namespaces/cosmos/types.ts new file mode 100644 index 0000000000..27cde09734 --- /dev/null +++ b/wallets/core/src/namespaces/cosmos/types.ts @@ -0,0 +1,10 @@ +import type { + AutoImplementedActionsByRecommended, + CommonActions, +} from '../common/types.js'; + +export interface CosmosActions + extends AutoImplementedActionsByRecommended, + CommonActions { + // TODO +} diff --git a/wallets/core/src/namespaces/evm/actions.ts b/wallets/core/src/namespaces/evm/actions.ts new file mode 100644 index 0000000000..6156f77e8b --- /dev/null +++ b/wallets/core/src/namespaces/evm/actions.ts @@ -0,0 +1,97 @@ +import type { EIP1193EventMap } from './eip1193.js'; +import type { EvmActions, ProviderAPI } from './types.js'; +import type { Context, Subscriber } from '../../hub/namespaces/mod.js'; +import type { SubscriberCleanUp } from '../../hub/namespaces/types.js'; +import type { CaipAccount } from '../../types/accounts.js'; +import type { FunctionWithContext } from '../../types/actions.js'; + +import { AccountId } from 'caip'; + +import { recommended as commonRecommended } from '../common/actions.js'; + +import { CAIP_NAMESPACE } from './constants.js'; +import { getAccounts, switchOrAddNetwork } from './utils.js'; + +export const recommended = [...commonRecommended]; + +export function connect( + instance: () => ProviderAPI +): FunctionWithContext { + return async (_context, chain) => { + const evmInstance = instance(); + + if (!evmInstance) { + throw new Error( + 'Do your wallet injected correctly and is evm compatible?' + ); + } + + if (chain) { + await switchOrAddNetwork(evmInstance, chain); + } + + const chainId = await evmInstance.request({ method: 'eth_chainId' }); + + const result = await getAccounts(evmInstance); + + const formatAccounts = result.accounts.map( + (account) => + AccountId.format({ + address: account, + chainId: { + namespace: CAIP_NAMESPACE, + reference: chainId, + }, + }) as CaipAccount + ); + + return { + accounts: formatAccounts, + network: result.chainId, + }; + }; +} + +export function changeAccountSubscriber( + instance: () => ProviderAPI +): [Subscriber, SubscriberCleanUp] { + let eventCallback: EIP1193EventMap['accountsChanged']; + + return [ + (context) => { + const evmInstance = instance(); + + if (!evmInstance) { + throw new Error( + 'Trying to subscribe to your EVM wallet, but seems its instance is not available.' + ); + } + + const [, setState] = context.state(); + + eventCallback = async (accounts) => { + const chainId = await evmInstance.request({ method: 'eth_chainId' }); + + const formatAccounts = accounts.map((account) => + AccountId.format({ + address: account, + chainId: { + namespace: CAIP_NAMESPACE, + reference: chainId, + }, + }) + ); + + setState('accounts', formatAccounts); + }; + evmInstance.on('accountsChanged', eventCallback); + }, + () => { + const evmInstance = instance(); + + if (eventCallback && evmInstance) { + evmInstance.removeListener('accountsChanged', eventCallback); + } + }, + ]; +} diff --git a/wallets/core/src/namespaces/evm/after.ts b/wallets/core/src/namespaces/evm/after.ts new file mode 100644 index 0000000000..229710d3bf --- /dev/null +++ b/wallets/core/src/namespaces/evm/after.ts @@ -0,0 +1,3 @@ +import { recommended as commonRecommended } from '../common/after.js'; + +export const recommended = [...commonRecommended]; diff --git a/wallets/core/src/namespaces/evm/and.ts b/wallets/core/src/namespaces/evm/and.ts new file mode 100644 index 0000000000..b1af366a39 --- /dev/null +++ b/wallets/core/src/namespaces/evm/and.ts @@ -0,0 +1,5 @@ +import { connectAndUpdateStateForMultiNetworks } from '../common/mod.js'; + +export const recommended = [ + ['connect', connectAndUpdateStateForMultiNetworks] as const, +]; diff --git a/wallets/core/src/namespaces/evm/before.ts b/wallets/core/src/namespaces/evm/before.ts new file mode 100644 index 0000000000..34a27af402 --- /dev/null +++ b/wallets/core/src/namespaces/evm/before.ts @@ -0,0 +1,3 @@ +import { beforeRecommended } from '../common/mod.js'; + +export const recommended = [...beforeRecommended]; diff --git a/wallets/core/src/namespaces/evm/builders.ts b/wallets/core/src/namespaces/evm/builders.ts new file mode 100644 index 0000000000..fec7dd8293 --- /dev/null +++ b/wallets/core/src/namespaces/evm/builders.ts @@ -0,0 +1,10 @@ +import type { EvmActions } from './types.js'; + +import { ActionBuilder } from '../../mod.js'; +import { intoConnectionFinished } from '../common/after.js'; +import { connectAndUpdateStateForMultiNetworks } from '../common/and.js'; + +export const connect = () => + new ActionBuilder('connect') + .and(connectAndUpdateStateForMultiNetworks) + .after(intoConnectionFinished); diff --git a/wallets/core/src/namespaces/evm/constants.ts b/wallets/core/src/namespaces/evm/constants.ts new file mode 100644 index 0000000000..13af0a2d0c --- /dev/null +++ b/wallets/core/src/namespaces/evm/constants.ts @@ -0,0 +1,2 @@ +export const CAIP_NAMESPACE = 'eip155'; +export const CAIP_ETHEREUM_CHAIN_ID = '1'; diff --git a/wallets/core/src/namespaces/evm/eip1193.ts b/wallets/core/src/namespaces/evm/eip1193.ts new file mode 100644 index 0000000000..e2634e370f --- /dev/null +++ b/wallets/core/src/namespaces/evm/eip1193.ts @@ -0,0 +1,1414 @@ +/* + * These are copied from `viem` (EIP1193Provider) + * They have an issue with `node16`, we can not directly import from their package. + * When they fixed the issue, it would better to re-export from viem instead of keeping it here and maintaining the changes. + */ + +// These are types that has so much nested types, for now i put any instead. +type Block = any; +type Log = any; +type TransactionRequest = any; +type BlockNumber = any; +type BlockTag = any; +type BlockIdentifier = any; +type RpcStateOverride = any; +type FeeHistory = any; +type Proof = any; +type Transaction = any; +type TransactionReceipt = any; +type LogTopic = any; +type Uncle = any; +type RpcUserOperation<_ = any> = any; +type RpcEstimateUserOperationGasReturnType = any; +type RpcGetUserOperationByHashReturnType = any; +type RpcUserOperationReceipt = any; + +type KeyofUnion = type extends type ? keyof type : never; + +export type OneOf< + union extends object, + fallback extends object | undefined = undefined, + /// + keys extends KeyofUnion = KeyofUnion +> = union extends infer item + ? Prettify< + item & { + [key in Exclude]?: fallback extends object + ? key extends keyof fallback + ? fallback[key] + : undefined + : undefined; + } + > + : never; + +export type AddEthereumChainParameter = { + /** A 0x-prefixed hexadecimal string */ + chainId: string; + /** The chain name. */ + chainName: string; + /** Native currency for the chain. */ + nativeCurrency?: + | { + name: string; + symbol: string; + decimals: number; + } + | undefined; + rpcUrls: readonly string[]; + blockExplorerUrls?: string[] | undefined; + iconUrls?: string[] | undefined; +}; + +export type NetworkSync = { + /** The current block number */ + currentBlock: Quantity; + /** Number of latest block on the network */ + highestBlock: Quantity; + /** Block number at which syncing started */ + startingBlock: Quantity; +}; + +export type WalletCapabilities = { + [capability: string]: any; +}; + +export type WalletCapabilitiesRecord< + capabilities extends WalletCapabilities = WalletCapabilities, + id extends string | number = Hex +> = { + [chainId in id]: capabilities; +}; + +export type WalletCallReceipt = { + logs: { + address: Hex; + data: Hex; + topics: Hex[]; + }[]; + status: status; + blockHash: Hex; + blockNumber: quantity; + gasUsed: quantity; + transactionHash: Hex; +}; + +export type WalletGrantPermissionsParameters = { + signer?: + | { + type: string; + data?: unknown | undefined; + } + | undefined; + permissions: readonly { + data: unknown; + policies: readonly { + data: unknown; + type: string; + }[]; + required?: boolean | undefined; + type: string; + }[]; + expiry: number; +}; + +export type WalletGrantPermissionsReturnType = { + expiry: number; + factory?: `0x${string}` | undefined; + factoryData?: string | undefined; + grantedPermissions: readonly { + data: unknown; + policies: readonly { + data: unknown; + type: string; + }[]; + required?: boolean | undefined; + type: string; + }[]; + permissionsContext: string; + signerData?: + | { + userOpBuilder?: `0x${string}` | undefined; + submitToAddress?: `0x${string}` | undefined; + } + | undefined; +}; + +export type WalletGetCallsStatusReturnType = { + status: 'PENDING' | 'CONFIRMED'; + receipts?: WalletCallReceipt[] | undefined; +}; + +export type WalletPermissionCaveat = { + type: string; + value: any; +}; + +export type WalletPermission = { + caveats: WalletPermissionCaveat[]; + date: number; + id: string; + invoker: `http://${string}` | `https://${string}`; + parentCapability: 'eth_accounts' | string; +}; + +export type WalletSendCallsParameters< + capabilities extends WalletCapabilities = WalletCapabilities, + chainId extends Hex | number = Hex, + quantity extends Quantity | bigint = Quantity +> = [ + { + calls: OneOf< + | { + to: Address; + data?: Hex | undefined; + value?: quantity | undefined; + } + | { + data: Hex; + } + >[]; + capabilities?: capabilities | undefined; + chainId: chainId; + from: Address; + version: string; + } +]; + +export type WatchAssetParams = { + /** Token type. */ + type: 'ERC20'; + options: { + /** The address of the token contract */ + address: string; + /** A ticker symbol or shorthand, up to 11 characters */ + symbol: string; + /** The number of token decimals */ + decimals: number; + /** A string url of the token logo */ + image?: string | undefined; + }; +}; + +export type ExactPartial = { + [key in keyof type]?: type[key] | undefined; +}; + +export type PartialBy = Omit & + ExactPartial>; + +/** TypeScript type to use for `address` values */ +type Address = `0x${string}`; + +export type ProviderConnectInfo = { + chainId: string; +}; + +export type ProviderMessage = { + type: string; + data: unknown; +}; + +class ProviderRpcError extends Error { + code: number; + details: string; + + constructor(code: number, message: string) { + super(message); + this.code = code; + this.details = message; + } +} + +export type EIP1193EventMap = { + accountsChanged(accounts: Address[]): void; + chainChanged(chainId: string): void; + connect(connectInfo: ProviderConnectInfo): void; + disconnect(error: ProviderRpcError): void; + message(message: ProviderMessage): void; +}; + +export type EIP1193Events = { + on( + event: event, + listener: EIP1193EventMap[event] + ): void; + removeListener( + event: event, + listener: EIP1193EventMap[event] + ): void; +}; + +export type Prettify = { + [K in keyof T]: T[K]; + // eslint-disable-next-line @typescript-eslint/ban-types +} & {}; + +export type RpcSchema = readonly { + Method: string; + Parameters?: unknown | undefined; + ReturnType: unknown; +}[]; + +export type RpcSchemaOverride = Omit; + +export type EIP1193Parameters< + rpcSchema extends RpcSchema | undefined = undefined +> = rpcSchema extends RpcSchema + ? { + [K in keyof rpcSchema]: Prettify< + { + method: rpcSchema[K] extends rpcSchema[number] + ? rpcSchema[K]['Method'] + : never; + } & (rpcSchema[K] extends rpcSchema[number] + ? rpcSchema[K]['Parameters'] extends undefined + ? { params?: undefined } + : { params: rpcSchema[K]['Parameters'] } + : never) + >; + }[number] + : { + method: string; + params?: unknown | undefined; + }; + +export type EIP1193RequestOptions = { + // Deduplicate in-flight requests. + dedupe?: boolean | undefined; + // The base delay (in ms) between retries. + retryDelay?: number | undefined; + // The max number of times to retry. + retryCount?: number | undefined; + /** Unique identifier for the request. */ + uid?: string | undefined; +}; + +type DerivedRpcSchema< + rpcSchema extends RpcSchema | undefined, + rpcSchemaOverride extends RpcSchemaOverride | undefined +> = rpcSchemaOverride extends RpcSchemaOverride + ? [rpcSchemaOverride & { Method: string }] + : rpcSchema; + +export type EIP1193RequestFn< + rpcSchema extends RpcSchema | undefined = undefined +> = < + rpcSchemaOverride extends RpcSchemaOverride | undefined = undefined, + _parameters extends EIP1193Parameters< + DerivedRpcSchema + > = EIP1193Parameters>, + _returnType = DerivedRpcSchema extends RpcSchema + ? Extract< + DerivedRpcSchema[number], + { Method: _parameters['method'] } + >['ReturnType'] + : unknown +>( + args: _parameters, + options?: EIP1193RequestOptions | undefined +) => Promise<_returnType>; + +export type Hex = `0x${string}`; +export type Hash = `0x${string}`; +export type Quantity = `0x${string}`; + +export type PublicRpcSchema = [ + /** + * @description Returns the version of the current client + * + * @example + * provider.request({ method: 'web3_clientVersion' }) + * // => 'MetaMask/v1.0.0' + */ + { + Method: 'web3_clientVersion'; + Parameters?: undefined; + ReturnType: string; + }, + /** + * @description Hashes data using the Keccak-256 algorithm + * + * @example + * provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] }) + * // => '0xc94770007dda54cF92009BFF0dE90c06F603a09f' + */ + { + Method: 'web3_sha3'; + Parameters: [data: Hash]; + ReturnType: string; + }, + /** + * @description Determines if this client is listening for new network connections + * + * @example + * provider.request({ method: 'net_listening' }) + * // => true + */ + { + Method: 'net_listening'; + Parameters?: undefined; + ReturnType: boolean; + }, + /** + * @description Returns the number of peers currently connected to this client + * + * @example + * provider.request({ method: 'net_peerCount' }) + * // => '0x1' + */ + { + Method: 'net_peerCount'; + Parameters?: undefined; + ReturnType: Quantity; + }, + /** + * @description Returns the chain ID associated with the current network + * + * @example + * provider.request({ method: 'net_version' }) + * // => '1' + */ + { + Method: 'net_version'; + Parameters?: undefined; + ReturnType: Quantity; + }, + /** + * @description Returns the base fee per blob gas in wei. + * + * @example + * provider.request({ method: 'eth_blobBaseFee' }) + * // => '0x09184e72a000' + */ + { + Method: 'eth_blobBaseFee'; + Parameters?: undefined; + ReturnType: Quantity; + }, + /** + * @description Returns the number of the most recent block seen by this client + * + * @example + * provider.request({ method: 'eth_blockNumber' }) + * // => '0x1b4' + */ + { + Method: 'eth_blockNumber'; + Parameters?: undefined; + ReturnType: Quantity; + }, + /** + * @description Executes a new message call immediately without submitting a transaction to the network + * + * @example + * provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] }) + * // => '0x...' + */ + { + Method: 'eth_call'; + Parameters: + | [transaction: ExactPartial] + | [ + transaction: ExactPartial, + block: BlockNumber | BlockTag | BlockIdentifier + ] + | [ + transaction: ExactPartial, + block: BlockNumber | BlockTag | BlockIdentifier, + stateOverrideSet: RpcStateOverride + ]; + ReturnType: Hex; + }, + /** + * @description Returns the chain ID associated with the current network + * @example + * provider.request({ method: 'eth_chainId' }) + * // => '1' + */ + { + Method: 'eth_chainId'; + Parameters?: undefined; + ReturnType: Quantity; + }, + /** + * @description Returns the client coinbase address. + * @example + * provider.request({ method: 'eth_coinbase' }) + * // => '0x...' + */ + { + Method: 'eth_coinbase'; + Parameters?: undefined; + ReturnType: Address; + }, + /** + * @description Estimates the gas necessary to complete a transaction without submitting it to the network + * + * @example + * provider.request({ + * method: 'eth_estimateGas', + * params: [{ from: '0x...', to: '0x...', value: '0x...' }] + * }) + * // => '0x5208' + */ + { + Method: 'eth_estimateGas'; + Parameters: + | [transaction: TransactionRequest] + | [transaction: TransactionRequest, block: BlockNumber | BlockTag] + | [ + transaction: TransactionRequest, + block: BlockNumber | BlockTag, + stateOverride: RpcStateOverride + ]; + ReturnType: Quantity; + }, + /** + * @description Returns a collection of historical gas information + * + * @example + * provider.request({ + * method: 'eth_feeHistory', + * params: ['4', 'latest', ['25', '75']] + * }) + * // => { + * // oldestBlock: '0x1', + * // baseFeePerGas: ['0x1', '0x2', '0x3', '0x4'], + * // gasUsedRatio: ['0x1', '0x2', '0x3', '0x4'], + * // reward: [['0x1', '0x2'], ['0x3', '0x4'], ['0x5', '0x6'], ['0x7', '0x8']] + * // } + * + */ + { + Method: 'eth_feeHistory'; + Parameters: [ + /** Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. */ + blockCount: Quantity, + /** Highest number block of the requested range. */ + newestBlock: BlockNumber | BlockTag, + /** A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. */ + rewardPercentiles: number[] | undefined + ]; + ReturnType: FeeHistory; + }, + /** + * @description Returns the current price of gas expressed in wei + * + * @example + * provider.request({ method: 'eth_gasPrice' }) + * // => '0x09184e72a000' + */ + { + Method: 'eth_gasPrice'; + Parameters?: undefined; + ReturnType: Quantity; + }, + /** + * @description Returns the balance of an address in wei + * + * @example + * provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] }) + * // => '0x12a05...' + */ + { + Method: 'eth_getBalance'; + Parameters: [ + address: Address, + block: BlockNumber | BlockTag | BlockIdentifier + ]; + ReturnType: Quantity; + }, + /** + * @description Returns information about a block specified by hash + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getBlockByHash', params: ['0x...', true] }) + * // => { + * // number: '0x1b4', + * // hash: '0x...', + * // parentHash: '0x...', + * // ... + * // } + */ + { + Method: 'eth_getBlockByHash'; + Parameters: [ + /** hash of a block */ + hash: Hash, + /** true will pull full transaction objects, false will pull transaction hashes */ + includeTransactionObjects: boolean + ]; + ReturnType: Block | null; + }, + /** + * @description Returns information about a block specified by number + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getBlockByNumber', params: ['0x1b4', true] }) + * // => { + * // number: '0x1b4', + * // hash: '0x...', + * // parentHash: '0x...', + * // ... + * // } + */ + { + Method: 'eth_getBlockByNumber'; + Parameters: [ + /** block number, or one of "latest", "safe", "finalized", "earliest" or "pending" */ + block: BlockNumber | BlockTag, + /** true will pull full transaction objects, false will pull transaction hashes */ + includeTransactionObjects: boolean + ]; + ReturnType: Block | null; + }, + /** + * @description Returns the number of transactions in a block specified by block hash + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getBlockTransactionCountByHash', params: ['0x...'] }) + * // => '0x1' + */ + { + Method: 'eth_getBlockTransactionCountByHash'; + Parameters: [hash: Hash]; + ReturnType: Quantity; + }, + /** + * @description Returns the number of transactions in a block specified by block number + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getBlockTransactionCountByNumber', params: ['0x1b4'] }) + * // => '0x1' + */ + { + Method: 'eth_getBlockTransactionCountByNumber'; + Parameters: [block: BlockNumber | BlockTag]; + ReturnType: Quantity; + }, + /** + * @description Returns the contract code stored at a given address + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getCode', params: ['0x...', 'latest'] }) + * // => '0x...' + */ + { + Method: 'eth_getCode'; + Parameters: [ + address: Address, + block: BlockNumber | BlockTag | BlockIdentifier + ]; + ReturnType: Hex; + }, + /** + * @description Returns a list of all logs based on filter ID since the last log retrieval + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getFilterChanges', params: ['0x...'] }) + * // => [{ ... }, { ... }] + */ + { + Method: 'eth_getFilterChanges'; + Parameters: [filterId: Quantity]; + ReturnType: Log[] | Hex[]; + }, + /** + * @description Returns a list of all logs based on filter ID + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getFilterLogs', params: ['0x...'] }) + * // => [{ ... }, { ... }] + */ + { + Method: 'eth_getFilterLogs'; + Parameters: [filterId: Quantity]; + ReturnType: Log[]; + }, + /** + * @description Returns a list of all logs based on a filter object + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getLogs', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] }) + * // => [{ ... }, { ... }] + */ + { + Method: 'eth_getLogs'; + Parameters: [ + { + address?: Address | Address[] | undefined; + topics?: LogTopic[] | undefined; + } & ( + | { + fromBlock?: BlockNumber | BlockTag | undefined; + toBlock?: BlockNumber | BlockTag | undefined; + blockHash?: undefined; + } + | { + fromBlock?: undefined; + toBlock?: undefined; + blockHash?: Hash | undefined; + } + ) + ]; + ReturnType: Log[]; + }, + /** + * @description Returns the account and storage values of the specified account including the Merkle-proof. + * @link https://eips.ethereum.org/EIPS/eip-1186 + * @example + * provider.request({ method: 'eth_getProof', params: ['0x...', ['0x...'], 'latest'] }) + * // => { + * // ... + * // } + */ + { + Method: 'eth_getProof'; + Parameters: [ + /** Address of the account. */ + address: Address, + /** An array of storage-keys that should be proofed and included. */ + storageKeys: Hash[], + block: BlockNumber | BlockTag + ]; + ReturnType: Proof; + }, + /** + * @description Returns the value from a storage position at an address + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getStorageAt', params: ['0x...', '0x...', 'latest'] }) + * // => '0x...' + */ + { + Method: 'eth_getStorageAt'; + Parameters: [ + address: Address, + index: Quantity, + block: BlockNumber | BlockTag | BlockIdentifier + ]; + ReturnType: Hex; + }, + /** + * @description Returns information about a transaction specified by block hash and transaction index + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getTransactionByBlockHashAndIndex', params: ['0x...', '0x...'] }) + * // => { ... } + */ + { + Method: 'eth_getTransactionByBlockHashAndIndex'; + Parameters: [hash: Hash, index: Quantity]; + ReturnType: Transaction | null; + }, + /** + * @description Returns information about a transaction specified by block number and transaction index + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getTransactionByBlockNumberAndIndex', params: ['0x...', '0x...'] }) + * // => { ... } + */ + { + Method: 'eth_getTransactionByBlockNumberAndIndex'; + Parameters: [block: BlockNumber | BlockTag, index: Quantity]; + ReturnType: Transaction | null; + }, + /** + * @description Returns information about a transaction specified by hash + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getTransactionByHash', params: ['0x...'] }) + * // => { ... } + */ + { + Method: 'eth_getTransactionByHash'; + Parameters: [hash: Hash]; + ReturnType: Transaction | null; + }, + /** + * @description Returns the number of transactions sent from an address + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getTransactionCount', params: ['0x...', 'latest'] }) + * // => '0x1' + */ + { + Method: 'eth_getTransactionCount'; + Parameters: [ + address: Address, + block: BlockNumber | BlockTag | BlockIdentifier + ]; + ReturnType: Quantity; + }, + /** + * @description Returns the receipt of a transaction specified by hash + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getTransactionReceipt', params: ['0x...'] }) + * // => { ... } + */ + { + Method: 'eth_getTransactionReceipt'; + Parameters: [hash: Hash]; + ReturnType: TransactionReceipt | null; + }, + /** + * @description Returns information about an uncle specified by block hash and uncle index position + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getUncleByBlockHashAndIndex', params: ['0x...', '0x...'] }) + * // => { ... } + */ + { + Method: 'eth_getUncleByBlockHashAndIndex'; + Parameters: [hash: Hash, index: Quantity]; + ReturnType: Uncle | null; + }, + /** + * @description Returns information about an uncle specified by block number and uncle index position + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getUncleByBlockNumberAndIndex', params: ['0x...', '0x...'] }) + * // => { ... } + */ + { + Method: 'eth_getUncleByBlockNumberAndIndex'; + Parameters: [block: BlockNumber | BlockTag, index: Quantity]; + ReturnType: Uncle | null; + }, + /** + * @description Returns the number of uncles in a block specified by block hash + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getUncleCountByBlockHash', params: ['0x...'] }) + * // => '0x1' + */ + { + Method: 'eth_getUncleCountByBlockHash'; + Parameters: [hash: Hash]; + ReturnType: Quantity; + }, + /** + * @description Returns the number of uncles in a block specified by block number + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_getUncleCountByBlockNumber', params: ['0x...'] }) + * // => '0x1' + */ + { + Method: 'eth_getUncleCountByBlockNumber'; + Parameters: [block: BlockNumber | BlockTag]; + ReturnType: Quantity; + }, + /** + * @description Returns the current maxPriorityFeePerGas in wei. + * @link https://ethereum.github.io/execution-apis/api-documentation/ + * @example + * provider.request({ method: 'eth_maxPriorityFeePerGas' }) + * // => '0x5f5e100' + */ + { + Method: 'eth_maxPriorityFeePerGas'; + Parameters?: undefined; + ReturnType: Quantity; + }, + /** + * @description Creates a filter to listen for new blocks that can be used with `eth_getFilterChanges` + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_newBlockFilter' }) + * // => '0x1' + */ + { + Method: 'eth_newBlockFilter'; + Parameters?: undefined; + ReturnType: Quantity; + }, + /** + * @description Creates a filter to listen for specific state changes that can then be used with `eth_getFilterChanges` + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_newFilter', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] }) + * // => '0x1' + */ + { + Method: 'eth_newFilter'; + Parameters: [ + filter: { + fromBlock?: BlockNumber | BlockTag | undefined; + toBlock?: BlockNumber | BlockTag | undefined; + address?: Address | Address[] | undefined; + topics?: LogTopic[] | undefined; + } + ]; + ReturnType: Quantity; + }, + /** + * @description Creates a filter to listen for new pending transactions that can be used with `eth_getFilterChanges` + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_newPendingTransactionFilter' }) + * // => '0x1' + */ + { + Method: 'eth_newPendingTransactionFilter'; + Parameters?: undefined; + ReturnType: Quantity; + }, + /** + * @description Returns the current Ethereum protocol version + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_protocolVersion' }) + * // => '54' + */ + { + Method: 'eth_protocolVersion'; + Parameters?: undefined; + ReturnType: string; + }, + /** + * @description Sends a **signed** transaction to the network + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] }) + * // => '0x...' + */ + { + Method: 'eth_sendRawTransaction'; + Parameters: [signedTransaction: Hex]; + ReturnType: Hash; + }, + /** + * @description Destroys a filter based on filter ID + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_uninstallFilter', params: ['0x1'] }) + * // => true + */ + { + Method: 'eth_uninstallFilter'; + Parameters: [filterId: Quantity]; + ReturnType: boolean; + } +]; + +export type WalletRpcSchema = [ + /** + * @description Returns a list of addresses owned by this client + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_accounts' }) + * // => ['0x0fB69...'] + */ + { + Method: 'eth_accounts'; + Parameters?: undefined; + ReturnType: Address[]; + }, + /** + * @description Returns the current chain ID associated with the wallet. + * @example + * provider.request({ method: 'eth_chainId' }) + * // => '1' + */ + { + Method: 'eth_chainId'; + Parameters?: undefined; + ReturnType: Quantity; + }, + /** + * @description Estimates the gas necessary to complete a transaction without submitting it to the network + * + * @example + * provider.request({ + * method: 'eth_estimateGas', + * params: [{ from: '0x...', to: '0x...', value: '0x...' }] + * }) + * // => '0x5208' + */ + { + Method: 'eth_estimateGas'; + Parameters: + | [transaction: TransactionRequest] + | [transaction: TransactionRequest, block: BlockNumber | BlockTag] + | [ + transaction: TransactionRequest, + block: BlockNumber | BlockTag, + stateOverride: RpcStateOverride + ]; + ReturnType: Quantity; + }, + /** + * @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear. + * @link https://eips.ethereum.org/EIPS/eip-1102 + * @example + * provider.request({ method: 'eth_requestAccounts' }] }) + * // => ['0x...', '0x...'] + */ + { + Method: 'eth_requestAccounts'; + Parameters?: undefined; + ReturnType: Address[]; + }, + /** + * @description Creates, signs, and sends a new transaction to the network + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] }) + * // => '0x...' + */ + { + Method: 'eth_sendTransaction'; + Parameters: [transaction: TransactionRequest]; + ReturnType: Hash; + }, + /** + * @description Sends and already-signed transaction to the network + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] }) + * // => '0x...' + */ + { + Method: 'eth_sendRawTransaction'; + Parameters: [signedTransaction: Hex]; + ReturnType: Hash; + }, + /** + * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))` + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_sign', params: ['0x...', '0x...'] }) + * // => '0x...' + */ + { + Method: 'eth_sign'; + Parameters: [ + /** Address to use for signing */ + address: Address, + /** Data to sign */ + data: Hex + ]; + ReturnType: Hex; + }, + /** + * @description Signs a transaction that can be submitted to the network at a later time using with `eth_sendRawTransaction` + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_signTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] }) + * // => '0x...' + */ + { + Method: 'eth_signTransaction'; + Parameters: [request: TransactionRequest]; + ReturnType: Hex; + }, + /** + * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))` + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_signTypedData_v4', params: [{ from: '0x...', data: [{ type: 'string', name: 'message', value: 'hello world' }] }] }) + * // => '0x...' + */ + { + Method: 'eth_signTypedData_v4'; + Parameters: [ + /** Address to use for signing */ + address: Address, + /** Message to sign containing type information, a domain separator, and data */ + message: string + ]; + ReturnType: Hex; + }, + /** + * @description Returns information about the status of this client’s network synchronization + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'eth_syncing' }) + * // => { startingBlock: '0x...', currentBlock: '0x...', highestBlock: '0x...' } + */ + { + Method: 'eth_syncing'; + Parameters?: undefined; + ReturnType: NetworkSync | false; + }, + /** + * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))` + * @link https://eips.ethereum.org/EIPS/eip-1474 + * @example + * provider.request({ method: 'personal_sign', params: ['0x...', '0x...'] }) + * // => '0x...' + */ + { + Method: 'personal_sign'; + Parameters: [ + /** Data to sign */ + data: Hex, + /** Address to use for signing */ + address: Address + ]; + ReturnType: Hex; + }, + /** + * @description Add an Ethereum chain to the wallet. + * @link https://eips.ethereum.org/EIPS/eip-3085 + * @example + * provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: 1, rpcUrl: 'https://mainnet.infura.io/v3/...' }] }) + * // => { ... } + */ + { + Method: 'wallet_addEthereumChain'; + Parameters: [chain: AddEthereumChainParameter]; + ReturnType: null; + }, + /** + * @description Returns the status of a call batch that was sent via `wallet_sendCalls`. + * @link https://eips.ethereum.org/EIPS/eip-5792 + * @example + * provider.request({ method: 'wallet_getCallsStatus' }) + * // => { ... } + */ + { + Method: 'wallet_getCallsStatus'; + Parameters?: [string]; + ReturnType: WalletGetCallsStatusReturnType; + }, + /** + * @description Gets the connected wallet's capabilities. + * @link https://eips.ethereum.org/EIPS/eip-5792 + * @example + * provider.request({ method: 'wallet_getCapabilities' }) + * // => { ... } + */ + { + Method: 'wallet_getCapabilities'; + Parameters?: [Address]; + ReturnType: Prettify; + }, + /** + * @description Gets the wallets current permissions. + * @link https://eips.ethereum.org/EIPS/eip-2255 + * @example + * provider.request({ method: 'wallet_getPermissions' }) + * // => { ... } + */ + { + Method: 'wallet_getPermissions'; + Parameters?: undefined; + ReturnType: WalletPermission[]; + }, + /** + * @description Requests permissions from a wallet + * @link https://eips.ethereum.org/EIPS/eip-7715 + * @example + * provider.request({ method: 'wallet_grantPermissions', params: [{ ... }] }) + * // => { ... } + */ + { + Method: 'wallet_grantPermissions'; + Parameters?: [WalletGrantPermissionsParameters]; + ReturnType: Prettify; + }, + /** + * @description Requests the given permissions from the user. + * @link https://eips.ethereum.org/EIPS/eip-2255 + * @example + * provider.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] }) + * // => { ... } + */ + { + Method: 'wallet_requestPermissions'; + Parameters: [permissions: { eth_accounts: Record }]; + ReturnType: WalletPermission[]; + }, + /** + * @description Revokes the given permissions from the user. + * @link https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-2.md + * @example + * provider.request({ method: 'wallet_revokePermissions', params: [{ eth_accounts: {} }] }) + * // => { ... } + */ + { + Method: 'wallet_revokePermissions'; + Parameters: [permissions: { eth_accounts: Record }]; + ReturnType: null; + }, + /** + * @description Requests the connected wallet to send a batch of calls. + * @link https://eips.ethereum.org/EIPS/eip-5792 + * @example + * provider.request({ method: 'wallet_sendCalls' }) + * // => { ... } + */ + { + Method: 'wallet_sendCalls'; + Parameters?: WalletSendCallsParameters; + ReturnType: string; + }, + /** + * @description Requests for the wallet to show information about a call batch + * that was sent via `wallet_sendCalls`. + * @link https://eips.ethereum.org/EIPS/eip-5792 + * @example + * provider.request({ method: 'wallet_showCallsStatus', params: ['...'] }) + */ + { + Method: 'wallet_showCallsStatus'; + Parameters?: [string]; + ReturnType: void; + }, + /** + * @description Switch the wallet to the given Ethereum chain. + * @link https://eips.ethereum.org/EIPS/eip-3326 + * @example + * provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }] }) + * // => { ... } + */ + { + Method: 'wallet_switchEthereumChain'; + Parameters: [chain: { chainId: string }]; + ReturnType: null; + }, + /** + * @description Requests that the user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added. + * @link https://eips.ethereum.org/EIPS/eip-747 + * @example + * provider.request({ method: 'wallet_watchAsset' }] }) + * // => true + */ + { + Method: 'wallet_watchAsset'; + Parameters: WatchAssetParams; + ReturnType: boolean; + } +]; + +export type BundlerRpcSchema = [ + /** + * @description Returns the chain ID associated with the current network + * + * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_chainid + */ + { + Method: 'eth_chainId'; + Parameters?: undefined; + ReturnType: Hex; + }, + /** + * @description Estimate the gas values for a UserOperation. + * + * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_estimateuseroperationgas + * + * @example + * provider.request({ + * method: 'eth_estimateUserOperationGas', + * params: [{ ... }] + * }) + * // => { ... } + */ + { + Method: 'eth_estimateUserOperationGas'; + Parameters: + | [userOperation: RpcUserOperation, entrypoint: Address] + | [ + userOperation: RpcUserOperation, + entrypoint: Address, + stateOverrideSet: RpcStateOverride + ]; + ReturnType: RpcEstimateUserOperationGasReturnType; + }, + /** + * @description Return a UserOperation based on a hash. + * + * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_getuseroperationbyhash + * + * @example + * provider.request({ + * method: 'eth_getUserOperationByHash', + * params: ['0x...'] + * }) + * // => { ... } + */ + { + Method: 'eth_getUserOperationByHash'; + Parameters: [hash: Hash]; + ReturnType: RpcGetUserOperationByHashReturnType | null; + }, + /** + * @description Return a UserOperation receipt based on a hash. + * + * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_getuseroperationreceipt + * + * @example + * provider.request({ + * method: 'eth_getUserOperationReceipt', + * params: ['0x...'] + * }) + * // => { ... } + */ + { + Method: 'eth_getUserOperationReceipt'; + Parameters: [hash: Hash]; + ReturnType: RpcUserOperationReceipt | null; + }, + /** + * @description Submits a User Operation object to the User Operation pool of the client. + * + * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_senduseroperation + * + * @example + * provider.request({ + * method: 'eth_sendUserOperation', + * params: [{ ... }] + * }) + * // => '0x...' + */ + { + Method: 'eth_sendUserOperation'; + Parameters: [userOperation: RpcUserOperation, entrypoint: Address]; + ReturnType: Hash; + }, + /** + * @description Return the list of supported entry points by the client. + * + * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_supportedentrypoints + */ + { + Method: 'eth_supportedEntryPoints'; + Parameters?: undefined; + ReturnType: readonly Address[]; + } +]; + +export type PaymasterRpcSchema = [ + /** + * @description Returns the chain ID associated with the current network + * + * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_chainid + */ + { + Method: 'pm_getPaymasterStubData'; + Parameters?: [ + userOperation: OneOf< + | PartialBy< + Pick< + RpcUserOperation<'0.6'>, + | 'callData' + | 'callGasLimit' + | 'initCode' + | 'maxFeePerGas' + | 'maxPriorityFeePerGas' + | 'nonce' + | 'sender' + | 'preVerificationGas' + | 'verificationGasLimit' + >, + | 'callGasLimit' + | 'initCode' + | 'maxFeePerGas' + | 'maxPriorityFeePerGas' + | 'preVerificationGas' + | 'verificationGasLimit' + > + | PartialBy< + Pick< + RpcUserOperation<'0.7'>, + | 'callData' + | 'callGasLimit' + | 'factory' + | 'factoryData' + | 'maxFeePerGas' + | 'maxPriorityFeePerGas' + | 'nonce' + | 'sender' + | 'preVerificationGas' + | 'verificationGasLimit' + >, + | 'callGasLimit' + | 'factory' + | 'factoryData' + | 'maxFeePerGas' + | 'maxPriorityFeePerGas' + | 'preVerificationGas' + | 'verificationGasLimit' + > + >, + entrypoint: Address, + chainId: Hex, + context: unknown + ]; + ReturnType: OneOf< + | { paymasterAndData: Hex } + | { + paymaster: Address; + paymasterData: Hex; + paymasterVerificationGasLimit: Hex; + paymasterPostOpGasLimit: Hex; + } + > & { + sponsor?: { name: string; icon?: string | undefined } | undefined; + isFinal?: boolean | undefined; + }; + }, + /** + * @description Returns values to be used in paymaster-related fields of a signed user operation. + * + * @link https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7677.md#pm_getpaymasterdata + */ + { + Method: 'pm_getPaymasterData'; + Parameters?: [ + userOperation: + | Pick< + RpcUserOperation<'0.6'>, + | 'callData' + | 'callGasLimit' + | 'initCode' + | 'maxFeePerGas' + | 'maxPriorityFeePerGas' + | 'nonce' + | 'sender' + | 'preVerificationGas' + | 'verificationGasLimit' + > + | Pick< + RpcUserOperation<'0.7'>, + | 'callData' + | 'callGasLimit' + | 'factory' + | 'factoryData' + | 'maxFeePerGas' + | 'maxPriorityFeePerGas' + | 'nonce' + | 'sender' + | 'preVerificationGas' + | 'verificationGasLimit' + >, + entrypoint: Address, + chainId: Hex, + context: unknown + ]; + ReturnType: OneOf< + | { paymasterAndData: Hex } + | { + paymaster: Address; + paymasterData: Hex; + paymasterVerificationGasLimit: Hex; + paymasterPostOpGasLimit: Hex; + } + >; + } +]; + +export type EIP1474Methods = [ + ...PublicRpcSchema, + ...WalletRpcSchema, + ...BundlerRpcSchema, + ...PaymasterRpcSchema +]; + +export type EIP1193Provider = EIP1193Events & { + request: EIP1193RequestFn; +}; diff --git a/wallets/core/src/namespaces/evm/mod.ts b/wallets/core/src/namespaces/evm/mod.ts new file mode 100644 index 0000000000..9b45bbd158 --- /dev/null +++ b/wallets/core/src/namespaces/evm/mod.ts @@ -0,0 +1,9 @@ +export * as actions from './actions.js'; +export * as after from './after.js'; +export * as and from './and.js'; +export * as before from './before.js'; +export * as utils from './utils.js'; +export * as builders from './builders.js'; + +export type { EvmActions, ProviderAPI } from './types.js'; +export { CAIP_NAMESPACE, CAIP_ETHEREUM_CHAIN_ID } from './constants.js'; diff --git a/wallets/core/src/namespaces/evm/types.ts b/wallets/core/src/namespaces/evm/types.ts new file mode 100644 index 0000000000..a1c5bac375 --- /dev/null +++ b/wallets/core/src/namespaces/evm/types.ts @@ -0,0 +1,18 @@ +import type { AddEthereumChainParameter } from './eip1193.js'; +import type { AccountsWithActiveChain } from '../../types/accounts.js'; +import type { + AutoImplementedActionsByRecommended, + CommonActions, +} from '../common/types.js'; + +export interface EvmActions + extends AutoImplementedActionsByRecommended, + CommonActions { + connect: (chain?: Chain | ChainId) => Promise; +} + +export type { EIP1193Provider as ProviderAPI } from './eip1193.js'; + +// A 0x-prefixed hexadecimal string +export type ChainId = string; +export type Chain = AddEthereumChainParameter; diff --git a/wallets/core/src/namespaces/evm/utils.ts b/wallets/core/src/namespaces/evm/utils.ts new file mode 100644 index 0000000000..4399eafed0 --- /dev/null +++ b/wallets/core/src/namespaces/evm/utils.ts @@ -0,0 +1,52 @@ +import type { Chain, ChainId, ProviderAPI } from './types.js'; + +export async function getAccounts(provider: ProviderAPI) { + const [accounts, chainId] = await Promise.all([ + provider.request({ method: 'eth_requestAccounts' }), + provider.request({ method: 'eth_chainId' }), + ]); + + return { + accounts, + chainId, + }; +} + +export async function suggestNetwork(instance: ProviderAPI, chain: Chain) { + return await instance.request({ + method: 'wallet_addEthereumChain', + params: [chain], + }); +} + +export async function switchNetwork(instance: ProviderAPI, chainId: ChainId) { + return await instance.request({ + method: 'wallet_switchEthereumChain', + params: [{ chainId: chainId }], + }); +} + +export async function switchOrAddNetwork( + instance: ProviderAPI, + chain: ChainId | Chain +) { + try { + const chainId = typeof chain === 'string' ? chain : chain.chainId; + await switchNetwork(instance, chainId); + } catch (switchError) { + const error = switchError as { code: number }; + + const NOT_FOUND_CHAIN_ERROR_CODE = 4902; + if ( + typeof chain !== 'string' && + (error.code === NOT_FOUND_CHAIN_ERROR_CODE || !error.code) + ) { + /* + * Note: on WalletConnect `code` is undefined so we have to use !switchError.code as fallback. + * This error code indicates that the chain has not been added to wallet. + */ + await suggestNetwork(instance, chain); + } + throw switchError; + } +} diff --git a/wallets/core/src/namespaces/solana/actions.ts b/wallets/core/src/namespaces/solana/actions.ts new file mode 100644 index 0000000000..48517a49ff --- /dev/null +++ b/wallets/core/src/namespaces/solana/actions.ts @@ -0,0 +1,70 @@ +import type { ProviderAPI, SolanaActions } from './types.js'; +import type { Subscriber } from '../../hub/namespaces/mod.js'; +import type { SubscriberCleanUp } from '../../hub/namespaces/types.js'; +import type { AnyFunction } from '../../types/actions.js'; + +import { AccountId } from 'caip'; + +import { recommended as commonRecommended } from '../common/actions.js'; + +import { CAIP_NAMESPACE, CAIP_SOLANA_CHAIN_ID } from './constants.js'; + +export const recommended = [...commonRecommended]; + +export function changeAccountSubscriber( + instance: () => ProviderAPI | undefined +): [Subscriber, SubscriberCleanUp] { + let eventCallback: AnyFunction; + + // subscriber can be passed to `or`, it will get the error and should rethrow error to pass the error to next `or` or throw error. + return [ + (context, err) => { + const solanaInstance = instance(); + + if (!solanaInstance) { + throw new Error( + 'Trying to subscribe to your Solana wallet, but seems its instance is not available.' + ); + } + + const [, setState] = context.state(); + + eventCallback = (publicKey) => { + /* + * In Phantom, when user is switching to an account which is not connected to dApp yet, it returns a null. + * So null means we don't have access to account and we 0 need to disconnect and let the user connect the account. + */ + if (!publicKey) { + context.action('disconnect'); + return; + } + + setState('accounts', [ + AccountId.format({ + address: publicKey.toString(), + chainId: { + namespace: CAIP_NAMESPACE, + reference: CAIP_SOLANA_CHAIN_ID, + }, + }), + ]); + }; + solanaInstance.on('accountChanged', eventCallback); + + if (err instanceof Error) { + throw err; + } + }, + (_context, err) => { + const solanaInstance = instance(); + + if (eventCallback && solanaInstance) { + solanaInstance.off('accountChanged', eventCallback); + } + + if (err instanceof Error) { + throw err; + } + }, + ]; +} diff --git a/wallets/core/src/namespaces/solana/after.ts b/wallets/core/src/namespaces/solana/after.ts new file mode 100644 index 0000000000..229710d3bf --- /dev/null +++ b/wallets/core/src/namespaces/solana/after.ts @@ -0,0 +1,3 @@ +import { recommended as commonRecommended } from '../common/after.js'; + +export const recommended = [...commonRecommended]; diff --git a/wallets/core/src/namespaces/solana/and.ts b/wallets/core/src/namespaces/solana/and.ts new file mode 100644 index 0000000000..0eb8ef6141 --- /dev/null +++ b/wallets/core/src/namespaces/solana/and.ts @@ -0,0 +1,5 @@ +import { connectAndUpdateStateForSingleNetwork } from '../common/mod.js'; + +export const recommended = [ + ['connect', connectAndUpdateStateForSingleNetwork] as const, +]; diff --git a/wallets/core/src/namespaces/solana/before.ts b/wallets/core/src/namespaces/solana/before.ts new file mode 100644 index 0000000000..ceeb4ffad1 --- /dev/null +++ b/wallets/core/src/namespaces/solana/before.ts @@ -0,0 +1,3 @@ +import { recommended as commonRecommended } from '../common/before.js'; + +export const recommended = [...commonRecommended]; diff --git a/wallets/core/src/namespaces/solana/builders.ts b/wallets/core/src/namespaces/solana/builders.ts new file mode 100644 index 0000000000..73f4dc1d24 --- /dev/null +++ b/wallets/core/src/namespaces/solana/builders.ts @@ -0,0 +1,10 @@ +import type { SolanaActions } from './types.js'; + +import { ActionBuilder } from '../../mod.js'; +import { intoConnectionFinished } from '../common/after.js'; +import { connectAndUpdateStateForSingleNetwork } from '../common/and.js'; + +export const connect = () => + new ActionBuilder('connect') + .and(connectAndUpdateStateForSingleNetwork) + .after(intoConnectionFinished); diff --git a/wallets/core/src/namespaces/solana/constants.ts b/wallets/core/src/namespaces/solana/constants.ts new file mode 100644 index 0000000000..31d6877448 --- /dev/null +++ b/wallets/core/src/namespaces/solana/constants.ts @@ -0,0 +1,2 @@ +export const CAIP_NAMESPACE = 'solana'; +export const CAIP_SOLANA_CHAIN_ID = '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'; diff --git a/wallets/core/src/namespaces/solana/mod.ts b/wallets/core/src/namespaces/solana/mod.ts new file mode 100644 index 0000000000..7b797d47dd --- /dev/null +++ b/wallets/core/src/namespaces/solana/mod.ts @@ -0,0 +1,8 @@ +export * as actions from './actions.js'; +export * as after from './after.js'; +export * as and from './and.js'; +export * as before from './before.js'; +export * as builders from './builders.js'; + +export type { ProviderAPI, SolanaActions } from './types.js'; +export { CAIP_NAMESPACE, CAIP_SOLANA_CHAIN_ID } from './constants.js'; diff --git a/wallets/core/src/namespaces/solana/types.ts b/wallets/core/src/namespaces/solana/types.ts new file mode 100644 index 0000000000..1023a92324 --- /dev/null +++ b/wallets/core/src/namespaces/solana/types.ts @@ -0,0 +1,20 @@ +import type { Accounts } from '../../types/accounts.js'; +import type { + AutoImplementedActionsByRecommended, + CommonActions, +} from '../common/types.js'; + +export interface SolanaActions + extends AutoImplementedActionsByRecommended, + CommonActions { + connect: () => Promise; +} + +/* + * + * TODO: That would be better to define a type for Solana injected wallets. + * They have something called [Wallet Standard](https://github.com/wallet-standard/wallet-standard) but not sure all the Solana wallets support that (Phantom do). + * If Phantom's interface is what Solana wallets are supporting, another option would be define that type here. + * + */ +export type ProviderAPI = Record; diff --git a/wallets/core/src/test-utils/fixtures.ts b/wallets/core/src/test-utils/fixtures.ts new file mode 100644 index 0000000000..f4c15f5cf2 --- /dev/null +++ b/wallets/core/src/test-utils/fixtures.ts @@ -0,0 +1,9 @@ +import type { ProviderConfig } from '../hub/store/mod.js'; + +export const garbageWalletInfo: ProviderConfig['info'] = { + name: 'Garbage Wallet', + icon: 'https://somewhereininternet.com/icon.svg', + extensions: { + homepage: 'https://app.rango.exchange', + }, +}; diff --git a/wallets/core/src/types/accounts.ts b/wallets/core/src/types/accounts.ts new file mode 100644 index 0000000000..e0df116e3f --- /dev/null +++ b/wallets/core/src/types/accounts.ts @@ -0,0 +1,12 @@ +type CaipNamespace = string; +type CaipChainId = string; +type CaipAccountAddress = string; + +export type CaipAccount = + `${CaipNamespace}:${CaipChainId}:${CaipAccountAddress}`; + +export type Accounts = CaipAccount[]; +export type AccountsWithActiveChain = { + accounts: Accounts; + network: string; +}; diff --git a/wallets/core/src/types/actions.ts b/wallets/core/src/types/actions.ts new file mode 100644 index 0000000000..1bba954708 --- /dev/null +++ b/wallets/core/src/types/actions.ts @@ -0,0 +1,11 @@ +export type AnyFunction = (...args: any[]) => any; +export type AnyPromiseFunction = (...args: any[]) => Promise; + +export type AndFunction< + T extends Record, + K extends keyof T +> = (result: Awaited>) => Awaited>; + +export type FunctionWithContext = T extends (...args: infer P) => infer R + ? (context: C, ...args: P) => R + : never; diff --git a/wallets/core/src/types/utils.ts b/wallets/core/src/types/utils.ts new file mode 100644 index 0000000000..8883c62fff --- /dev/null +++ b/wallets/core/src/types/utils.ts @@ -0,0 +1,7 @@ +/** + * @see https://x.com/mattpocockuk/status/1622730173446557697 + */ +export type Prettify = { + [K in keyof T]: T[K]; + // eslint-disable-next-line @typescript-eslint/ban-types +} & {}; diff --git a/wallets/core/src/utils/mod.ts b/wallets/core/src/utils/mod.ts new file mode 100644 index 0000000000..0870b202dd --- /dev/null +++ b/wallets/core/src/utils/mod.ts @@ -0,0 +1,8 @@ +/* + * It is not a good idea to re-export all of CAIP because if they have a breaking change, we will break as well. + * It would be better to create an abstraction over them and export our own interface to ensure it is under our control. + */ +export * as CAIP from 'caip'; + +export { generateStoreId } from '../hub/helpers.js'; +export * from './versions.js'; diff --git a/wallets/core/src/utils/versions.test.ts b/wallets/core/src/utils/versions.test.ts new file mode 100644 index 0000000000..c115b4b768 --- /dev/null +++ b/wallets/core/src/utils/versions.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, test } from 'vitest'; + +import { defineVersions, pickVersion } from './versions.js'; + +describe('Picking versions should work correctly', () => { + test("Error on picking a version doesn't exist", () => { + const versions = defineVersions().build(); + // const versions: Versions = [['1.0.0', {}]]; + expect(() => pickVersion(versions, '1.0.0')).toThrowError(); + }); + + test('Pick the correct version if it exist', () => { + const versions = defineVersions() + .version('0.0.0', {} as any) + .version('1.0.0', {} as any) + .build(); + + const target = pickVersion(versions, '1.0.0'); + expect(target).toBeDefined(); + expect(target[0]).toBe('1.0.0'); + }); +}); diff --git a/wallets/core/src/utils/versions.ts b/wallets/core/src/utils/versions.ts new file mode 100644 index 0000000000..0abee95745 --- /dev/null +++ b/wallets/core/src/utils/versions.ts @@ -0,0 +1,63 @@ +import type { Provider } from '../hub/mod.js'; +import type { LegacyProviderInterface } from '../legacy/mod.js'; + +type VersionedVLegacy = ['0.0.0', LegacyProviderInterface]; +type VersionedV1 = ['1.0.0', Provider]; +type AvailableVersions = VersionedVLegacy | VersionedV1; +export type Versions = AvailableVersions[]; +// eslint-disable-next-line @typescript-eslint/no-magic-numbers +export type VersionInterface = T[1]; + +type SemVer = T extends [infer U, any] ? U : never; +type MatchVersion = Extract< + T[number], + [Version, any] +>; + +export function pickVersion< + L extends Versions, + V extends SemVer +>(list: L, targetVersion: V): MatchVersion { + if (!targetVersion) { + throw new Error(`You should provide a valid semver, e.g 1.0.0.`); + } + + const target = list.find(([version]) => version === targetVersion); + + if (!target) { + throw new Error( + `You target version hasn't been found. Available versions: ${Object.keys( + list + ).join(', ')}` + ); + } + return target as MatchVersion; +} + +interface DefineVersionsApi { + version: >( + semver: T, + value: VersionInterface> + ) => DefineVersionsApi; + build: () => Versions; +} + +export function defineVersions(): DefineVersionsApi { + const versions: Versions = []; + const api: DefineVersionsApi = { + version: (semver, value) => { + versions.push([semver, value]); + return api; + }, + build: () => { + return versions; + }, + }; + return api; +} + +export function legacyProviderImportsToVersionsInterface( + provider: LegacyProviderInterface +): Versions { + return defineVersions().version('0.0.0', provider).build(); +} diff --git a/wallets/core/tests/hub.test.ts b/wallets/core/tests/hub.test.ts new file mode 100644 index 0000000000..5bc10d800c --- /dev/null +++ b/wallets/core/tests/hub.test.ts @@ -0,0 +1,63 @@ +import type { Context } from '../src/hub/namespaces/types.js'; +import type { EvmActions } from '../src/namespaces/evm/types.js'; +import type { FunctionWithContext } from '../src/types/actions.js'; + +import { beforeEach, describe, expect, test } from 'vitest'; + +import { NamespaceBuilder, ProviderBuilder } from '../src/builders/mod.js'; +import { Hub } from '../src/hub/hub.js'; +import { createStore, type Store } from '../src/hub/store/mod.js'; +import { garbageWalletInfo } from '../src/test-utils/fixtures.js'; + +describe('check hub', () => { + const walletName = 'garbage-wallet'; + let store: Store; + + beforeEach(() => { + store = createStore(); + + return () => { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore-next-line + store = undefined; + }; + }); + + test('connect through hub', async () => { + const evmConnect: FunctionWithContext< + EvmActions['connect'], + Context + > = async (_context, _chain) => { + return { + accounts: [ + 'eip155:0x1:0x000000000000000000000000000000000000dead', + 'eip155:0x1:0x0000000000000000000000000000000000000000', + ], + network: 'eth', + }; + }; + + const evmNamespace = new NamespaceBuilder('eip155', walletName) + .action('connect', evmConnect) + .build(); + const garbageWalletBuilder = new ProviderBuilder(walletName).config( + 'info', + garbageWalletInfo + ); + garbageWalletBuilder.add('evm', evmNamespace); + const garbageWallet = garbageWalletBuilder.build(); + + const myHub = new Hub({ + store, + }).add(garbageWallet.id, garbageWallet); + const wallet = myHub.get(garbageWallet.id); + // this is only for checking `.store` to has been set. + wallet?.state(); + const evmResult = await wallet?.get('evm')?.connect('0x0'); + + expect(evmResult?.accounts).toStrictEqual([ + 'eip155:0x1:0x000000000000000000000000000000000000dead', + 'eip155:0x1:0x0000000000000000000000000000000000000000', + ]); + }); +}); diff --git a/wallets/core/tests/providers.test.ts b/wallets/core/tests/providers.test.ts new file mode 100644 index 0000000000..6d7b4996bf --- /dev/null +++ b/wallets/core/tests/providers.test.ts @@ -0,0 +1,210 @@ +import type { Context } from '../src/hub/namespaces/mod.js'; +import type { EvmActions } from '../src/namespaces/evm/types.js'; +import type { SolanaActions } from '../src/namespaces/solana/types.js'; +import type { + AccountsWithActiveChain, + CaipAccount, +} from '../src/types/accounts.js'; +import type { FunctionWithContext } from '../src/types/actions.js'; + +import { describe, expect, test, vi } from 'vitest'; + +import { + ActionBuilder, + NamespaceBuilder, + ProviderBuilder, +} from '../src/builders/mod.js'; +import { garbageWalletInfo } from '../src/test-utils/fixtures.js'; + +describe('check Provider works with Blockchain correctly', () => { + const walletName = 'garbage-wallet'; + + test('connect successfully when two blockchain type has been added to Provider', async () => { + // Wallet Code + const spyOnEvmConnect = vi.fn(); + const evmConnect: FunctionWithContext< + EvmActions['connect'], + Context + > = async (_context, _chain) => { + spyOnEvmConnect(); + return { + accounts: ['eip155:0x1:0x000000000000000000000000000000000000dead'], + network: 'eth', + }; + }; + + const spyOnSolanaConnect = vi.fn(); + const solanaConnect: FunctionWithContext< + SolanaActions['connect'], + Context + > = async () => { + spyOnSolanaConnect(); + return ['solana:mainnet:1nc1nerator11111111111111111111111111111111']; + }; + + const evmNamespace = new NamespaceBuilder('eip155', walletName) + .action('connect', evmConnect) + .build(); + const solanaNamespace = new NamespaceBuilder( + 'solana', + walletName + ) + .action('connect', solanaConnect) + .build(); + + const garbageWalletBuilder = new ProviderBuilder(walletName).config( + 'info', + garbageWalletInfo + ); + garbageWalletBuilder.add('evm', evmNamespace); + garbageWalletBuilder.add('solana', solanaNamespace); + + const garbageWallet = garbageWalletBuilder.build(); + const evmResult = await garbageWallet.get('evm')?.connect('0x1'); + const solanaResult = await garbageWallet.get('solana')?.connect(); + + expect(evmResult?.accounts).toStrictEqual([ + 'eip155:0x1:0x000000000000000000000000000000000000dead', + ]); + expect(solanaResult).toStrictEqual([ + 'solana:mainnet:1nc1nerator11111111111111111111111111111111', + ]); + + expect(spyOnEvmConnect).toBeCalledTimes(1); + expect(spyOnSolanaConnect).toBeCalledTimes(1); + }); + + test('check post actions to work correctly.', async () => { + const spyOnConnect = vi.fn(); + const evmConnect: FunctionWithContext = + async function (_context, _chain) { + spyOnConnect(); + return { + // `as CaipAccount` is ok here because we are going to make to `CaipAccount` in `and` hook. + accounts: [ + '0x000000000000000000000000000000000000dead' as CaipAccount, + '0x0000000000000000000000000000000000000000' as CaipAccount, + ], + network: 'eth', + }; + }; + + const andConnect = vi.fn((_context, result: AccountsWithActiveChain) => { + return { + network: result.network, + accounts: result.accounts.map((account) => `eip155:0x1:${account}`), + }; + }); + + const evmDisconnect = vi.fn(); + const afterDisconnect = vi.fn(); + + const connectAction = new ActionBuilder('connect') + .action(evmConnect) + .and(andConnect) + .build(); + + const disconnectAction = new ActionBuilder( + 'disconnect' + ) + .action(evmDisconnect) + .after(afterDisconnect) + .build(); + + const evmNamespace = new NamespaceBuilder('eip155', walletName) + .action(connectAction) + .action(disconnectAction) + .build(); + + const garbageWalletBuilder = new ProviderBuilder('garbage-wallet').config( + 'info', + garbageWalletInfo + ); + garbageWalletBuilder.add('evm', evmNamespace); + + const garbageWallet = garbageWalletBuilder.build(); + const evmResult = await garbageWallet.get('evm')?.connect('0x1'); + + expect(evmResult?.accounts).toStrictEqual([ + 'eip155:0x1:0x000000000000000000000000000000000000dead', + 'eip155:0x1:0x0000000000000000000000000000000000000000', + ]); + + await garbageWallet.get('evm')?.connect('0x1'); + garbageWallet.get('evm')?.disconnect(); + expect(spyOnConnect).toBeCalledTimes(2); + expect(andConnect).toBeCalledTimes(2); + + expect(evmDisconnect).toBeCalledTimes(1); + expect(afterDisconnect).toBeCalledTimes(1); + }); + + test('check action builder works with namespace correctly.', async () => { + const spyOnSuccessAndAction = vi.fn((_ctx, value) => value); + const spyOnThrowAndAction = vi.fn(); + const spyOnThrowAndActionWithOr = vi.fn(); + + const spyOnSuccessOrAction = vi.fn(); + const spyOnThrowOrAction = vi.fn(); + + interface GarbageActions { + successfulAction: () => string; + throwErrorAction: () => void; + throwErrorActionWithOr: () => void; + } + + const successfulAction = new ActionBuilder< + GarbageActions, + 'successfulAction' + >('successfulAction') + .action(() => { + return 'yay!'; + }) + .and(spyOnSuccessAndAction) + .or(spyOnSuccessOrAction) + .build(); + + const throwErrorAction = new ActionBuilder< + GarbageActions, + 'throwErrorAction' + >('throwErrorAction') + .action(() => { + throw new Error('whatever'); + }) + .and(spyOnThrowAndAction) + .build(); + + const throwErrorActionWithOr = new ActionBuilder< + GarbageActions, + 'throwErrorActionWithOr' + >('throwErrorActionWithOr') + .action(() => { + throw new Error('whatever'); + }) + .and(spyOnThrowAndActionWithOr) + .or(spyOnThrowOrAction) + .build(); + + const garbageNamespace = new NamespaceBuilder<{ + successfulAction: () => string; + throwErrorAction: () => void; + throwErrorActionWithOr: () => void; + }>('eip155', walletName) + .action(successfulAction) + .action(throwErrorAction) + .action(throwErrorActionWithOr) + .build(); + + garbageNamespace.successfulAction(); + expect(spyOnSuccessAndAction).toBeCalledTimes(1); + expect(spyOnSuccessAndAction).toHaveLastReturnedWith('yay!'); + + expect(() => garbageNamespace.throwErrorAction()).toThrowError(); + expect(spyOnThrowAndAction).toBeCalledTimes(0); + + garbageNamespace.throwErrorActionWithOr(); + expect(spyOnThrowAndActionWithOr).toBeCalledTimes(0); + expect(spyOnSuccessOrAction).toBeCalledTimes(0); + expect(spyOnThrowOrAction).toBeCalledTimes(1); + }); +}); diff --git a/wallets/core/tsconfig.build.json b/wallets/core/tsconfig.build.json index 7484fe1a80..d77c2c36b7 100644 --- a/wallets/core/tsconfig.build.json +++ b/wallets/core/tsconfig.build.json @@ -1,9 +1,7 @@ { - // see https://www.typescriptlang.org/tsconfig to better understand tsconfigs "extends": "../../tsconfig.libnext.json", "include": ["src"], "compilerOptions": { - "outDir": "dist", - "rootDir": "./src" + "outDir": "dist" } } diff --git a/yarn.lock b/yarn.lock index 010b648f5b..5dcc05a558 100644 --- a/yarn.lock +++ b/yarn.lock @@ -33,7 +33,7 @@ resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== -"@ampproject/remapping@^2.2.0", "@ampproject/remapping@^2.2.1": +"@ampproject/remapping@^2.2.0": version "2.2.1" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== @@ -41,6 +41,14 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" +"@ampproject/remapping@^2.3.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" + integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" + "@aw-web-design/x-default-browser@1.4.126": version "1.4.126" resolved "https://registry.yarnpkg.com/@aw-web-design/x-default-browser/-/x-default-browser-1.4.126.tgz#43e4bd8f0314ed907a8718d7e862a203af79bc16" @@ -2714,16 +2722,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz#a70f4ac11c6a1dfc18b8bbb13284155d933b9537" integrity sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g== +"@esbuild/aix-ppc64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz#c7184a326533fcdf1b8ee0733e21c713b975575f" + integrity sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ== + "@esbuild/android-arm64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz#bafb75234a5d3d1b690e7c2956a599345e84a2fd" integrity sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA== -"@esbuild/android-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz#984b4f9c8d0377443cc2dfcef266d02244593622" - integrity sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ== - "@esbuild/android-arm64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.20.1.tgz#68791afa389550736f682c15b963a4f37ec2f5f6" @@ -2734,16 +2742,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz#db1c9202a5bc92ea04c7b6840f1bbe09ebf9e6b9" integrity sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg== +"@esbuild/android-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz#09d9b4357780da9ea3a7dfb833a1f1ff439b4052" + integrity sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A== + "@esbuild/android-arm@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.19.tgz#5898f7832c2298bc7d0ab53701c57beb74d78b4d" integrity sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A== -"@esbuild/android-arm@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.18.20.tgz#fedb265bc3a589c84cc11f810804f234947c3682" - integrity sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw== - "@esbuild/android-arm@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.20.1.tgz#38c91d8ee8d5196f7fbbdf4f0061415dde3a473a" @@ -2754,16 +2762,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.20.2.tgz#3b488c49aee9d491c2c8f98a909b785870d6e995" integrity sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w== +"@esbuild/android-arm@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz#9b04384fb771926dfa6d7ad04324ecb2ab9b2e28" + integrity sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg== + "@esbuild/android-x64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.19.tgz#658368ef92067866d95fb268719f98f363d13ae1" integrity sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww== -"@esbuild/android-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.18.20.tgz#35cf419c4cfc8babe8893d296cd990e9e9f756f2" - integrity sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg== - "@esbuild/android-x64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.20.1.tgz#93f6190ce997b313669c20edbf3645fc6c8d8f22" @@ -2774,16 +2782,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.20.2.tgz#3b1628029e5576249d2b2d766696e50768449f98" integrity sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg== +"@esbuild/android-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz#29918ec2db754cedcb6c1b04de8cd6547af6461e" + integrity sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA== + "@esbuild/darwin-arm64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz#584c34c5991b95d4d48d333300b1a4e2ff7be276" integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== -"@esbuild/darwin-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz#08172cbeccf95fbc383399a7f39cfbddaeb0d7c1" - integrity sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA== - "@esbuild/darwin-arm64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.20.1.tgz#0d391f2e81fda833fe609182cc2fbb65e03a3c46" @@ -2794,16 +2802,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz#6e8517a045ddd86ae30c6608c8475ebc0c4000bb" integrity sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA== +"@esbuild/darwin-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz#e495b539660e51690f3928af50a76fb0a6ccff2a" + integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ== + "@esbuild/darwin-x64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz#7751d236dfe6ce136cce343dce69f52d76b7f6cb" integrity sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw== -"@esbuild/darwin-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz#d70d5790d8bf475556b67d0f8b7c5bdff053d85d" - integrity sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ== - "@esbuild/darwin-x64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.20.1.tgz#92504077424584684862f483a2242cfde4055ba2" @@ -2814,16 +2822,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz#90ed098e1f9dd8a9381695b207e1cff45540a0d0" integrity sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA== +"@esbuild/darwin-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz#c13838fa57372839abdddc91d71542ceea2e1e22" + integrity sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw== + "@esbuild/freebsd-arm64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz#cacd171665dd1d500f45c167d50c6b7e539d5fd2" integrity sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ== -"@esbuild/freebsd-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz#98755cd12707f93f210e2494d6a4b51b96977f54" - integrity sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw== - "@esbuild/freebsd-arm64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.1.tgz#a1646fa6ba87029c67ac8a102bb34384b9290774" @@ -2834,16 +2842,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz#d71502d1ee89a1130327e890364666c760a2a911" integrity sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw== +"@esbuild/freebsd-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz#646b989aa20bf89fd071dd5dbfad69a3542e550e" + integrity sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g== + "@esbuild/freebsd-x64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz#0769456eee2a08b8d925d7c00b79e861cb3162e4" integrity sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ== -"@esbuild/freebsd-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz#c1eb2bff03915f87c29cece4c1a7fa1f423b066e" - integrity sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ== - "@esbuild/freebsd-x64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.20.1.tgz#41c9243ab2b3254ea7fb512f71ffdb341562e951" @@ -2854,16 +2862,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz#aa5ea58d9c1dd9af688b8b6f63ef0d3d60cea53c" integrity sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw== +"@esbuild/freebsd-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz#aa615cfc80af954d3458906e38ca22c18cf5c261" + integrity sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ== + "@esbuild/linux-arm64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz#38e162ecb723862c6be1c27d6389f48960b68edb" integrity sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg== -"@esbuild/linux-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz#bad4238bd8f4fc25b5a021280c770ab5fc3a02a0" - integrity sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA== - "@esbuild/linux-arm64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.20.1.tgz#f3c1e1269fbc9eedd9591a5bdd32bf707a883156" @@ -2874,16 +2882,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz#055b63725df678379b0f6db9d0fa85463755b2e5" integrity sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A== +"@esbuild/linux-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz#70ac6fa14f5cb7e1f7f887bcffb680ad09922b5b" + integrity sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q== + "@esbuild/linux-arm@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz#1a2cd399c50040184a805174a6d89097d9d1559a" integrity sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA== -"@esbuild/linux-arm@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz#3e617c61f33508a27150ee417543c8ab5acc73b0" - integrity sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg== - "@esbuild/linux-arm@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.20.1.tgz#4503ca7001a8ee99589c072801ce9d7540717a21" @@ -2894,16 +2902,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz#76b3b98cb1f87936fbc37f073efabad49dcd889c" integrity sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg== +"@esbuild/linux-arm@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz#fc6fd11a8aca56c1f6f3894f2bea0479f8f626b9" + integrity sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA== + "@esbuild/linux-ia32@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz#e28c25266b036ce1cabca3c30155222841dc035a" integrity sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ== -"@esbuild/linux-ia32@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz#699391cccba9aee6019b7f9892eb99219f1570a7" - integrity sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA== - "@esbuild/linux-ia32@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.20.1.tgz#98c474e3e0cbb5bcbdd8561a6e65d18f5767ce48" @@ -2914,16 +2922,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz#c0e5e787c285264e5dfc7a79f04b8b4eefdad7fa" integrity sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig== +"@esbuild/linux-ia32@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz#3271f53b3f93e3d093d518d1649d6d68d346ede2" + integrity sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg== + "@esbuild/linux-loong64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz#0f887b8bb3f90658d1a0117283e55dbd4c9dcf72" integrity sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ== -"@esbuild/linux-loong64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz#e6fccb7aac178dd2ffb9860465ac89d7f23b977d" - integrity sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg== - "@esbuild/linux-loong64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.20.1.tgz#a8097d28d14b9165c725fe58fc438f80decd2f33" @@ -2934,16 +2942,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz#a6184e62bd7cdc63e0c0448b83801001653219c5" integrity sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ== +"@esbuild/linux-loong64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz#ed62e04238c57026aea831c5a130b73c0f9f26df" + integrity sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg== + "@esbuild/linux-mips64el@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz#f5d2a0b8047ea9a5d9f592a178ea054053a70289" integrity sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A== -"@esbuild/linux-mips64el@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz#eeff3a937de9c2310de30622a957ad1bd9183231" - integrity sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ== - "@esbuild/linux-mips64el@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.20.1.tgz#c44f6f0d7d017c41ad3bb15bfdb69b690656b5ea" @@ -2954,16 +2962,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz#d08e39ce86f45ef8fc88549d29c62b8acf5649aa" integrity sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA== +"@esbuild/linux-mips64el@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz#e79b8eb48bf3b106fadec1ac8240fb97b4e64cbe" + integrity sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg== + "@esbuild/linux-ppc64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz#876590e3acbd9fa7f57a2c7d86f83717dbbac8c7" integrity sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg== -"@esbuild/linux-ppc64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz#2f7156bde20b01527993e6881435ad79ba9599fb" - integrity sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA== - "@esbuild/linux-ppc64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.20.1.tgz#0765a55389a99237b3c84227948c6e47eba96f0d" @@ -2974,16 +2982,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz#8d252f0b7756ffd6d1cbde5ea67ff8fd20437f20" integrity sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg== +"@esbuild/linux-ppc64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz#5f2203860a143b9919d383ef7573521fb154c3e4" + integrity sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w== + "@esbuild/linux-riscv64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz#7f49373df463cd9f41dc34f9b2262d771688bf09" integrity sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA== -"@esbuild/linux-riscv64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz#6628389f210123d8b4743045af8caa7d4ddfc7a6" - integrity sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A== - "@esbuild/linux-riscv64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.20.1.tgz#e4153b032288e3095ddf4c8be07893781b309a7e" @@ -2994,16 +3002,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz#19f6dcdb14409dae607f66ca1181dd4e9db81300" integrity sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg== +"@esbuild/linux-riscv64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz#07bcafd99322d5af62f618cb9e6a9b7f4bb825dc" + integrity sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA== + "@esbuild/linux-s390x@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz#e2afd1afcaf63afe2c7d9ceacd28ec57c77f8829" integrity sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q== -"@esbuild/linux-s390x@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz#255e81fb289b101026131858ab99fba63dcf0071" - integrity sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ== - "@esbuild/linux-s390x@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.20.1.tgz#b9ab8af6e4b73b26d63c1c426d7669a5d53eb5a7" @@ -3014,16 +3022,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz#3c830c90f1a5d7dd1473d5595ea4ebb920988685" integrity sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ== +"@esbuild/linux-s390x@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz#b7ccf686751d6a3e44b8627ababc8be3ef62d8de" + integrity sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A== + "@esbuild/linux-x64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz#8a0e9738b1635f0c53389e515ae83826dec22aa4" integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== -"@esbuild/linux-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz#c7690b3417af318a9b6f96df3031a8865176d338" - integrity sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w== - "@esbuild/linux-x64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.20.1.tgz#0b25da17ac38c3e11cdd06ca3691d4d6bef2755f" @@ -3034,16 +3042,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz#86eca35203afc0d9de0694c64ec0ab0a378f6fff" integrity sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw== +"@esbuild/linux-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz#6d8f0c768e070e64309af8004bb94e68ab2bb3b0" + integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ== + "@esbuild/netbsd-x64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz#c29fb2453c6b7ddef9a35e2c18b37bda1ae5c462" integrity sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q== -"@esbuild/netbsd-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz#30e8cd8a3dded63975e2df2438ca109601ebe0d1" - integrity sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A== - "@esbuild/netbsd-x64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.20.1.tgz#3148e48406cd0d4f7ba1e0bf3f4d77d548c98407" @@ -3054,16 +3062,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz#e771c8eb0e0f6e1877ffd4220036b98aed5915e6" integrity sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ== +"@esbuild/netbsd-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz#bbe430f60d378ecb88decb219c602667387a6047" + integrity sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg== + "@esbuild/openbsd-x64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz#95e75a391403cb10297280d524d66ce04c920691" integrity sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g== -"@esbuild/openbsd-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz#7812af31b205055874c8082ea9cf9ab0da6217ae" - integrity sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg== - "@esbuild/openbsd-x64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.20.1.tgz#7b73e852986a9750192626d377ac96ac2b749b76" @@ -3074,16 +3082,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz#9a795ae4b4e37e674f0f4d716f3e226dd7c39baf" integrity sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ== +"@esbuild/openbsd-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz#99d1cf2937279560d2104821f5ccce220cb2af70" + integrity sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow== + "@esbuild/sunos-x64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz#722eaf057b83c2575937d3ffe5aeb16540da7273" integrity sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg== -"@esbuild/sunos-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz#d5c275c3b4e73c9b0ecd38d1ca62c020f887ab9d" - integrity sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ== - "@esbuild/sunos-x64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.20.1.tgz#402a441cdac2eee98d8be378c7bc23e00c1861c5" @@ -3094,16 +3102,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz#7df23b61a497b8ac189def6e25a95673caedb03f" integrity sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w== +"@esbuild/sunos-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz#08741512c10d529566baba837b4fe052c8f3487b" + integrity sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg== + "@esbuild/win32-arm64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz#9aa9dc074399288bdcdd283443e9aeb6b9552b6f" integrity sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag== -"@esbuild/win32-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz#73bc7f5a9f8a77805f357fab97f290d0e4820ac9" - integrity sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg== - "@esbuild/win32-arm64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.20.1.tgz#36c4e311085806a6a0c5fc54d1ac4d7b27e94d7b" @@ -3114,16 +3122,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz#f1ae5abf9ca052ae11c1bc806fb4c0f519bacf90" integrity sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ== +"@esbuild/win32-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz#675b7385398411240735016144ab2e99a60fc75d" + integrity sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A== + "@esbuild/win32-ia32@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz#95ad43c62ad62485e210f6299c7b2571e48d2b03" integrity sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw== -"@esbuild/win32-ia32@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz#ec93cbf0ef1085cc12e71e0d661d20569ff42102" - integrity sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g== - "@esbuild/win32-ia32@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.20.1.tgz#0cf933be3fb9dc58b45d149559fe03e9e22b54fe" @@ -3134,16 +3142,16 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz#241fe62c34d8e8461cd708277813e1d0ba55ce23" integrity sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ== +"@esbuild/win32-ia32@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz#1bfc3ce98aa6ca9a0969e4d2af72144c59c1193b" + integrity sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA== + "@esbuild/win32-x64@0.17.19": version "0.17.19" resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz#8cfaf2ff603e9aabb910e9c0558c26cf32744061" integrity sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA== -"@esbuild/win32-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz#786c5f41f043b07afb1af37683d7c33668858f6d" - integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ== - "@esbuild/win32-x64@0.20.1": version "0.20.1" resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.20.1.tgz#77583b6ea54cee7c1410ebbd54051b6a3fcbd8ba" @@ -3154,6 +3162,11 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz#9c907b21e30a52db959ba4f80bb01a0cc403d5cc" integrity sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ== +"@esbuild/win32-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz#acad351d582d157bb145535db2a6ff53dd514b5c" + integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw== + "@eslint-community/eslint-utils@^4.2.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" @@ -3791,7 +3804,12 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": +"@jridgewell/sourcemap-codec@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": version "0.3.20" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f" integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== @@ -3799,7 +3817,7 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": +"@jridgewell/trace-mapping@^0.3.23", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== @@ -4323,6 +4341,11 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== +"@noble/hashes@~1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.5.0.tgz#abadc5ca20332db2b1b2aa3e496e9af1213570b0" + integrity sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -5609,6 +5632,86 @@ estree-walker "^2.0.2" picomatch "^2.3.1" +"@rollup/rollup-android-arm-eabi@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.20.0.tgz#c3f5660f67030c493a981ac1d34ee9dfe1d8ec0f" + integrity sha512-TSpWzflCc4VGAUJZlPpgAJE1+V60MePDQnBd7PPkpuEmOy8i87aL6tinFGKBFKuEDikYpig72QzdT3QPYIi+oA== + +"@rollup/rollup-android-arm64@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.20.0.tgz#64161f0b67050023a3859e723570af54a82cff5c" + integrity sha512-u00Ro/nok7oGzVuh/FMYfNoGqxU5CPWz1mxV85S2w9LxHR8OoMQBuSk+3BKVIDYgkpeOET5yXkx90OYFc+ytpQ== + +"@rollup/rollup-darwin-arm64@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.20.0.tgz#25f3d57b1da433097cfebc89341b355901615763" + integrity sha512-uFVfvzvsdGtlSLuL0ZlvPJvl6ZmrH4CBwLGEFPe7hUmf7htGAN+aXo43R/V6LATyxlKVC/m6UsLb7jbG+LG39Q== + +"@rollup/rollup-darwin-x64@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.20.0.tgz#d8ddaffb636cc2f59222c50316e27771e48966df" + integrity sha512-xbrMDdlev53vNXexEa6l0LffojxhqDTBeL+VUxuuIXys4x6xyvbKq5XqTXBCEUA8ty8iEJblHvFaWRJTk/icAQ== + +"@rollup/rollup-linux-arm-gnueabihf@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.20.0.tgz#41bd4fcffa20fb84f3dbac6c5071638f46151885" + integrity sha512-jMYvxZwGmoHFBTbr12Xc6wOdc2xA5tF5F2q6t7Rcfab68TT0n+r7dgawD4qhPEvasDsVpQi+MgDzj2faOLsZjA== + +"@rollup/rollup-linux-arm-musleabihf@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.20.0.tgz#842077c5113a747eb5686f19f2f18c33ecc0acc8" + integrity sha512-1asSTl4HKuIHIB1GcdFHNNZhxAYEdqML/MW4QmPS4G0ivbEcBr1JKlFLKsIRqjSwOBkdItn3/ZDlyvZ/N6KPlw== + +"@rollup/rollup-linux-arm64-gnu@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.20.0.tgz#65d1d5b6778848f55b7823958044bf3e8737e5b7" + integrity sha512-COBb8Bkx56KldOYJfMf6wKeYJrtJ9vEgBRAOkfw6Ens0tnmzPqvlpjZiLgkhg6cA3DGzCmLmmd319pmHvKWWlQ== + +"@rollup/rollup-linux-arm64-musl@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.20.0.tgz#50eef7d6e24d0fe3332200bb666cad2be8afcf86" + integrity sha512-+it+mBSyMslVQa8wSPvBx53fYuZK/oLTu5RJoXogjk6x7Q7sz1GNRsXWjn6SwyJm8E/oMjNVwPhmNdIjwP135Q== + +"@rollup/rollup-linux-powerpc64le-gnu@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.20.0.tgz#8837e858f53c84607f05ad0602943e96d104c6b4" + integrity sha512-yAMvqhPfGKsAxHN8I4+jE0CpLWD8cv4z7CK7BMmhjDuz606Q2tFKkWRY8bHR9JQXYcoLfopo5TTqzxgPUjUMfw== + +"@rollup/rollup-linux-riscv64-gnu@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.20.0.tgz#c894ade2300caa447757ddf45787cca246e816a4" + integrity sha512-qmuxFpfmi/2SUkAw95TtNq/w/I7Gpjurx609OOOV7U4vhvUhBcftcmXwl3rqAek+ADBwSjIC4IVNLiszoj3dPA== + +"@rollup/rollup-linux-s390x-gnu@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.20.0.tgz#5841e5390d4c82dd5cdf7b2c95a830e3c2f47dd3" + integrity sha512-I0BtGXddHSHjV1mqTNkgUZLnS3WtsqebAXv11D5BZE/gfw5KoyXSAXVqyJximQXNvNzUo4GKlCK/dIwXlz+jlg== + +"@rollup/rollup-linux-x64-gnu@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.20.0.tgz#cc1f26398bf777807a99226dc13f47eb0f6c720d" + integrity sha512-y+eoL2I3iphUg9tN9GB6ku1FA8kOfmF4oUEWhztDJ4KXJy1agk/9+pejOuZkNFhRwHAOxMsBPLbXPd6mJiCwew== + +"@rollup/rollup-linux-x64-musl@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.20.0.tgz#1507465d9056e0502a590d4c1a00b4d7b1fda370" + integrity sha512-hM3nhW40kBNYUkZb/r9k2FKK+/MnKglX7UYd4ZUy5DJs8/sMsIbqWK2piZtVGE3kcXVNj3B2IrUYROJMMCikNg== + +"@rollup/rollup-win32-arm64-msvc@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.20.0.tgz#86a221f01a2c248104dd0defb4da119f2a73642e" + integrity sha512-psegMvP+Ik/Bg7QRJbv8w8PAytPA7Uo8fpFjXyCRHWm6Nt42L+JtoqH8eDQ5hRP7/XW2UiIriy1Z46jf0Oa1kA== + +"@rollup/rollup-win32-ia32-msvc@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.20.0.tgz#8bc8f77e02760aa664694b4286d6fbea7f1331c5" + integrity sha512-GabekH3w4lgAJpVxkk7hUzUf2hICSQO0a/BLFA11/RMxQT92MabKAqyubzDZmMOC/hcJNlc+rrypzNzYl4Dx7A== + +"@rollup/rollup-win32-x64-msvc@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.20.0.tgz#601fffee719a1e8447f908aca97864eec23b2784" + integrity sha512-aJ1EJSuTdGnM6qbVC4B5DSmozPTqIag9fSzXRNNo+humQLG89XpPgdt16Ia56ORD7s+H8Pmyx44uczDQ0yDzpg== + "@safe-global/safe-apps-provider@^0.17.0": version "0.17.1" resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-provider/-/safe-apps-provider-0.17.1.tgz#72df2a66be5343940ed505efe594ed3b0f2f7015" @@ -5648,6 +5751,11 @@ resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.7.tgz#fe973311a5c6267846aa131bc72e96c5d40d2b30" integrity sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g== +"@scure/base@~1.1.8": + version "1.1.9" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" + integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== + "@scure/bip32@1.3.2": version "1.3.2" resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" @@ -5682,6 +5790,14 @@ "@noble/hashes" "~1.4.0" "@scure/base" "~1.1.6" +"@scure/bip39@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.4.0.tgz#664d4f851564e2e1d4bffa0339f9546ea55960a6" + integrity sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw== + dependencies: + "@noble/hashes" "~1.5.0" + "@scure/base" "~1.1.8" + "@sentry-internal/feedback@7.102.1": version "7.102.1" resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-7.102.1.tgz#747f88c2881c76fddd16bce57cc4bc17b4c2af93" @@ -7440,18 +7556,6 @@ "@types/connect" "*" "@types/node" "*" -"@types/chai-subset@^1.3.3": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@types/chai-subset/-/chai-subset-1.3.5.tgz#3fc044451f26985f45625230a7f22284808b0a9a" - integrity sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A== - dependencies: - "@types/chai" "*" - -"@types/chai@*", "@types/chai@^4.3.5": - version "4.3.11" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.11.tgz#e95050bf79a932cb7305dd130254ccdf9bde671c" - integrity sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ== - "@types/connect@*", "@types/connect@^3.4.33": version "3.4.38" resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" @@ -7548,7 +7652,7 @@ "@types/estree" "*" "@types/json-schema" "*" -"@types/estree@*", "@types/estree@^1.0.0": +"@types/estree@*", "@types/estree@1.0.5", "@types/estree@^1.0.0": version "1.0.5" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== @@ -7620,7 +7724,7 @@ resolved "https://registry.yarnpkg.com/@types/is-function/-/is-function-1.0.3.tgz#548f851db5d30a12abeea2569ba75890dbf89425" integrity sha512-/CLhCW79JUeLKznI6mbVieGbl4QU5Hfn+6udw1YHZoofASjbQ5zaP5LzAUZYDpRYEjS4/P+DhEgyJ/PQmGGTWw== -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.6" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== @@ -8158,65 +8262,74 @@ prop-types "^15.5.10" react-use-measure "^2.0.4" -"@vitest/coverage-v8@^0.33.0": - version "0.33.0" - resolved "https://registry.yarnpkg.com/@vitest/coverage-v8/-/coverage-v8-0.33.0.tgz#dfcb36cf51624a89d33ab0962a6eec8a41346ef2" - integrity sha512-Rj5IzoLF7FLj6yR7TmqsfRDSeaFki6NAJ/cQexqhbWkHEV2htlVGrmuOde3xzvFsCbLCagf4omhcIaVmfU8Okg== +"@vitest/coverage-v8@^2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@vitest/coverage-v8/-/coverage-v8-2.0.5.tgz#411961ce4fd1177a32b4dd74ab576ed3b859155e" + integrity sha512-qeFcySCg5FLO2bHHSa0tAZAOnAUbp4L6/A5JDuj9+bt53JREl8hpLjLHEWF0e/gWc8INVpJaqA7+Ene2rclpZg== dependencies: - "@ampproject/remapping" "^2.2.1" + "@ampproject/remapping" "^2.3.0" "@bcoe/v8-coverage" "^0.2.3" - istanbul-lib-coverage "^3.2.0" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.1" - istanbul-reports "^3.1.5" - magic-string "^0.30.1" - picocolors "^1.0.0" - std-env "^3.3.3" - test-exclude "^6.0.0" - v8-to-istanbul "^9.1.0" + debug "^4.3.5" + istanbul-lib-coverage "^3.2.2" + istanbul-lib-report "^3.0.1" + istanbul-lib-source-maps "^5.0.6" + istanbul-reports "^3.1.7" + magic-string "^0.30.10" + magicast "^0.3.4" + std-env "^3.7.0" + test-exclude "^7.0.1" + tinyrainbow "^1.2.0" + +"@vitest/expect@2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-2.0.5.tgz#f3745a6a2c18acbea4d39f5935e913f40d26fa86" + integrity sha512-yHZtwuP7JZivj65Gxoi8upUN2OzHTi3zVfjwdpu2WrvCZPLwsJ2Ey5ILIPccoW23dd/zQBlJ4/dhi7DWNyXCpA== + dependencies: + "@vitest/spy" "2.0.5" + "@vitest/utils" "2.0.5" + chai "^5.1.1" + tinyrainbow "^1.2.0" -"@vitest/expect@0.33.0": - version "0.33.0" - resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-0.33.0.tgz#f48652591f3573ad6c2db828ad358d5c078845d3" - integrity sha512-sVNf+Gla3mhTCxNJx+wJLDPp/WcstOe0Ksqz4Vec51MmgMth/ia0MGFEkIZmVGeTL5HtjYR4Wl/ZxBxBXZJTzQ== +"@vitest/pretty-format@2.0.5", "@vitest/pretty-format@^2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-2.0.5.tgz#91d2e6d3a7235c742e1a6cc50e7786e2f2979b1e" + integrity sha512-h8k+1oWHfwTkyTkb9egzwNMfJAEx4veaPSnMeKbVSjp4euqGSbQlm5+6VHwTr7u4FJslVVsUG5nopCaAYdOmSQ== dependencies: - "@vitest/spy" "0.33.0" - "@vitest/utils" "0.33.0" - chai "^4.3.7" + tinyrainbow "^1.2.0" -"@vitest/runner@0.33.0": - version "0.33.0" - resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-0.33.0.tgz#0b1a4d04ff8bc5cdad73920eac019d99550edf9d" - integrity sha512-UPfACnmCB6HKRHTlcgCoBh6ppl6fDn+J/xR8dTufWiKt/74Y9bHci5CKB8tESSV82zKYtkBJo9whU3mNvfaisg== +"@vitest/runner@2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-2.0.5.tgz#89197e712bb93513537d6876995a4843392b2a84" + integrity sha512-TfRfZa6Bkk9ky4tW0z20WKXFEwwvWhRY+84CnSEtq4+3ZvDlJyY32oNTJtM7AW9ihW90tX/1Q78cb6FjoAs+ig== dependencies: - "@vitest/utils" "0.33.0" - p-limit "^4.0.0" - pathe "^1.1.1" + "@vitest/utils" "2.0.5" + pathe "^1.1.2" -"@vitest/snapshot@0.33.0": - version "0.33.0" - resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-0.33.0.tgz#4400a90c48907808122b573053a2112a832b3698" - integrity sha512-tJjrl//qAHbyHajpFvr8Wsk8DIOODEebTu7pgBrP07iOepR5jYkLFiqLq2Ltxv+r0uptUb4izv1J8XBOwKkVYA== +"@vitest/snapshot@2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-2.0.5.tgz#a2346bc5013b73c44670c277c430e0334690a162" + integrity sha512-SgCPUeDFLaM0mIUHfaArq8fD2WbaXG/zVXjRupthYfYGzc8ztbFbu6dUNOblBG7XLMR1kEhS/DNnfCZ2IhdDew== dependencies: - magic-string "^0.30.1" - pathe "^1.1.1" - pretty-format "^29.5.0" + "@vitest/pretty-format" "2.0.5" + magic-string "^0.30.10" + pathe "^1.1.2" -"@vitest/spy@0.33.0": - version "0.33.0" - resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-0.33.0.tgz#366074d3cf9cf1ed8aeaa76e50e78c799fb242eb" - integrity sha512-Kv+yZ4hnH1WdiAkPUQTpRxW8kGtH8VRTnus7ZTGovFYM1ZezJpvGtb9nPIjPnptHbsyIAxYZsEpVPYgtpjGnrg== +"@vitest/spy@2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-2.0.5.tgz#590fc07df84a78b8e9dd976ec2090920084a2b9f" + integrity sha512-c/jdthAhvJdpfVuaexSrnawxZz6pywlTPe84LUB2m/4t3rl2fTo9NFGBG4oWgaD+FTgDDV8hJ/nibT7IfH3JfA== dependencies: - tinyspy "^2.1.1" + tinyspy "^3.0.0" -"@vitest/utils@0.33.0": - version "0.33.0" - resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-0.33.0.tgz#6b9820cb8f128d649da6f78ecaa9b73d6222b277" - integrity sha512-pF1w22ic965sv+EN6uoePkAOTkAPWM03Ri/jXNyMIKBb/XHLDPfhLvf/Fa9g0YECevAIz56oVYXhodLvLQ/awA== +"@vitest/utils@2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-2.0.5.tgz#6f8307a4b6bc6ceb9270007f73c67c915944e926" + integrity sha512-d8HKbqIcya+GR67mkZbrzhS5kKhtp8dQLcmRZLGTscGVg7yImT82cIrhtn2L8+VujWcy6KZweApgNmPsTAO/UQ== dependencies: - diff-sequences "^29.4.3" - loupe "^2.3.6" - pretty-format "^29.5.0" + "@vitest/pretty-format" "2.0.5" + estree-walker "^3.0.3" + loupe "^3.1.1" + tinyrainbow "^1.2.0" "@wallet-standard/base@^1.0.1": version "1.0.1" @@ -8783,11 +8896,6 @@ acorn-walk@^7.2.0: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== -acorn-walk@^8.2.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.0.tgz#2097665af50fd0cf7a2dfccd2b9368964e66540f" - integrity sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA== - acorn@^7.4.1: version "7.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" @@ -9111,10 +9219,10 @@ assert@^2.0.0, assert@^2.1.0: object.assign "^4.1.4" util "^0.12.5" -assertion-error@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" - integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== +assertion-error@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-2.0.1.tgz#f641a196b335690b1070bf00b6e7593fec190bf7" + integrity sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA== ast-types@^0.16.1: version "0.16.1" @@ -9793,18 +9901,16 @@ cashaddrjs@0.4.4: dependencies: big-integer "1.6.36" -chai@^4.3.7: - version "4.3.10" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.10.tgz#d784cec635e3b7e2ffb66446a63b4e33bd390384" - integrity sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g== +chai@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/chai/-/chai-5.1.1.tgz#f035d9792a22b481ead1c65908d14bb62ec1c82c" + integrity sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA== dependencies: - assertion-error "^1.1.0" - check-error "^1.0.3" - deep-eql "^4.1.3" - get-func-name "^2.0.2" - loupe "^2.3.6" - pathval "^1.1.1" - type-detect "^4.0.8" + assertion-error "^2.0.1" + check-error "^2.1.1" + deep-eql "^5.0.1" + loupe "^3.1.0" + pathval "^2.0.0" chalk@5.3.0, chalk@^5.2.0: version "5.3.0" @@ -9853,12 +9959,10 @@ charenc@~0.0.1: resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA== -check-error@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694" - integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== - dependencies: - get-func-name "^2.0.2" +check-error@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-2.1.1.tgz#87eb876ae71ee388fa0471fe423f494be1d96ccc" + integrity sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw== chokidar@3.5.1: version "3.5.1" @@ -10859,6 +10963,11 @@ dayjs@^1.11.7: resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0" integrity sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ== +debounce@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.1.tgz#38881d8f4166a5c5848020c11827b834bcb3e0a5" + integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== + debug@2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -10880,6 +10989,13 @@ debug@^3.2.7: dependencies: ms "^2.1.1" +debug@^4.3.5: + version "4.3.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b" + integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg== + dependencies: + ms "2.1.2" + decamelize-keys@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.1.tgz#04a2d523b2f18d80d0158a43b895d56dff8d19d8" @@ -10908,12 +11024,10 @@ dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== -deep-eql@^4.1.3: - version "4.1.3" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" - integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== - dependencies: - type-detect "^4.0.0" +deep-eql@^5.0.1: + version "5.0.2" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-5.0.2.tgz#4b756d8d770a9257300825d52a2c2cff99c3a341" + integrity sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q== deep-equal@^1.1.1: version "1.1.2" @@ -11092,11 +11206,6 @@ detect-port@^1.3.0: address "^1.0.1" debug "4" -diff-sequences@^29.4.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" - integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== - diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -11605,34 +11714,6 @@ esbuild@^0.17.10: "@esbuild/win32-ia32" "0.20.2" "@esbuild/win32-x64" "0.20.2" -esbuild@^0.18.10: - version "0.18.20" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.18.20.tgz#4709f5a34801b43b799ab7d6d82f7284a9b7a7a6" - integrity sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA== - optionalDependencies: - "@esbuild/android-arm" "0.18.20" - "@esbuild/android-arm64" "0.18.20" - "@esbuild/android-x64" "0.18.20" - "@esbuild/darwin-arm64" "0.18.20" - "@esbuild/darwin-x64" "0.18.20" - "@esbuild/freebsd-arm64" "0.18.20" - "@esbuild/freebsd-x64" "0.18.20" - "@esbuild/linux-arm" "0.18.20" - "@esbuild/linux-arm64" "0.18.20" - "@esbuild/linux-ia32" "0.18.20" - "@esbuild/linux-loong64" "0.18.20" - "@esbuild/linux-mips64el" "0.18.20" - "@esbuild/linux-ppc64" "0.18.20" - "@esbuild/linux-riscv64" "0.18.20" - "@esbuild/linux-s390x" "0.18.20" - "@esbuild/linux-x64" "0.18.20" - "@esbuild/netbsd-x64" "0.18.20" - "@esbuild/openbsd-x64" "0.18.20" - "@esbuild/sunos-x64" "0.18.20" - "@esbuild/win32-arm64" "0.18.20" - "@esbuild/win32-ia32" "0.18.20" - "@esbuild/win32-x64" "0.18.20" - esbuild@^0.20.1: version "0.20.1" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.20.1.tgz#1e4cbb380ad1959db7609cb9573ee77257724a3e" @@ -11662,6 +11743,35 @@ esbuild@^0.20.1: "@esbuild/win32-ia32" "0.20.1" "@esbuild/win32-x64" "0.20.1" +esbuild@^0.21.3: + version "0.21.5" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.21.5.tgz#9ca301b120922959b766360d8ac830da0d02997d" + integrity sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw== + optionalDependencies: + "@esbuild/aix-ppc64" "0.21.5" + "@esbuild/android-arm" "0.21.5" + "@esbuild/android-arm64" "0.21.5" + "@esbuild/android-x64" "0.21.5" + "@esbuild/darwin-arm64" "0.21.5" + "@esbuild/darwin-x64" "0.21.5" + "@esbuild/freebsd-arm64" "0.21.5" + "@esbuild/freebsd-x64" "0.21.5" + "@esbuild/linux-arm" "0.21.5" + "@esbuild/linux-arm64" "0.21.5" + "@esbuild/linux-ia32" "0.21.5" + "@esbuild/linux-loong64" "0.21.5" + "@esbuild/linux-mips64el" "0.21.5" + "@esbuild/linux-ppc64" "0.21.5" + "@esbuild/linux-riscv64" "0.21.5" + "@esbuild/linux-s390x" "0.21.5" + "@esbuild/linux-x64" "0.21.5" + "@esbuild/netbsd-x64" "0.21.5" + "@esbuild/openbsd-x64" "0.21.5" + "@esbuild/sunos-x64" "0.21.5" + "@esbuild/win32-arm64" "0.21.5" + "@esbuild/win32-ia32" "0.21.5" + "@esbuild/win32-x64" "0.21.5" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -11886,6 +11996,13 @@ estree-walker@^2.0.2: resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== +estree-walker@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-3.0.3.tgz#67c3e549ec402a487b4fc193d1953a524752340d" + integrity sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g== + dependencies: + "@types/estree" "^1.0.0" + esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -12013,6 +12130,21 @@ execa@^5.0.0, execa@^5.1.1: signal-exit "^3.0.3" strip-final-newline "^2.0.0" +execa@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-8.0.1.tgz#51f6a5943b580f963c3ca9c6321796db8cc39b8c" + integrity sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^8.0.1" + human-signals "^5.0.0" + is-stream "^3.0.0" + merge-stream "^2.0.0" + npm-run-path "^5.1.0" + onetime "^6.0.0" + signal-exit "^4.1.0" + strip-final-newline "^3.0.0" + express@^4.17.3: version "4.19.2" resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465" @@ -12458,7 +12590,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@~2.3.1, fsevents@~2.3.2: +fsevents@~2.3.1, fsevents@~2.3.2, fsevents@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -12493,7 +12625,7 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-func-name@^2.0.1, get-func-name@^2.0.2: +get-func-name@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41" integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== @@ -12548,6 +12680,11 @@ get-stream@^6.0.0, get-stream@^6.0.1: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== +get-stream@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-8.0.1.tgz#def9dfd71742cd7754a7761ed43749a27d02eca2" + integrity sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA== + get-symbol-description@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" @@ -12657,6 +12794,18 @@ glob@^10.0.0, glob@^10.3.7: minipass "^5.0.0 || ^6.0.2 || ^7.0.0" path-scurry "^1.10.1" +glob@^10.4.1: + version "10.4.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" + integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== + dependencies: + foreground-child "^3.1.0" + jackspeak "^3.1.2" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" + glob@^7.1.3, glob@^7.1.4, glob@^7.2.0: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -13088,6 +13237,11 @@ human-signals@^4.3.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== +human-signals@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28" + integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ== + humanize-ms@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" @@ -13139,6 +13293,11 @@ ignore@^5.0.4, ignore@^5.2.0: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.0.tgz#67418ae40d34d6999c95ff56016759c718c82f78" integrity sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg== +immer@^10.0.4: + version "10.1.1" + resolved "https://registry.yarnpkg.com/immer/-/immer-10.1.1.tgz#206f344ea372d8ea176891545ee53ccc062db7bc" + integrity sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw== + immer@^9.0.19: version "9.0.21" resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.21.tgz#1e025ea31a40f24fb064f1fef23e931496330176" @@ -13667,12 +13826,12 @@ isows@1.0.4: resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.4.tgz#810cd0d90cc4995c26395d2aa4cfa4037ebdf061" integrity sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ== -istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== -istanbul-lib-report@^3.0.0: +istanbul-lib-report@^3.0.0, istanbul-lib-report@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== @@ -13681,19 +13840,19 @@ istanbul-lib-report@^3.0.0: make-dir "^4.0.0" supports-color "^7.1.0" -istanbul-lib-source-maps@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" - integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== +istanbul-lib-source-maps@^5.0.6: + version "5.0.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz#acaef948df7747c8eb5fbf1265cb980f6353a441" + integrity sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A== dependencies: + "@jridgewell/trace-mapping" "^0.3.23" debug "^4.1.1" istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" -istanbul-reports@^3.1.5: - version "3.1.6" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.6.tgz#2544bcab4768154281a2f0870471902704ccaa1a" - integrity sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg== +istanbul-reports@^3.1.7: + version "3.1.7" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.7.tgz#daed12b9e1dca518e15c056e1e537e741280fa0b" + integrity sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g== dependencies: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" @@ -13718,6 +13877,15 @@ jackspeak@^2.3.5: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" +jackspeak@^3.1.2: + version "3.4.3" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" + integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== + dependencies: + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + jake@^10.8.5: version "10.8.7" resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.7.tgz#63a32821177940c33f356e0ba44ff9d34e1c7d8f" @@ -14260,11 +14428,6 @@ loader-runner@^4.2.0: resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== -local-pkg@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/local-pkg/-/local-pkg-0.4.3.tgz#0ff361ab3ae7f1c19113d9bb97b98b905dbc4963" - integrity sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g== - local-pkg@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/local-pkg/-/local-pkg-0.5.0.tgz#093d25a346bae59a99f80e75f6e9d36d7e8c925c" @@ -14456,10 +14619,10 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1, loose-envify@^1.4 dependencies: js-tokens "^3.0.0 || ^4.0.0" -loupe@^2.3.6: - version "2.3.7" - resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.7.tgz#6e69b7d4db7d3ab436328013d37d1c8c3540c697" - integrity sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA== +loupe@^3.1.0, loupe@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/loupe/-/loupe-3.1.1.tgz#71d038d59007d890e3247c5db97c1ec5a92edc54" + integrity sha512-edNu/8D5MKVfGVFRhFf8aAxiTM6Wumfz5XsaatSxlD3w4R1d/WEKUTydCdPGbl9K7QG/Ca3GnDV2sIKIpXRQcw== dependencies: get-func-name "^2.0.1" @@ -14491,6 +14654,11 @@ lru-cache@^10.0.2, "lru-cache@^9.1.1 || ^10.0.0": resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.1.0.tgz#2098d41c2dc56500e6c88584aa656c84de7d0484" integrity sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag== +lru-cache@^10.2.0: + version "10.4.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -14519,12 +14687,21 @@ magic-string@^0.30.0, magic-string@^0.30.5: dependencies: "@jridgewell/sourcemap-codec" "^1.4.15" -magic-string@^0.30.1: - version "0.30.5" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.5.tgz#1994d980bd1c8835dc6e78db7cbd4ae4f24746f9" - integrity sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA== +magic-string@^0.30.10: + version "0.30.11" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.11.tgz#301a6f93b3e8c2cb13ac1a7a673492c0dfd12954" + integrity sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A== dependencies: - "@jridgewell/sourcemap-codec" "^1.4.15" + "@jridgewell/sourcemap-codec" "^1.5.0" + +magicast@^0.3.4: + version "0.3.4" + resolved "https://registry.yarnpkg.com/magicast/-/magicast-0.3.4.tgz#bbda1791d03190a24b00ff3dd18151e7fd381d19" + integrity sha512-TyDF/Pn36bBji9rWKHlZe+PZb6Mx5V8IHCSxk7X4aljM4e/vyDvZZYwHewdVaqiA0nb3ghfHU/6AUpDxWoER2Q== + dependencies: + "@babel/parser" "^7.24.4" + "@babel/types" "^7.24.0" + source-map-js "^1.2.0" make-dir@^2.0.0, make-dir@^2.1.0: version "2.1.0" @@ -14600,11 +14777,6 @@ math-expression-evaluator@^1.2.14: resolved "https://registry.yarnpkg.com/math-expression-evaluator/-/math-expression-evaluator-1.4.0.tgz#3d66031117fbb7b9715ea6c9c68c2cd2eebd37e2" integrity sha512-4vRUvPyxdO8cWULGTh9dZWL2tZK6LDBvj+OGHBER7poH9Qdt7kXEoj20wiz4lQUbUXQZFjPbe5mVDo9nutizCw== -mcl-wasm@^0.7.1: - version "0.7.9" - resolved "https://registry.yarnpkg.com/mcl-wasm/-/mcl-wasm-0.7.9.tgz#c1588ce90042a8700c3b60e40efb339fc07ab87f" - integrity sha512-iJIUcQWA88IJB/5L15GnJVnSQJmf/YaxxV6zRavv83HILHaJQb6y0iFyDMdDO0gN8X37tdxmAOrH/P8B6RB8sQ== - md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" @@ -14810,6 +14982,13 @@ minimatch@^9.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + minimist-options@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -14841,6 +15020,11 @@ minipass@^5.0.0: resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== +minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + minizlib@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" @@ -14877,7 +15061,7 @@ mkdirp@^1.0.3: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -mlly@^1.2.0, mlly@^1.4.0, mlly@^1.4.2: +mlly@^1.2.0, mlly@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/mlly/-/mlly-1.4.2.tgz#7cf406aa319ff6563d25da6b36610a93f2a8007e" integrity sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg== @@ -14970,7 +15154,7 @@ nan@^2.13.2: resolved "https://registry.yarnpkg.com/nan/-/nan-2.18.0.tgz#26a6faae7ffbeb293a39660e88a76b82e30b7554" integrity sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w== -nanoid@^3.3.6: +nanoid@^3.3.6, nanoid@^3.3.7: version "3.3.7" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== @@ -15548,6 +15732,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +package-json-from-dist@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz#e501cd3094b278495eb4258d4c9f6d5ac3019f00" + integrity sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw== + pako@1.0.11: version "1.0.11" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" @@ -15749,6 +15938,14 @@ path-scurry@^1.10.1: lru-cache "^9.1.1 || ^10.0.0" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" +path-scurry@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" + integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== + dependencies: + lru-cache "^10.2.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" @@ -15776,10 +15973,15 @@ pathe@^1.1.0, pathe@^1.1.1: resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.1.tgz#1dd31d382b974ba69809adc9a7a347e65d84829a" integrity sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q== -pathval@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" - integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== +pathe@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.2.tgz#6c4cb47a945692e48a1ddd6e4094d170516437ec" + integrity sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ== + +pathval@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pathval/-/pathval-2.0.0.tgz#7e2550b422601d4f6b8e26f1301bc8f15a741a25" + integrity sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA== pbkdf2@^3.0.16, pbkdf2@^3.0.3, pbkdf2@^3.1.1: version "3.1.2" @@ -15806,6 +16008,11 @@ picocolors@^1.0.0: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== + picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1, picomatch@^2.3.0, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" @@ -15985,7 +16192,7 @@ postcss-value-parser@^4.1.0, postcss-value-parser@^4.2.0: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@^8.4.21, postcss@^8.4.27: +postcss@^8.4.21: version "8.4.31" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== @@ -15994,6 +16201,15 @@ postcss@^8.4.21, postcss@^8.4.27: picocolors "^1.0.0" source-map-js "^1.0.2" +postcss@^8.4.41: + version "8.4.41" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.41.tgz#d6104d3ba272d882fe18fc07d15dc2da62fa2681" + integrity sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ== + dependencies: + nanoid "^3.3.7" + picocolors "^1.0.1" + source-map-js "^1.2.0" + posthtml-parser@^0.10.1: version "0.10.2" resolved "https://registry.yarnpkg.com/posthtml-parser/-/posthtml-parser-0.10.2.tgz#df364d7b179f2a6bf0466b56be7b98fd4e97c573" @@ -16058,7 +16274,7 @@ pretty-error@^4.0.0: lodash "^4.17.20" renderkid "^3.0.0" -pretty-format@^29.5.0, pretty-format@^29.7.0: +pretty-format@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== @@ -16864,11 +17080,6 @@ reduce-css-calc@^1.3.0: math-expression-evaluator "^1.2.14" reduce-function-call "^1.0.1" -reduce-flatten@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27" - integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w== - reduce-function-call@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/reduce-function-call/-/reduce-function-call-1.0.3.tgz#60350f7fb252c0a67eb10fd4694d16909971300f" @@ -17185,11 +17396,29 @@ ripple-lib@^1.10.1: ripple-lib-transactionparser "0.8.2" ws "^7.2.0" -rollup@^3.27.1: - version "3.29.4" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.4.tgz#4d70c0f9834146df8705bfb69a9a19c9e1109981" - integrity sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw== +rollup@^4.13.0: + version "4.20.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.20.0.tgz#f9d602161d29e178f0bf1d9f35f0a26f83939492" + integrity sha512-6rbWBChcnSGzIlXeIdNIZTopKYad8ZG8ajhl78lGRLsI2rX8IkaotQhVas2Ma+GPxJav19wrSzvRvuiv0YKzWw== + dependencies: + "@types/estree" "1.0.5" optionalDependencies: + "@rollup/rollup-android-arm-eabi" "4.20.0" + "@rollup/rollup-android-arm64" "4.20.0" + "@rollup/rollup-darwin-arm64" "4.20.0" + "@rollup/rollup-darwin-x64" "4.20.0" + "@rollup/rollup-linux-arm-gnueabihf" "4.20.0" + "@rollup/rollup-linux-arm-musleabihf" "4.20.0" + "@rollup/rollup-linux-arm64-gnu" "4.20.0" + "@rollup/rollup-linux-arm64-musl" "4.20.0" + "@rollup/rollup-linux-powerpc64le-gnu" "4.20.0" + "@rollup/rollup-linux-riscv64-gnu" "4.20.0" + "@rollup/rollup-linux-s390x-gnu" "4.20.0" + "@rollup/rollup-linux-x64-gnu" "4.20.0" + "@rollup/rollup-linux-x64-musl" "4.20.0" + "@rollup/rollup-win32-arm64-msvc" "4.20.0" + "@rollup/rollup-win32-ia32-msvc" "4.20.0" + "@rollup/rollup-win32-x64-msvc" "4.20.0" fsevents "~2.3.2" rpc-websockets@^7.5.1: @@ -17547,7 +17776,7 @@ signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -signal-exit@^4.0.1: +signal-exit@^4.0.1, signal-exit@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== @@ -17637,6 +17866,11 @@ source-map-js@^1.0.1, source-map-js@^1.0.2: resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== +source-map-js@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" + integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== + source-map-support@^0.5.16, source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -17757,11 +17991,16 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -std-env@^3.3.3, std-env@^3.4.3: +std-env@^3.4.3: version "3.5.0" resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.5.0.tgz#83010c9e29bd99bf6f605df87c19012d82d63b97" integrity sha512-JGUEaALvL0Mf6JCfYnJOTcobY+Nc7sG/TemDRBqCA0wEr4DER7zDchaaixTlmOxAjG1uRJmX82EQcxwTQTkqVA== +std-env@^3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.7.0.tgz#c9f7386ced6ecf13360b6c6c55b8aaa4ef7481d2" + integrity sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg== + store2@^2.14.2, store2@^2.7.1: version "2.14.2" resolved "https://registry.yarnpkg.com/store2/-/store2-2.14.2.tgz#56138d200f9fe5f582ad63bc2704dbc0e4a45068" @@ -17797,25 +18036,7 @@ string-argv@0.3.2: resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -17907,14 +18128,7 @@ stringify-object@^5.0.0: is-obj "^3.0.0" is-regexp "^3.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -17962,13 +18176,6 @@ strip-json-comments@^3.0.1, strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -strip-literal@^1.0.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/strip-literal/-/strip-literal-1.3.0.tgz#db3942c2ec1699e6836ad230090b84bb458e3a07" - integrity sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg== - dependencies: - acorn "^8.10.0" - strong-log-transformer@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz#0f5ed78d325e0421ac6f90f7f10e691d6ae3ae10" @@ -18181,14 +18388,14 @@ terser@^5.10.0, terser@^5.16.8: commander "^2.20.0" source-map-support "~0.5.20" -test-exclude@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" - integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== +test-exclude@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-7.0.1.tgz#20b3ba4906ac20994e275bbcafd68d510264c2a2" + integrity sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg== dependencies: "@istanbuljs/schema" "^0.1.2" - glob "^7.1.4" - minimatch "^3.0.4" + glob "^10.4.1" + minimatch "^9.0.4" text-encoding-utf-8@^1.0.2: version "1.0.2" @@ -18268,25 +18475,30 @@ tiny-secp256k1@^1.1.3, tiny-secp256k1@^1.1.6: elliptic "^6.4.0" nan "^2.13.2" -tinybench@^2.5.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.5.1.tgz#3408f6552125e53a5a48adee31261686fd71587e" - integrity sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg== +tinybench@^2.8.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.9.0.tgz#103c9f8ba6d7237a47ab6dd1dcff77251863426b" + integrity sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg== tinycolor2@^1.4.1: version "1.6.0" resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.6.0.tgz#f98007460169b0263b97072c5ae92484ce02d09e" integrity sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw== -tinypool@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.6.0.tgz#c3640b851940abe2168497bb6e43b49fafb3ba7b" - integrity sha512-FdswUUo5SxRizcBc6b1GSuLpLjisa8N8qMyYoP3rl+bym+QauhtJP5bvZY1ytt8krKGmMLYIRl36HBZfeAoqhQ== +tinypool@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-1.0.0.tgz#a68965218e04f4ad9de037d2a1cd63cda9afb238" + integrity sha512-KIKExllK7jp3uvrNtvRBYBWBOAXSX8ZvoaD8T+7KB/QHIuoJW3Pmr60zucywjAlMb5TeXUkcs/MWeWLu0qvuAQ== -tinyspy@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/tinyspy/-/tinyspy-2.2.0.tgz#9dc04b072746520b432f77ea2c2d17933de5d6ce" - integrity sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg== +tinyrainbow@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/tinyrainbow/-/tinyrainbow-1.2.0.tgz#5c57d2fc0fb3d1afd78465c33ca885d04f02abb5" + integrity sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ== + +tinyspy@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/tinyspy/-/tinyspy-3.0.0.tgz#cb61644f2713cd84dee184863f4642e06ddf0585" + integrity sha512-q5nmENpTHgiPVd1cJDDc9cVoYN5x4vCvwT3FMilvKPKneCBZAxn2YWQjDF0UMcE9k0Cay1gBiDfTMU0g+mPMQA== tmp@^0.0.33: version "0.0.33" @@ -18434,11 +18646,6 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" -type-detect@^4.0.0, type-detect@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== - type-fest@^0.16.0: version "0.16.0" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.16.0.tgz#3240b891a78b0deae910dbeb86553e552a148860" @@ -18815,6 +19022,11 @@ use-sync-external-store@1.2.0: resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== +use-sync-external-store@1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz#c3b6390f3a30eba13200d2302dcdf1e7b57b2ef9" + integrity sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw== + utf-8-validate@^5.0.2, utf-8-validate@^5.0.5: version "5.0.10" resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" @@ -18878,15 +19090,6 @@ v8-compile-cache@2.3.0: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== -v8-to-istanbul@^9.1.0: - version "9.2.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz#2ed7644a245cddd83d4e087b9b33b3e62dfd10ad" - integrity sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA== - dependencies: - "@jridgewell/trace-mapping" "^0.3.12" - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^2.0.0" - validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -18939,72 +19142,66 @@ viem@^1.0.0: ws "8.13.0" viem@^2.1.1: - version "2.19.7" - resolved "https://registry.yarnpkg.com/viem/-/viem-2.19.7.tgz#719006feb0e7f57c790242f62629737f4518752a" - integrity sha512-zoaBWnI6vf7MVRn4lAbuKd25hR31088yrMqONMHU8RjHTY4nqf+O589BPODwJak1LkfpbawyGyCY2tRFwZCWgw== + version "2.21.9" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.21.9.tgz#5676f81b07286ad88852a239e1eeb18c7f9b40a6" + integrity sha512-fWPDX2ABEo/mLiDN+wsmYJDJk0a/ZCafquxInR2+HZv/7UTgHbLgjZs4SotpEeFAYjgVThJ7A9TPmrRjaaYqvw== dependencies: "@adraffy/ens-normalize" "1.10.0" "@noble/curves" "1.4.0" "@noble/hashes" "1.4.0" "@scure/bip32" "1.4.0" - "@scure/bip39" "1.3.0" + "@scure/bip39" "1.4.0" abitype "1.0.5" isows "1.0.4" webauthn-p256 "0.0.5" ws "8.17.1" -vite-node@0.33.0: - version "0.33.0" - resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-0.33.0.tgz#c6a3a527e0b8090da7436241bc875760ae0eef28" - integrity sha512-19FpHYbwWWxDr73ruNahC+vtEdza52kA90Qb3La98yZ0xULqV8A5JLNPUff0f5zID4984tW7l3DH2przTJUZSw== +vite-node@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-2.0.5.tgz#36d909188fc6e3aba3da5fc095b3637d0d18e27b" + integrity sha512-LdsW4pxj0Ot69FAoXZ1yTnA9bjGohr2yNBU7QKRxpz8ITSkhuDl6h3zS/tvgz4qrNjeRnvrWeXQ8ZF7Um4W00Q== dependencies: cac "^6.7.14" - debug "^4.3.4" - mlly "^1.4.0" - pathe "^1.1.1" - picocolors "^1.0.0" - vite "^3.0.0 || ^4.0.0" + debug "^4.3.5" + pathe "^1.1.2" + tinyrainbow "^1.2.0" + vite "^5.0.0" -"vite@^3.0.0 || ^4.0.0": - version "4.5.3" - resolved "https://registry.yarnpkg.com/vite/-/vite-4.5.3.tgz#d88a4529ea58bae97294c7e2e6f0eab39a50fb1a" - integrity sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg== +vite@^5.0.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/vite/-/vite-5.4.1.tgz#2aa72370de824d23f53658affd807e4c9905b058" + integrity sha512-1oE6yuNXssjrZdblI9AfBbHCC41nnyoVoEZxQnID6yvQZAFBzxxkqoFLtHUMkYunL8hwOLEjgTuxpkRxvba3kA== dependencies: - esbuild "^0.18.10" - postcss "^8.4.27" - rollup "^3.27.1" + esbuild "^0.21.3" + postcss "^8.4.41" + rollup "^4.13.0" optionalDependencies: - fsevents "~2.3.2" + fsevents "~2.3.3" -vitest@^0.33.0: - version "0.33.0" - resolved "https://registry.yarnpkg.com/vitest/-/vitest-0.33.0.tgz#e2be6153aec1d30e3460ac6d64265bf72da2551c" - integrity sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ== - dependencies: - "@types/chai" "^4.3.5" - "@types/chai-subset" "^1.3.3" - "@types/node" "*" - "@vitest/expect" "0.33.0" - "@vitest/runner" "0.33.0" - "@vitest/snapshot" "0.33.0" - "@vitest/spy" "0.33.0" - "@vitest/utils" "0.33.0" - acorn "^8.9.0" - acorn-walk "^8.2.0" - cac "^6.7.14" - chai "^4.3.7" - debug "^4.3.4" - local-pkg "^0.4.3" - magic-string "^0.30.1" - pathe "^1.1.1" - picocolors "^1.0.0" - std-env "^3.3.3" - strip-literal "^1.0.1" - tinybench "^2.5.0" - tinypool "^0.6.0" - vite "^3.0.0 || ^4.0.0" - vite-node "0.33.0" - why-is-node-running "^2.2.2" +vitest@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/vitest/-/vitest-2.0.5.tgz#2f15a532704a7181528e399cc5b754c7f335fd62" + integrity sha512-8GUxONfauuIdeSl5f9GTgVEpg5BTOlplET4WEDaeY2QBiN8wSm68vxN/tb5z405OwppfoCavnwXafiaYBC/xOA== + dependencies: + "@ampproject/remapping" "^2.3.0" + "@vitest/expect" "2.0.5" + "@vitest/pretty-format" "^2.0.5" + "@vitest/runner" "2.0.5" + "@vitest/snapshot" "2.0.5" + "@vitest/spy" "2.0.5" + "@vitest/utils" "2.0.5" + chai "^5.1.1" + debug "^4.3.5" + execa "^8.0.1" + magic-string "^0.30.10" + pathe "^1.1.2" + std-env "^3.7.0" + tinybench "^2.8.0" + tinypool "^1.0.0" + tinyrainbow "^1.2.0" + vite "^5.0.0" + vite-node "2.0.5" + why-is-node-running "^2.3.0" vm-browserify@^1.1.2: version "1.1.2" @@ -19217,10 +19414,10 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -why-is-node-running@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/why-is-node-running/-/why-is-node-running-2.2.2.tgz#4185b2b4699117819e7154594271e7e344c9973e" - integrity sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA== +why-is-node-running@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/why-is-node-running/-/why-is-node-running-2.3.0.tgz#a3f69a97107f494b3cdc3bdddd883a7d65cebf04" + integrity sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w== dependencies: siginfo "^2.0.0" stackback "0.0.2" @@ -19244,15 +19441,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -wordwrapjs@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f" - integrity sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA== - dependencies: - reduce-flatten "^2.0.0" - typical "^5.2.0" - -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -19270,15 +19459,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" @@ -19462,3 +19642,10 @@ zustand@^4.3.2: integrity sha512-Rb16eW55gqL4W2XZpJh0fnrATxYEG3Apl2gfHTyDSE965x/zxslTikpNch0JgNjJA9zK6gEFW8Fl6d1rTZaqgg== dependencies: use-sync-external-store "1.2.0" + +zustand@^4.5.2: + version "4.5.5" + resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.5.5.tgz#f8c713041543715ec81a2adda0610e1dc82d4ad1" + integrity sha512-+0PALYNJNgK6hldkgDq2vLrw5f6g/jCInz52n9RTpropGgeAf/ioFUCdtsjCqu4gNhW9D01rUQBROoRjdzyn2Q== + dependencies: + use-sync-external-store "1.2.2"