diff --git a/bun.lockb b/bun.lockb index d57378724..b9c658fc7 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 9041ebbee..218500f84 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@wharfkit/resources": "^1.2.3", "@wharfkit/roborovski": "^1.0.0", "@wharfkit/session": "^1.4.0", + "@wharfkit/transact-plugin-resource-provider": "^1.1.1", "@wharfkit/wallet-plugin-anchor": "^1.4.0", "@wharfkit/wallet-plugin-metamask": "1.0.0-rc8", "@wharfkit/wallet-plugin-privatekey": "^1.1.0", diff --git a/src/lib/state/client/wharf.svelte.ts b/src/lib/state/client/wharf.svelte.ts index 841ce67e1..d118bb58e 100644 --- a/src/lib/state/client/wharf.svelte.ts +++ b/src/lib/state/client/wharf.svelte.ts @@ -10,6 +10,7 @@ import { type SerializedSession, type TransactArgs, type TransactOptions, + type TransactPlugin, type TransactResult, type WalletPlugin, Session, @@ -22,11 +23,13 @@ import { WalletPluginPrivateKey } from '@wharfkit/wallet-plugin-privatekey'; import { WalletPluginWombat } from '@wharfkit/wallet-plugin-wombat'; import { WalletPluginScatter } from '@wharfkit/wallet-plugin-scatter'; import { WalletPluginTokenPocket } from '@wharfkit/wallet-plugin-tokenpocket'; +import { TransactPluginResourceProvider } from '@wharfkit/transact-plugin-resource-provider'; import { AccountCreationPluginMetamask } from '@wharfkit/account-creation-plugin-metamask'; import { AccountCreationPluginGreymass } from '@wharfkit/account-creation-plugin-greymass'; import { TransactPluginStatusEmitter } from '$lib/wharf/plugins/status'; + import { type QueuedTransaction, StatusType, @@ -50,6 +53,11 @@ const accountCreationPlugins: AccountCreationPlugin[] = [ new AccountCreationPluginGreymass() ]; +const transactPlugins: TransactPlugin[] = [ + new TransactPluginStatusEmitter(), + new TransactPluginResourceProvider() +]; + // If a local key is provided, add the private key wallet if (PUBLIC_LOCAL_SIGNER) { walletPlugins.unshift(new WalletPluginPrivateKey(PUBLIC_LOCAL_SIGNER)); @@ -80,7 +88,8 @@ export class WharfState { walletPlugins }, { - accountCreationPlugins + accountCreationPlugins, + transactPlugins } ); $effect(() => { @@ -173,19 +182,14 @@ export class WharfState { options }; - const result = await this.session - .transact(args, { - ...options, - transactPlugins: [new TransactPluginStatusEmitter()] - }) - .catch((e: Error) => { - transaction.status = StatusType.ERROR; - transaction.error = String(e); - queueTransaction(transaction); - const { id } = sendErrorToast(transaction); - transaction.toastId = id; - throw e; - }); + const result = await this.session.transact(args).catch((e: Error) => { + transaction.status = StatusType.ERROR; + transaction.error = String(e); + queueTransaction(transaction); + const { id } = sendErrorToast(transaction); + transaction.toastId = id; + throw e; + }); if (!result.resolved || !result.response) { transaction.status = StatusType.ERROR; diff --git a/yarn.lock b/yarn.lock index 6b3f1972c..386fa49ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,6 +1,6 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 -# bun ./bun.lockb --hash: 48C7A666F9C95E3C-fcd1ec80bbafc1de-F0A73B2FA43BB259-06aaab72026e0abd +# bun ./bun.lockb --hash: A4F171440C5B490A-21903874e3f4a24d-976E6F38189A24BC-b4d5738a4b21bcd1 "@alloc/quick-lru@^5.2.0": @@ -1524,6 +1524,13 @@ bn.js "^4.11.9" tslib "^2.1.0" +"@wharfkit/transact-plugin-resource-provider@^1.1.1": + version "1.1.1" + resolved "https://registry.npmjs.org/@wharfkit/transact-plugin-resource-provider/-/transact-plugin-resource-provider-1.1.1.tgz" + integrity sha512-y1VyXPyiO2ihPBej1FKhkuVh3UN5li+Bvjp5CIeNkL6XtmYw4Vdax9hO31qem3zs84YE+vB8WvogoSSICAU10Q== + dependencies: + tslib "^2.1.0" + "@wharfkit/wallet-plugin-anchor@^1.4.0": version "1.4.0" resolved "https://registry.npmjs.org/@wharfkit/wallet-plugin-anchor/-/wallet-plugin-anchor-1.4.0.tgz"