@ocap/tx-protocols 1.29.4 → 1.29.6

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.
Files changed (89) hide show
  1. package/esm/execute.d.mts +5 -0
  2. package/esm/execute.mjs +61 -4
  3. package/esm/index.d.mts +737 -73
  4. package/esm/index.mjs +2 -1
  5. package/esm/pipes/write-ledger.d.mts +73 -0
  6. package/esm/pipes/write-ledger.mjs +97 -0
  7. package/esm/protocols/account/delegate.d.mts +52 -1
  8. package/esm/protocols/account/migrate.d.mts +15 -1
  9. package/esm/protocols/account/revoke-delegate.d.mts +14 -1
  10. package/esm/protocols/asset/acquire-v2.d.mts +39 -1
  11. package/esm/protocols/asset/acquire-v3.d.mts +43 -1
  12. package/esm/protocols/asset/calls/transfer-token.d.mts +4 -1
  13. package/esm/protocols/asset/calls/transfer.d.mts +4 -1
  14. package/esm/protocols/asset/consume.d.mts +14 -1
  15. package/esm/protocols/asset/create.d.mts +23 -1
  16. package/esm/protocols/asset/mint.d.mts +28 -1
  17. package/esm/protocols/asset/update.d.mts +15 -1
  18. package/esm/protocols/factory/create.d.mts +23 -1
  19. package/esm/protocols/governance/claim-stake.d.mts +24 -1
  20. package/esm/protocols/governance/return-stake.d.mts +20 -1
  21. package/esm/protocols/governance/revoke-stake.d.mts +20 -1
  22. package/esm/protocols/governance/slash-stake.d.mts +30 -1
  23. package/esm/protocols/governance/stake.d.mts +27 -1
  24. package/esm/protocols/rollup/claim-reward.d.mts +57 -1
  25. package/esm/protocols/rollup/close.d.mts +16 -1
  26. package/esm/protocols/rollup/create-block.d.mts +42 -1
  27. package/esm/protocols/rollup/create.d.mts +28 -1
  28. package/esm/protocols/rollup/join.d.mts +18 -1
  29. package/esm/protocols/rollup/leave.d.mts +16 -1
  30. package/esm/protocols/rollup/migrate.d.mts +11 -1
  31. package/esm/protocols/rollup/pause.d.mts +11 -1
  32. package/esm/protocols/rollup/resume.d.mts +11 -1
  33. package/esm/protocols/rollup/update.d.mts +11 -1
  34. package/esm/protocols/token/create.d.mts +14 -1
  35. package/esm/protocols/token/deposit-v2.d.mts +23 -1
  36. package/esm/protocols/token/withdraw-v2.d.mts +33 -1
  37. package/esm/protocols/token-factory/burn.d.mts +29 -1
  38. package/esm/protocols/token-factory/create.d.mts +16 -1
  39. package/esm/protocols/token-factory/mint.d.mts +27 -1
  40. package/esm/protocols/token-factory/update.d.mts +15 -1
  41. package/esm/protocols/trade/exchange-v2.d.mts +40 -1
  42. package/esm/protocols/trade/transfer-v2.d.mts +32 -1
  43. package/esm/protocols/trade/transfer-v3.d.mts +31 -1
  44. package/esm/util.d.mts +1 -1
  45. package/lib/execute.cjs +61 -4
  46. package/lib/execute.d.cts +5 -0
  47. package/lib/index.cjs +2 -0
  48. package/lib/index.d.cts +737 -73
  49. package/lib/pipes/write-ledger.cjs +102 -0
  50. package/lib/pipes/write-ledger.d.cts +73 -0
  51. package/lib/protocols/account/delegate.d.cts +52 -1
  52. package/lib/protocols/account/migrate.d.cts +15 -1
  53. package/lib/protocols/account/revoke-delegate.d.cts +14 -1
  54. package/lib/protocols/asset/acquire-v2.d.cts +39 -1
  55. package/lib/protocols/asset/acquire-v3.d.cts +43 -1
  56. package/lib/protocols/asset/calls/transfer-token.d.cts +4 -1
  57. package/lib/protocols/asset/calls/transfer.d.cts +4 -1
  58. package/lib/protocols/asset/consume.d.cts +14 -1
  59. package/lib/protocols/asset/create.d.cts +23 -1
  60. package/lib/protocols/asset/mint.d.cts +28 -1
  61. package/lib/protocols/asset/update.d.cts +15 -1
  62. package/lib/protocols/factory/create.d.cts +23 -1
  63. package/lib/protocols/governance/claim-stake.d.cts +24 -1
  64. package/lib/protocols/governance/return-stake.d.cts +20 -1
  65. package/lib/protocols/governance/revoke-stake.d.cts +20 -1
  66. package/lib/protocols/governance/slash-stake.d.cts +30 -1
  67. package/lib/protocols/governance/stake.d.cts +27 -1
  68. package/lib/protocols/rollup/claim-reward.d.cts +57 -1
  69. package/lib/protocols/rollup/close.d.cts +16 -1
  70. package/lib/protocols/rollup/create-block.d.cts +42 -1
  71. package/lib/protocols/rollup/create.d.cts +28 -1
  72. package/lib/protocols/rollup/join.d.cts +18 -1
  73. package/lib/protocols/rollup/leave.d.cts +16 -1
  74. package/lib/protocols/rollup/migrate.d.cts +11 -1
  75. package/lib/protocols/rollup/pause.d.cts +11 -1
  76. package/lib/protocols/rollup/resume.d.cts +11 -1
  77. package/lib/protocols/rollup/update.d.cts +11 -1
  78. package/lib/protocols/token/create.d.cts +14 -1
  79. package/lib/protocols/token/deposit-v2.d.cts +23 -1
  80. package/lib/protocols/token/withdraw-v2.d.cts +33 -1
  81. package/lib/protocols/token-factory/burn.d.cts +29 -1
  82. package/lib/protocols/token-factory/create.d.cts +16 -1
  83. package/lib/protocols/token-factory/mint.d.cts +27 -1
  84. package/lib/protocols/token-factory/update.d.cts +15 -1
  85. package/lib/protocols/trade/exchange-v2.d.cts +40 -1
  86. package/lib/protocols/trade/transfer-v2.d.cts +32 -1
  87. package/lib/protocols/trade/transfer-v3.d.cts +31 -1
  88. package/lib/util.d.cts +2 -2
  89. package/package.json +20 -19
@@ -1,3 +1,6 @@
1
+ import { IAssetState, IReadyContext, ITokenState, IWithReceivers, IWithSender, IWithSigners, TTransferV3Tx } from "@ocap/types";
2
+ import { Runner } from "@ocap/tx-pipeline";
3
+
1
4
  //#region src/protocols/trade/transfer-v3.d.ts
2
5
  /** Token input type */
3
6
  interface TokenInput {
@@ -12,6 +15,33 @@ interface MultiInput {
12
15
  assetsList?: string[];
13
16
  assets?: string[];
14
17
  }
15
- declare const runner: any;
18
+ /**
19
+ * Context type for transfer-v3 protocol.
20
+ * Phase: IReadyContext (after TakeStateSnapshot)
21
+ * Mixins: IWithSender, IWithSigners, IWithReceivers (all optional as states may not exist initially)
22
+ */
23
+ type Context = IReadyContext<TTransferV3Tx> & Partial<IWithSender> & Partial<IWithSigners> & Partial<IWithReceivers> & {
24
+ /** Parsed inputs from itx */
25
+ inputs?: MultiInput[];
26
+ /** Parsed outputs from itx */
27
+ outputs?: MultiInput[];
28
+ /** Sender addresses extracted from inputs */
29
+ senders?: string[];
30
+ /** Receiver addresses extracted from outputs */
31
+ receivers?: string[];
32
+ /** Token addresses from inputs */
33
+ inputTokens?: string[];
34
+ /** Asset addresses from inputs */
35
+ inputAssets?: string[];
36
+ /** Token addresses from outputs */
37
+ outputTokens?: string[];
38
+ /** Asset addresses from outputs */
39
+ outputAssets?: string[];
40
+ /** Token states for transferred tokens */
41
+ tokenStates?: ITokenState[];
42
+ /** Asset states for transferred assets */
43
+ assetStates?: IAssetState[];
44
+ };
45
+ declare const runner: Runner<Context>;
16
46
  //#endregion
17
47
  export { MultiInput, TokenInput, runner as default };
package/lib/util.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IChainConfig, IStakeState, TokenBalanceMap } from "@ocap/types";
2
- import { BN } from "@ocap/util";
3
2
  import { AnyData } from "@ocap/message";
3
+ import { BN } from "@ocap/util";
4
4
 
5
5
  //#region src/util.d.ts
6
6
  /** Token update input for applyTokenUpdates */
@@ -111,7 +111,7 @@ interface ITokenInputForFix {
111
111
  value: string;
112
112
  }>;
113
113
  }
114
- declare const RATE_BASE: any;
114
+ declare const RATE_BASE: BN;
115
115
  declare const decodeAnySafe: (encoded: AnyData | null) => AnyData | null;
116
116
  declare const applyTokenUpdates: (tokens: ITokenUpdateInput[], state: IStateWithTokens | IStateWithTokens[] | null | undefined, operator: "add" | "sub") => IStateWithTokens | IStateWithTokens[] | Record<string, string>;
117
117
  declare const applyTokenChange: (state: IStateWithTokens | IStateWithTokens[], change: ITokenChange) => IStateWithTokens | IStateWithTokens[] | Record<string, never>;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.29.4",
6
+ "version": "1.29.6",
7
7
  "description": "Predefined tx pipeline sets to execute certain type of transactions",
8
8
  "type": "module",
9
9
  "main": "./lib/index.cjs",
@@ -39,28 +39,29 @@
39
39
  "lint:fix": "biome check --write",
40
40
  "test": "bun test",
41
41
  "test:ci": "bun test --coverage",
42
- "coverage": "bun test --coverage"
42
+ "coverage": "bun test --coverage",
43
+ "clean": "rm -rf lib esm"
43
44
  },
44
45
  "keywords": [],
45
46
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
46
47
  "license": "MIT",
47
48
  "dependencies": {
48
- "@arcblock/did": "1.29.4",
49
- "@arcblock/did-util": "1.29.4",
50
- "@arcblock/jwt": "1.29.4",
51
- "@arcblock/validator": "1.29.4",
52
- "@arcblock/vc": "1.29.4",
49
+ "@arcblock/did": "1.29.6",
50
+ "@arcblock/did-util": "1.29.6",
51
+ "@arcblock/jwt": "1.29.6",
52
+ "@arcblock/validator": "1.29.6",
53
+ "@arcblock/vc": "1.29.6",
53
54
  "@blocklet/xss": "^0.3.7",
54
- "@ocap/asset": "1.29.4",
55
- "@ocap/client": "1.29.4",
56
- "@ocap/mcrypto": "1.29.4",
57
- "@ocap/merkle-tree": "1.29.4",
58
- "@ocap/message": "1.29.4",
59
- "@ocap/state": "1.29.4",
60
- "@ocap/tx-pipeline": "1.29.4",
61
- "@ocap/types": "1.29.4",
62
- "@ocap/util": "1.29.4",
63
- "@ocap/wallet": "1.29.4",
55
+ "@ocap/asset": "1.29.6",
56
+ "@ocap/client": "1.29.6",
57
+ "@ocap/mcrypto": "1.29.6",
58
+ "@ocap/merkle-tree": "1.29.6",
59
+ "@ocap/message": "1.29.6",
60
+ "@ocap/state": "1.29.6",
61
+ "@ocap/tx-pipeline": "1.29.6",
62
+ "@ocap/types": "1.29.6",
63
+ "@ocap/util": "1.29.6",
64
+ "@ocap/wallet": "1.29.6",
64
65
  "debug": "^4.4.3",
65
66
  "deep-diff": "^1.0.2",
66
67
  "lodash": "^4.17.23",
@@ -71,8 +72,8 @@
71
72
  "elliptic": "6.5.3"
72
73
  },
73
74
  "devDependencies": {
74
- "@ocap/e2e-test": "1.29.4",
75
- "@ocap/statedb-memory": "1.29.4",
75
+ "@ocap/e2e-test": "1.29.6",
76
+ "@ocap/statedb-memory": "1.29.6",
76
77
  "@types/debug": "^4.1.12",
77
78
  "@types/lodash": "^4.17.16",
78
79
  "start-server-and-test": "^1.14.0"