@latticexyz/common 2.2.7-main-58f101e45ad50e064779cbc441246a22b70efa07 → 2.2.8-main-7c7bdb26d0f87e2a5fc20c4eb34abb5167000ab9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.ts +1 -1
- package/dist/actions.js +1 -1
- package/dist/actions.js.map +1 -1
- package/package.json +2 -2
package/dist/actions.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ type TransactionQueueOptions<chain extends Chain> = {
|
|
|
17
17
|
*/
|
|
18
18
|
queueConcurrency?: number;
|
|
19
19
|
};
|
|
20
|
-
declare function transactionQueue<chain extends Chain
|
|
20
|
+
declare function transactionQueue<chain extends Chain>(opts?: TransactionQueueOptions<chain>): <transport extends Transport, account extends Account | undefined = Account | undefined>(client: Client<transport, chain, account>) => Pick<WalletActions<chain, account>, "writeContract" | "sendTransaction">;
|
|
21
21
|
|
|
22
22
|
type WriteObserverParameters = {
|
|
23
23
|
onWrite: (write: ContractWrite) => void;
|
package/dist/actions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as o,e as a}from"./chunk-3XILP7OL.js";import"./chunk-TCWGPC6G.js";function
|
|
1
|
+
import{d as o,e as a}from"./chunk-3XILP7OL.js";import"./chunk-TCWGPC6G.js";function m(n={}){return r=>({writeContract:t=>o(r,t,n),sendTransaction:t=>a(r,t,n)})}import{getAction as s}from"viem/utils";import{writeContract as u}from"viem/actions";function h({onWrite:n}){let r=0;return t=>({writeContract:e=>{let i=s(t,u,"writeContract")(e),c=`${t.chain.id}:${t.account.address}:${r++}`;return n({id:c,request:e,result:i}),i}})}export{m as transactionQueue,h as writeObserver};
|
|
2
2
|
//# sourceMappingURL=actions.js.map
|
package/dist/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/actions/transactionQueue.ts","../src/actions/writeObserver.ts"],"sourcesContent":["import type { Transport, Chain, Account, WalletActions, Client, PublicClient } from \"viem\";\nimport { writeContract as mud_writeContract } from \"../writeContract\";\nimport { sendTransaction as mud_sendTransaction } from \"../sendTransaction\";\n\nexport type TransactionQueueOptions<chain extends Chain> = {\n /**\n * `publicClient` can be provided to be used in place of the extended viem client for making public action calls\n * (`getChainId`, `getTransactionCount`, `simulateContract`, `call`). This helps in cases where the extended\n * viem client is a smart account client, like in [permissionless.js](https://github.com/pimlicolabs/permissionless.js),\n * where the transport is the bundler, not an RPC.\n */\n publicClient?: PublicClient<Transport, chain>;\n /**\n * Adjust the number of concurrent calls to the mempool. This defaults to `1` to ensure transactions are ordered\n * and nonces are handled properly. Any number greater than that is likely to see nonce errors and/or transactions\n * arriving out of order, but this may be an acceptable trade-off for some applications that can safely retry.\n * @default 1\n */\n queueConcurrency?: number;\n};\n\nexport function transactionQueue<chain extends Chain
|
|
1
|
+
{"version":3,"sources":["../src/actions/transactionQueue.ts","../src/actions/writeObserver.ts"],"sourcesContent":["import type { Transport, Chain, Account, WalletActions, Client, PublicClient } from \"viem\";\nimport { writeContract as mud_writeContract } from \"../writeContract\";\nimport { sendTransaction as mud_sendTransaction } from \"../sendTransaction\";\n\nexport type TransactionQueueOptions<chain extends Chain> = {\n /**\n * `publicClient` can be provided to be used in place of the extended viem client for making public action calls\n * (`getChainId`, `getTransactionCount`, `simulateContract`, `call`). This helps in cases where the extended\n * viem client is a smart account client, like in [permissionless.js](https://github.com/pimlicolabs/permissionless.js),\n * where the transport is the bundler, not an RPC.\n */\n publicClient?: PublicClient<Transport, chain>;\n /**\n * Adjust the number of concurrent calls to the mempool. This defaults to `1` to ensure transactions are ordered\n * and nonces are handled properly. Any number greater than that is likely to see nonce errors and/or transactions\n * arriving out of order, but this may be an acceptable trade-off for some applications that can safely retry.\n * @default 1\n */\n queueConcurrency?: number;\n};\n\nexport function transactionQueue<chain extends Chain>(\n opts: TransactionQueueOptions<chain> = {},\n): <transport extends Transport, account extends Account | undefined = Account | undefined>(\n client: Client<transport, chain, account>,\n) => Pick<WalletActions<chain, account>, \"writeContract\" | \"sendTransaction\"> {\n return (client) => ({\n // Applies to: `client.writeContract`, `getContract(client, ...).write`\n writeContract: (args) => mud_writeContract(client, args, opts),\n // Applies to: `client.sendTransaction`\n sendTransaction: (args) => mud_sendTransaction(client, args, opts),\n });\n}\n","import type {\n WriteContractParameters,\n Transport,\n Chain,\n Account,\n WalletActions,\n WriteContractReturnType,\n Client,\n} from \"viem\";\nimport { getAction } from \"viem/utils\";\nimport { writeContract } from \"viem/actions\";\nimport { type ContractWrite } from \"../getContract\";\n\ntype WriteObserverParameters = { onWrite: (write: ContractWrite) => void };\n\nexport function writeObserver<TChain extends Chain, TAccount extends Account>({\n onWrite,\n}: WriteObserverParameters): (\n client: Client<Transport, TChain, TAccount>,\n) => Pick<WalletActions<TChain, TAccount>, \"writeContract\"> {\n let nextWriteId = 0;\n\n return (client) => ({\n // Applies to: `client.writeContract`, `getContract(client, ...).write`\n writeContract: (args): Promise<WriteContractReturnType> => {\n const result = getAction(client, writeContract, \"writeContract\")(args);\n\n const id = `${client.chain.id}:${client.account.address}:${nextWriteId++}`;\n onWrite({ id, request: args as WriteContractParameters, result });\n\n return result;\n },\n });\n}\n"],"mappings":"2EAqBO,SAASA,EACdC,EAAuC,CAAC,EAGoC,CAC5E,OAAQC,IAAY,CAElB,cAAgBC,GAASC,EAAkBF,EAAQC,EAAMF,CAAI,EAE7D,gBAAkBE,GAASE,EAAoBH,EAAQC,EAAMF,CAAI,CACnE,EACF,CCvBA,OAAS,aAAAK,MAAiB,aAC1B,OAAS,iBAAAC,MAAqB,eAKvB,SAASC,EAA8D,CAC5E,QAAAC,CACF,EAE4D,CAC1D,IAAIC,EAAc,EAElB,OAAQC,IAAY,CAElB,cAAgBC,GAA2C,CACzD,IAAMC,EAASP,EAAUK,EAAQJ,EAAe,eAAe,EAAEK,CAAI,EAE/DE,EAAK,GAAGH,EAAO,MAAM,MAAMA,EAAO,QAAQ,WAAWD,MAC3D,OAAAD,EAAQ,CAAE,GAAAK,EAAI,QAASF,EAAiC,OAAAC,CAAO,CAAC,EAEzDA,CACT,CACF,EACF","names":["transactionQueue","opts","client","args","writeContract","sendTransaction","getAction","writeContract","writeObserver","onWrite","nextWriteId","client","args","result","id"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latticexyz/common",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8-main-7c7bdb26d0f87e2a5fc20c4eb34abb5167000ab9",
|
|
4
4
|
"description": "Common low level logic shared between packages",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"prettier": "3.2.5",
|
|
66
66
|
"prettier-plugin-solidity": "1.3.1",
|
|
67
67
|
"viem": "2.21.6",
|
|
68
|
-
"@latticexyz/schema-type": "2.2.
|
|
68
|
+
"@latticexyz/schema-type": "2.2.8-main-7c7bdb26d0f87e2a5fc20c4eb34abb5167000ab9"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/debug": "^4.1.7",
|