@ocap/tx-protocols 1.28.9 → 1.29.0

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 (284) hide show
  1. package/esm/execute.d.mts +53 -0
  2. package/esm/execute.mjs +225 -0
  3. package/esm/index.d.mts +95 -0
  4. package/esm/index.mjs +100 -0
  5. package/esm/pipes/ensure-cost.d.mts +18 -0
  6. package/esm/pipes/ensure-cost.mjs +136 -0
  7. package/esm/pipes/ensure-gas.d.mts +14 -0
  8. package/esm/pipes/ensure-gas.mjs +38 -0
  9. package/esm/protocols/account/delegate.d.mts +4 -0
  10. package/esm/protocols/account/delegate.mjs +195 -0
  11. package/esm/protocols/account/migrate.d.mts +4 -0
  12. package/esm/protocols/account/migrate.mjs +130 -0
  13. package/esm/protocols/account/revoke-delegate.d.mts +4 -0
  14. package/esm/protocols/account/revoke-delegate.mjs +102 -0
  15. package/esm/protocols/asset/acquire-v2.d.mts +9 -0
  16. package/esm/protocols/asset/acquire-v2.mjs +213 -0
  17. package/esm/protocols/asset/acquire-v3.d.mts +17 -0
  18. package/esm/protocols/asset/acquire-v3.mjs +265 -0
  19. package/esm/protocols/asset/calls/transfer-token.d.mts +4 -0
  20. package/esm/protocols/asset/calls/transfer-token.mjs +36 -0
  21. package/esm/protocols/asset/calls/transfer.d.mts +4 -0
  22. package/esm/protocols/asset/calls/transfer.mjs +32 -0
  23. package/esm/protocols/asset/consume.d.mts +4 -0
  24. package/esm/protocols/asset/consume.mjs +92 -0
  25. package/esm/protocols/asset/create.d.mts +4 -0
  26. package/esm/protocols/asset/create.mjs +136 -0
  27. package/esm/protocols/asset/mint.d.mts +4 -0
  28. package/esm/protocols/asset/mint.mjs +156 -0
  29. package/esm/protocols/asset/pipes/exec-mint-hook.d.mts +24 -0
  30. package/esm/protocols/asset/pipes/exec-mint-hook.mjs +54 -0
  31. package/esm/protocols/asset/pipes/extract-factory-tokens.d.mts +21 -0
  32. package/esm/protocols/asset/pipes/extract-factory-tokens.mjs +22 -0
  33. package/esm/protocols/asset/pipes/verify-itx-address.d.mts +32 -0
  34. package/esm/protocols/asset/pipes/verify-itx-address.mjs +56 -0
  35. package/esm/protocols/asset/pipes/verify-itx-assets.d.mts +18 -0
  36. package/esm/protocols/asset/pipes/verify-itx-assets.mjs +27 -0
  37. package/esm/protocols/asset/pipes/verify-itx-variables.d.mts +17 -0
  38. package/esm/protocols/asset/pipes/verify-itx-variables.mjs +20 -0
  39. package/esm/protocols/asset/pipes/verify-mint-limit.d.mts +15 -0
  40. package/esm/protocols/asset/pipes/verify-mint-limit.mjs +14 -0
  41. package/esm/protocols/asset/update.d.mts +4 -0
  42. package/esm/protocols/asset/update.mjs +111 -0
  43. package/esm/protocols/factory/create.d.mts +29 -0
  44. package/esm/protocols/factory/create.mjs +155 -0
  45. package/esm/protocols/governance/claim-stake.d.mts +27 -0
  46. package/esm/protocols/governance/claim-stake.mjs +220 -0
  47. package/esm/protocols/governance/return-stake.d.mts +27 -0
  48. package/esm/protocols/governance/return-stake.mjs +211 -0
  49. package/esm/protocols/governance/revoke-stake.d.mts +27 -0
  50. package/esm/protocols/governance/revoke-stake.mjs +178 -0
  51. package/esm/protocols/governance/slash-stake.d.mts +17 -0
  52. package/esm/protocols/governance/slash-stake.mjs +213 -0
  53. package/esm/protocols/governance/stake.d.mts +15 -0
  54. package/esm/protocols/governance/stake.mjs +270 -0
  55. package/esm/protocols/rollup/claim-reward.d.mts +11 -0
  56. package/esm/protocols/rollup/claim-reward.mjs +322 -0
  57. package/esm/protocols/rollup/close.d.mts +4 -0
  58. package/esm/protocols/rollup/close.mjs +105 -0
  59. package/esm/protocols/rollup/create-block.d.mts +11 -0
  60. package/esm/protocols/rollup/create-block.mjs +303 -0
  61. package/esm/protocols/rollup/create.d.mts +4 -0
  62. package/esm/protocols/rollup/create.mjs +164 -0
  63. package/esm/protocols/rollup/join.d.mts +4 -0
  64. package/esm/protocols/rollup/join.mjs +152 -0
  65. package/esm/protocols/rollup/leave.d.mts +4 -0
  66. package/esm/protocols/rollup/leave.mjs +137 -0
  67. package/esm/protocols/rollup/migrate.d.mts +4 -0
  68. package/esm/protocols/rollup/migrate.mjs +85 -0
  69. package/esm/protocols/rollup/pause.d.mts +4 -0
  70. package/esm/protocols/rollup/pause.mjs +76 -0
  71. package/esm/protocols/rollup/pipes/ensure-validator.d.mts +6 -0
  72. package/esm/protocols/rollup/pipes/ensure-validator.mjs +12 -0
  73. package/esm/protocols/rollup/pipes/verify-evidence.d.mts +15 -0
  74. package/esm/protocols/rollup/pipes/verify-evidence.mjs +29 -0
  75. package/esm/protocols/rollup/pipes/verify-signers.d.mts +15 -0
  76. package/esm/protocols/rollup/pipes/verify-signers.mjs +36 -0
  77. package/esm/protocols/rollup/pipes/verify-status.d.mts +13 -0
  78. package/esm/protocols/rollup/pipes/verify-status.mjs +26 -0
  79. package/esm/protocols/rollup/resume.d.mts +4 -0
  80. package/esm/protocols/rollup/resume.mjs +79 -0
  81. package/esm/protocols/rollup/update.d.mts +4 -0
  82. package/esm/protocols/rollup/update.mjs +111 -0
  83. package/esm/protocols/token/create.d.mts +4 -0
  84. package/esm/protocols/token/create.mjs +150 -0
  85. package/esm/protocols/token/deposit-v2.d.mts +11 -0
  86. package/esm/protocols/token/deposit-v2.mjs +216 -0
  87. package/esm/protocols/token/withdraw-v2.d.mts +9 -0
  88. package/esm/protocols/token/withdraw-v2.mjs +222 -0
  89. package/esm/protocols/token-factory/burn.d.mts +15 -0
  90. package/esm/protocols/token-factory/burn.mjs +233 -0
  91. package/esm/protocols/token-factory/create.d.mts +4 -0
  92. package/esm/protocols/token-factory/create.mjs +254 -0
  93. package/esm/protocols/token-factory/mint.d.mts +15 -0
  94. package/esm/protocols/token-factory/mint.mjs +234 -0
  95. package/esm/protocols/token-factory/pipes/calc-reserve.d.mts +21 -0
  96. package/esm/protocols/token-factory/pipes/calc-reserve.mjs +34 -0
  97. package/esm/protocols/token-factory/pipes/verify-icon.d.mts +14 -0
  98. package/esm/protocols/token-factory/pipes/verify-icon.mjs +18 -0
  99. package/esm/protocols/token-factory/pipes/verify-ownership.d.mts +12 -0
  100. package/esm/protocols/token-factory/pipes/verify-ownership.mjs +63 -0
  101. package/esm/protocols/token-factory/pipes/verify-url.d.mts +12 -0
  102. package/esm/protocols/token-factory/pipes/verify-url.mjs +26 -0
  103. package/esm/protocols/token-factory/update.d.mts +10 -0
  104. package/esm/protocols/token-factory/update.mjs +152 -0
  105. package/esm/protocols/trade/exchange-v2.d.mts +9 -0
  106. package/esm/protocols/trade/exchange-v2.mjs +239 -0
  107. package/esm/protocols/trade/transfer-v2.d.mts +9 -0
  108. package/esm/protocols/trade/transfer-v2.mjs +226 -0
  109. package/esm/protocols/trade/transfer-v3.d.mts +17 -0
  110. package/esm/protocols/trade/transfer-v3.mjs +270 -0
  111. package/esm/util.d.mts +141 -0
  112. package/esm/util.mjs +278 -0
  113. package/lib/_virtual/rolldown_runtime.cjs +29 -0
  114. package/lib/execute.cjs +231 -0
  115. package/lib/execute.d.cts +53 -0
  116. package/lib/index.cjs +105 -0
  117. package/lib/index.d.cts +95 -0
  118. package/lib/pipes/ensure-cost.cjs +141 -0
  119. package/lib/pipes/ensure-cost.d.cts +18 -0
  120. package/lib/pipes/ensure-gas.cjs +41 -0
  121. package/lib/pipes/ensure-gas.d.cts +14 -0
  122. package/lib/protocols/account/delegate.cjs +201 -0
  123. package/lib/protocols/account/delegate.d.cts +4 -0
  124. package/lib/protocols/account/migrate.cjs +135 -0
  125. package/lib/protocols/account/migrate.d.cts +4 -0
  126. package/lib/protocols/account/revoke-delegate.cjs +107 -0
  127. package/lib/protocols/account/revoke-delegate.d.cts +4 -0
  128. package/lib/protocols/asset/acquire-v2.cjs +216 -0
  129. package/lib/protocols/asset/acquire-v2.d.cts +9 -0
  130. package/lib/protocols/asset/acquire-v3.cjs +269 -0
  131. package/lib/protocols/asset/acquire-v3.d.cts +17 -0
  132. package/lib/protocols/asset/calls/transfer-token.cjs +40 -0
  133. package/lib/protocols/asset/calls/transfer-token.d.cts +4 -0
  134. package/lib/protocols/asset/calls/transfer.cjs +35 -0
  135. package/lib/protocols/asset/calls/transfer.d.cts +4 -0
  136. package/lib/protocols/asset/consume.cjs +95 -0
  137. package/lib/protocols/asset/consume.d.cts +4 -0
  138. package/lib/protocols/asset/create.cjs +140 -0
  139. package/lib/protocols/asset/create.d.cts +4 -0
  140. package/lib/protocols/asset/mint.cjs +159 -0
  141. package/lib/protocols/asset/mint.d.cts +4 -0
  142. package/lib/protocols/asset/pipes/exec-mint-hook.cjs +57 -0
  143. package/lib/protocols/asset/pipes/exec-mint-hook.d.cts +24 -0
  144. package/lib/protocols/asset/pipes/extract-factory-tokens.cjs +25 -0
  145. package/lib/protocols/asset/pipes/extract-factory-tokens.d.cts +21 -0
  146. package/lib/protocols/asset/pipes/verify-itx-address.cjs +59 -0
  147. package/lib/protocols/asset/pipes/verify-itx-address.d.cts +32 -0
  148. package/lib/protocols/asset/pipes/verify-itx-assets.cjs +29 -0
  149. package/lib/protocols/asset/pipes/verify-itx-assets.d.cts +18 -0
  150. package/lib/protocols/asset/pipes/verify-itx-variables.cjs +22 -0
  151. package/lib/protocols/asset/pipes/verify-itx-variables.d.cts +17 -0
  152. package/lib/protocols/asset/pipes/verify-mint-limit.cjs +16 -0
  153. package/lib/protocols/asset/pipes/verify-mint-limit.d.cts +15 -0
  154. package/lib/protocols/asset/update.cjs +114 -0
  155. package/lib/protocols/asset/update.d.cts +4 -0
  156. package/lib/protocols/factory/create.cjs +161 -0
  157. package/lib/protocols/factory/create.d.cts +29 -0
  158. package/lib/protocols/governance/claim-stake.cjs +223 -0
  159. package/lib/protocols/governance/claim-stake.d.cts +27 -0
  160. package/lib/protocols/governance/return-stake.cjs +215 -0
  161. package/lib/protocols/governance/return-stake.d.cts +27 -0
  162. package/lib/protocols/governance/revoke-stake.cjs +182 -0
  163. package/lib/protocols/governance/revoke-stake.d.cts +27 -0
  164. package/lib/protocols/governance/slash-stake.cjs +217 -0
  165. package/lib/protocols/governance/slash-stake.d.cts +17 -0
  166. package/lib/protocols/governance/stake.cjs +275 -0
  167. package/lib/protocols/governance/stake.d.cts +15 -0
  168. package/lib/protocols/rollup/claim-reward.cjs +328 -0
  169. package/lib/protocols/rollup/claim-reward.d.cts +11 -0
  170. package/lib/protocols/rollup/close.cjs +107 -0
  171. package/lib/protocols/rollup/close.d.cts +4 -0
  172. package/lib/protocols/rollup/create-block.cjs +309 -0
  173. package/lib/protocols/rollup/create-block.d.cts +11 -0
  174. package/lib/protocols/rollup/create.cjs +169 -0
  175. package/lib/protocols/rollup/create.d.cts +4 -0
  176. package/lib/protocols/rollup/join.cjs +157 -0
  177. package/lib/protocols/rollup/join.d.cts +4 -0
  178. package/lib/protocols/rollup/leave.cjs +141 -0
  179. package/lib/protocols/rollup/leave.d.cts +4 -0
  180. package/lib/protocols/rollup/migrate.cjs +87 -0
  181. package/lib/protocols/rollup/migrate.d.cts +4 -0
  182. package/lib/protocols/rollup/pause.cjs +78 -0
  183. package/lib/protocols/rollup/pause.d.cts +4 -0
  184. package/lib/protocols/rollup/pipes/ensure-validator.cjs +14 -0
  185. package/lib/protocols/rollup/pipes/ensure-validator.d.cts +6 -0
  186. package/lib/protocols/rollup/pipes/verify-evidence.cjs +32 -0
  187. package/lib/protocols/rollup/pipes/verify-evidence.d.cts +15 -0
  188. package/lib/protocols/rollup/pipes/verify-signers.cjs +39 -0
  189. package/lib/protocols/rollup/pipes/verify-signers.d.cts +15 -0
  190. package/lib/protocols/rollup/pipes/verify-status.cjs +28 -0
  191. package/lib/protocols/rollup/pipes/verify-status.d.cts +13 -0
  192. package/lib/protocols/rollup/resume.cjs +81 -0
  193. package/lib/protocols/rollup/resume.d.cts +4 -0
  194. package/lib/protocols/rollup/update.cjs +114 -0
  195. package/lib/protocols/rollup/update.d.cts +4 -0
  196. package/lib/protocols/token/create.cjs +156 -0
  197. package/lib/protocols/token/create.d.cts +4 -0
  198. package/lib/protocols/token/deposit-v2.cjs +219 -0
  199. package/lib/protocols/token/deposit-v2.d.cts +11 -0
  200. package/lib/protocols/token/withdraw-v2.cjs +225 -0
  201. package/lib/protocols/token/withdraw-v2.d.cts +9 -0
  202. package/lib/protocols/token-factory/burn.cjs +236 -0
  203. package/lib/protocols/token-factory/burn.d.cts +15 -0
  204. package/lib/protocols/token-factory/create.cjs +260 -0
  205. package/lib/protocols/token-factory/create.d.cts +4 -0
  206. package/lib/protocols/token-factory/mint.cjs +237 -0
  207. package/lib/protocols/token-factory/mint.d.cts +15 -0
  208. package/lib/protocols/token-factory/pipes/calc-reserve.cjs +38 -0
  209. package/lib/protocols/token-factory/pipes/calc-reserve.d.cts +21 -0
  210. package/lib/protocols/token-factory/pipes/verify-icon.cjs +22 -0
  211. package/lib/protocols/token-factory/pipes/verify-icon.d.cts +14 -0
  212. package/lib/protocols/token-factory/pipes/verify-ownership.cjs +66 -0
  213. package/lib/protocols/token-factory/pipes/verify-ownership.d.cts +12 -0
  214. package/lib/protocols/token-factory/pipes/verify-url.cjs +29 -0
  215. package/lib/protocols/token-factory/pipes/verify-url.d.cts +12 -0
  216. package/lib/protocols/token-factory/update.cjs +155 -0
  217. package/lib/protocols/token-factory/update.d.cts +10 -0
  218. package/lib/protocols/trade/exchange-v2.cjs +243 -0
  219. package/lib/protocols/trade/exchange-v2.d.cts +9 -0
  220. package/lib/protocols/trade/transfer-v2.cjs +229 -0
  221. package/lib/protocols/trade/transfer-v2.d.cts +9 -0
  222. package/lib/protocols/trade/transfer-v3.cjs +274 -0
  223. package/lib/protocols/trade/transfer-v3.d.cts +17 -0
  224. package/lib/util.cjs +296 -0
  225. package/lib/util.d.cts +141 -0
  226. package/package.json +49 -22
  227. package/tools/fixtures.ts +564 -0
  228. package/lib/execute.js +0 -254
  229. package/lib/index.js +0 -117
  230. package/lib/pipes/ensure-cost.js +0 -193
  231. package/lib/pipes/ensure-gas.js +0 -48
  232. package/lib/protocols/account/delegate.js +0 -223
  233. package/lib/protocols/account/migrate.js +0 -153
  234. package/lib/protocols/account/revoke-delegate.js +0 -110
  235. package/lib/protocols/asset/acquire-v2.js +0 -262
  236. package/lib/protocols/asset/acquire-v3.js +0 -330
  237. package/lib/protocols/asset/calls/README.md +0 -5
  238. package/lib/protocols/asset/calls/transfer-token.js +0 -36
  239. package/lib/protocols/asset/calls/transfer.js +0 -28
  240. package/lib/protocols/asset/consume.js +0 -105
  241. package/lib/protocols/asset/create.js +0 -151
  242. package/lib/protocols/asset/mint.js +0 -199
  243. package/lib/protocols/asset/pipes/exec-mint-hook.js +0 -62
  244. package/lib/protocols/asset/pipes/extract-factory-tokens.js +0 -18
  245. package/lib/protocols/asset/pipes/verify-itx-address.js +0 -54
  246. package/lib/protocols/asset/pipes/verify-itx-assets.js +0 -51
  247. package/lib/protocols/asset/pipes/verify-itx-variables.js +0 -26
  248. package/lib/protocols/asset/pipes/verify-mint-limit.js +0 -13
  249. package/lib/protocols/asset/update.js +0 -131
  250. package/lib/protocols/factory/create.js +0 -191
  251. package/lib/protocols/governance/claim-stake.js +0 -266
  252. package/lib/protocols/governance/return-stake.js +0 -248
  253. package/lib/protocols/governance/revoke-stake.js +0 -172
  254. package/lib/protocols/governance/slash-stake.js +0 -271
  255. package/lib/protocols/governance/stake.js +0 -303
  256. package/lib/protocols/rollup/claim-reward.js +0 -342
  257. package/lib/protocols/rollup/close.js +0 -104
  258. package/lib/protocols/rollup/create-block.js +0 -413
  259. package/lib/protocols/rollup/create.js +0 -197
  260. package/lib/protocols/rollup/join.js +0 -182
  261. package/lib/protocols/rollup/leave.js +0 -145
  262. package/lib/protocols/rollup/migrate.js +0 -85
  263. package/lib/protocols/rollup/pause.js +0 -75
  264. package/lib/protocols/rollup/pipes/ensure-validator.js +0 -12
  265. package/lib/protocols/rollup/pipes/verify-evidence.js +0 -37
  266. package/lib/protocols/rollup/pipes/verify-signers.js +0 -87
  267. package/lib/protocols/rollup/pipes/verify-status.js +0 -30
  268. package/lib/protocols/rollup/resume.js +0 -75
  269. package/lib/protocols/rollup/update.js +0 -122
  270. package/lib/protocols/token/create.js +0 -199
  271. package/lib/protocols/token/deposit-v2.js +0 -290
  272. package/lib/protocols/token/withdraw-v2.js +0 -305
  273. package/lib/protocols/token-factory/burn.js +0 -371
  274. package/lib/protocols/token-factory/create.js +0 -342
  275. package/lib/protocols/token-factory/mint.js +0 -385
  276. package/lib/protocols/token-factory/pipes/calc-reserve.js +0 -37
  277. package/lib/protocols/token-factory/pipes/verify-icon.js +0 -27
  278. package/lib/protocols/token-factory/pipes/verify-ownership.js +0 -93
  279. package/lib/protocols/token-factory/pipes/verify-url.js +0 -32
  280. package/lib/protocols/token-factory/update.js +0 -208
  281. package/lib/protocols/trade/exchange-v2.js +0 -239
  282. package/lib/protocols/trade/transfer-v2.js +0 -233
  283. package/lib/protocols/trade/transfer-v3.js +0 -333
  284. package/lib/util.js +0 -442
@@ -0,0 +1,155 @@
1
+ import { decodeAnySafe, getDelegationRequirements } from "../../util.mjs";
2
+ import ensure_cost_default from "../../pipes/ensure-cost.mjs";
3
+ import ensure_gas_default from "../../pipes/ensure-gas.mjs";
4
+ import { Runner, pipes } from "@ocap/tx-pipeline";
5
+ import { CustomError } from "@ocap/util/lib/error";
6
+ import get from "lodash/get.js";
7
+ import { toFactoryAddress } from "@arcblock/did-util";
8
+ import { account, delegation, factory } from "@ocap/state";
9
+ import { BN } from "@ocap/util";
10
+ import Debug from "debug";
11
+ import { formatMessage } from "@ocap/message";
12
+ import cloneDeep from "lodash/cloneDeep.js";
13
+ import { isValidFactory } from "@ocap/asset";
14
+ import isEmpty from "lodash/isEmpty.js";
15
+
16
+ //#region src/protocols/factory/create.ts
17
+ const debug = Debug("@ocap/tx-protocols:create-factory");
18
+ const runner = new Runner("create_factory");
19
+ runner.use(pipes.VerifyMultiSig(0));
20
+ runner.use((context, next) => {
21
+ const factoryProps = formatMessage("CreateFactoryTx", context.itx);
22
+ try {
23
+ isValidFactory(factoryProps);
24
+ } catch (err) {
25
+ return next(new CustomError("INVALID_FACTORY_PROPS", err.message));
26
+ }
27
+ if (factoryProps.output.data) factoryProps.output.data = decodeAnySafe(factoryProps.output.data);
28
+ if (factoryProps.name.length < 2 || factoryProps.name.length > 255) return next(new CustomError("INVALID_FACTORY_PROPS", "Length of factory name should between 2 and 255 characters"));
29
+ const props = cloneDeep(factoryProps);
30
+ props.address = "";
31
+ if (toFactoryAddress(props) !== factoryProps.address) return next(new CustomError("INVALID_FACTORY_PROPS", "Factory address is not valid"));
32
+ const factoryTokenAddresses = (factoryProps.input.tokens || []).map((x) => x.address);
33
+ const maxListSize = get(context, "config.transaction.maxListSize");
34
+ if (factoryTokenAddresses.length > maxListSize) return next(new CustomError("INVALID_FACTORY_INPUT", `input.tokens exceeded max allowed length: ${maxListSize}`));
35
+ if (factoryProps.input.assets.length > maxListSize) return next(new CustomError("INVALID_FACTORY_INPUT", `input.assets exceeded max allowed length: ${maxListSize}`));
36
+ if (new BN(factoryProps.input.value || 0).gt(new BN(0))) {
37
+ factoryTokenAddresses.push(context.config.token.address);
38
+ factoryProps.input.tokens.push({
39
+ address: context.config.token.address,
40
+ value: factoryProps.input.value
41
+ });
42
+ factoryProps.input.value = "0";
43
+ }
44
+ context.factoryTokens = factoryTokenAddresses;
45
+ context.factoryProps = factoryProps;
46
+ return next();
47
+ });
48
+ runner.use(pipes.ExtractState({
49
+ from: "itx.address",
50
+ to: "factoryState",
51
+ status: "OK"
52
+ }));
53
+ runner.use(pipes.VerifyInfo([{
54
+ error: "DUPLICATE_FACTORY",
55
+ message: "This asset factory already exist on chain",
56
+ fn: (ctx) => {
57
+ return isEmpty(ctx.factoryState);
58
+ }
59
+ }]));
60
+ runner.use(pipes.ExtractState({
61
+ from: "tx.from",
62
+ to: "senderState",
63
+ table: "account",
64
+ status: "INVALID_SENDER_STATE"
65
+ }));
66
+ runner.use(pipes.VerifyAccountMigration({
67
+ stateKey: "senderState",
68
+ addressKey: "tx.from"
69
+ }));
70
+ runner.use(pipes.ExtractState({
71
+ from: "tx.delegator",
72
+ to: "delegatorState",
73
+ status: "OK",
74
+ table: "account"
75
+ }));
76
+ runner.use(pipes.VerifyAccountMigration({
77
+ stateKey: "delegatorState",
78
+ addressKey: "tx.delegator"
79
+ }));
80
+ runner.use(pipes.VerifyDelegation({
81
+ type: "signature",
82
+ signerKey: "senderState",
83
+ delegatorKey: "delegatorState",
84
+ getRequirements: getDelegationRequirements
85
+ }));
86
+ runner.use(pipes.ExtractState({
87
+ from: "factoryTokens",
88
+ to: "tokenStates",
89
+ table: "token",
90
+ status: "INVALID_FACTORY_INPUT"
91
+ }));
92
+ runner.use(pipes.ExtractState({
93
+ from: "factoryProps.input.assets",
94
+ to: "inputAssetStates",
95
+ table: "asset",
96
+ status: "OK"
97
+ }));
98
+ runner.use(pipes.ExtractState({
99
+ from: "factoryProps.input.assets",
100
+ to: "inputFactoryStates",
101
+ table: "factory",
102
+ status: "OK"
103
+ }));
104
+ runner.use((context, next) => {
105
+ const { inputAssetStates = [], inputFactoryStates = [], factoryProps } = context;
106
+ if (inputAssetStates.some((x) => !!x.consumedTime)) return next(new CustomError("INVALID_FACTORY_INPUT", "Some of input.assets already consumed"));
107
+ if (inputAssetStates.length + inputFactoryStates.length === factoryProps.input.assets.length) return next();
108
+ return next(new CustomError("INVALID_FACTORY_INPUT", "Not all input.assets exist on chain"));
109
+ });
110
+ runner.use(pipes.ExtractState({
111
+ from: "factoryProps.trustedIssuers",
112
+ to: "issuerStates",
113
+ table: "account",
114
+ status: "INVALID_ISSUER_STATE"
115
+ }));
116
+ runner.use(pipes.VerifyAccountMigration({
117
+ stateKey: "issuerStates",
118
+ addressKey: "factoryProps.trustedIssuers"
119
+ }));
120
+ runner.use(ensure_gas_default(() => ({
121
+ create: 1,
122
+ update: 2,
123
+ payment: 0
124
+ })));
125
+ runner.use(ensure_cost_default({ attachSenderChanges: true }));
126
+ runner.use(pipes.TakeStateSnapshot());
127
+ runner.use(async (context, next) => {
128
+ const { tx: tx$1, itx, statedb, senderState, delegatorState, delegationState, senderUpdates, factoryProps, updateVaults } = context;
129
+ const tokens = { [context.config.token.address]: "0" };
130
+ const owner = delegatorState ? delegatorState.address : senderState.address;
131
+ const [newSenderState, factoryState, newDelegationState] = await Promise.all([
132
+ statedb.account.update(senderState.address, account.update(senderState, {
133
+ nonce: tx$1.nonce,
134
+ pk: tx$1.pk,
135
+ ...senderUpdates
136
+ }, context), context),
137
+ statedb.factory.create(itx.address, factory.create({
138
+ ...factoryProps,
139
+ tokens,
140
+ owner
141
+ }, context), context),
142
+ context.isDelegationChanged ? statedb.delegation.update(delegationState.address, delegation.update(delegationState, {}, context), context) : delegationState ?? null
143
+ ]);
144
+ if (updateVaults) await updateVaults();
145
+ context.senderState = newSenderState;
146
+ context.factoryState = factoryState ?? void 0;
147
+ context.delegationState = newDelegationState ?? void 0;
148
+ debug("createFactory", factoryState);
149
+ next();
150
+ }, { persistError: true });
151
+ runner.use(pipes.VerifyStateDiff());
152
+ var create_default = runner;
153
+
154
+ //#endregion
155
+ export { create_default as default };
@@ -0,0 +1,27 @@
1
+ import { BN } from "@ocap/util";
2
+
3
+ //#region src/protocols/governance/claim-stake.d.ts
4
+ /** Token input type */
5
+ interface TokenInput {
6
+ address: string;
7
+ value: string;
8
+ }
9
+ /** Multi-output type */
10
+ interface MultiOutput {
11
+ owner: string;
12
+ tokensList?: TokenInput[];
13
+ tokens: TokenInput[];
14
+ assetsList?: string[];
15
+ assets: string[];
16
+ }
17
+ /** Token condition type for VerifyTokenBalance */
18
+ interface TokenCondition {
19
+ owner: string;
20
+ tokens: Array<{
21
+ address: string;
22
+ value: BN;
23
+ }>;
24
+ }
25
+ declare const runner: any;
26
+ //#endregion
27
+ export { MultiOutput, TokenCondition, TokenInput, runner as default };
@@ -0,0 +1,220 @@
1
+ import { applyTokenChange, applyTokenUpdates } from "../../util.mjs";
2
+ import ensure_cost_default from "../../pipes/ensure-cost.mjs";
3
+ import ensure_gas_default from "../../pipes/ensure-gas.mjs";
4
+ import { Runner, pipes } from "@ocap/tx-pipeline";
5
+ import { CustomError } from "@ocap/util/lib/error";
6
+ import { account, asset, evidence, stake } from "@ocap/state";
7
+ import { BN } from "@ocap/util";
8
+ import Debug from "debug";
9
+ import { Joi, patterns } from "@arcblock/validator";
10
+ import { getRelatedAddresses } from "@ocap/util/lib/get-related-addr";
11
+
12
+ //#region src/protocols/governance/claim-stake.ts
13
+ const debug = Debug("@ocap/tx-protocols:claim-stake");
14
+ const runner = new Runner("claim_stake");
15
+ runner.use(pipes.VerifyMultiSig(0));
16
+ const schema = Joi.object({
17
+ address: Joi.DID().prefix().role("ROLE_STAKE").required(),
18
+ evidence: Joi.object({ hash: Joi.string().regex(patterns.txHash).required() }).required(),
19
+ data: Joi.any().optional().allow(null)
20
+ }).options({
21
+ stripUnknown: true,
22
+ noDefaults: false
23
+ });
24
+ runner.use(({ itx }, next) => {
25
+ const { error } = schema.validate(itx);
26
+ return next(error ? new CustomError("INVALID_TX", `Invalid itx: ${error.message}`) : void 0);
27
+ });
28
+ runner.use(pipes.ExtractState({
29
+ from: "tx.from",
30
+ to: "senderState",
31
+ status: "INVALID_SENDER_STATE",
32
+ table: "account"
33
+ }));
34
+ runner.use(pipes.ExtractState({
35
+ from: "itx.address",
36
+ to: "stakeState",
37
+ status: "INVALID_STAKE_STATE",
38
+ table: "stake"
39
+ }));
40
+ runner.use(pipes.VerifyAccountMigration({
41
+ stateKey: "senderState",
42
+ addressKey: "tx.from"
43
+ }));
44
+ runner.use(pipes.VerifyInfo([{
45
+ error: "SENDER_NOT_MATCH",
46
+ message: "You are not allowed to claim stake from this address",
47
+ fn: (ctx) => {
48
+ const { senderState, stakeState } = ctx;
49
+ return getRelatedAddresses(senderState).includes(stakeState.sender);
50
+ }
51
+ }]));
52
+ runner.use(pipes.ExtractState({
53
+ from: "itx.evidence.hash",
54
+ to: "evidenceState",
55
+ status: "OK",
56
+ table: "evidence"
57
+ }));
58
+ runner.use(pipes.VerifyInfo([{
59
+ error: "ALREADY_CLAIMED",
60
+ message: "Revoke evidence already seen on this chain",
61
+ fn: (ctx) => {
62
+ const { evidenceState } = ctx;
63
+ return !evidenceState;
64
+ }
65
+ }]));
66
+ runner.use(pipes.ExtractState({
67
+ from: "itx.evidence.hash",
68
+ to: "txState",
69
+ status: "INVALID_TX",
70
+ table: "tx"
71
+ }));
72
+ runner.use(pipes.VerifyInfo([
73
+ {
74
+ error: "INVALID_TX",
75
+ message: "Evidence tx is not valid",
76
+ fn: (ctx) => {
77
+ const { txState } = ctx;
78
+ return txState.code === "OK";
79
+ }
80
+ },
81
+ {
82
+ error: "INVALID_TX",
83
+ message: "Evidence tx type is not valid",
84
+ fn: (ctx) => {
85
+ const { txState } = ctx;
86
+ return txState.type === "revoke_stake";
87
+ }
88
+ },
89
+ {
90
+ error: "INVALID_TX",
91
+ message: "Evidence tx does not belong to same stake",
92
+ fn: (ctx) => {
93
+ const { txState, itx } = ctx;
94
+ return txState.tx.itxJson.address === itx.address;
95
+ }
96
+ },
97
+ {
98
+ error: "WITHIN_WAITING_PERIOD",
99
+ message: "You can not claim stake before waiting period ends",
100
+ fn: (ctx) => {
101
+ const { txState, stakeState, txTime } = ctx;
102
+ const end = +new Date(txState.time) + (stakeState.revokeWaitingPeriod || 0) * 1e3;
103
+ return +new Date(txTime) > end;
104
+ }
105
+ }
106
+ ]));
107
+ runner.use(pipes.VerifyTxInput({
108
+ fieldKey: "txState.tx.itxJson.outputs",
109
+ inputsKey: "outputs",
110
+ sendersKey: "receivers",
111
+ tokensKey: "tokens",
112
+ assetsKey: "assets"
113
+ }));
114
+ runner.use(pipes.ExtractState({
115
+ from: "receivers",
116
+ to: "receiverStates",
117
+ status: "INVALID_RECEIVER_STATE",
118
+ table: "account"
119
+ }));
120
+ runner.use(pipes.ExtractState({
121
+ from: "tokens",
122
+ to: "tokenStates",
123
+ status: "INVALID_TOKEN",
124
+ table: "token"
125
+ }));
126
+ runner.use((context, next) => {
127
+ const { outputs = [], stakeState } = context;
128
+ const tokensToClaim = {};
129
+ outputs.forEach(({ tokens }) => {
130
+ (tokens || []).forEach(({ address, value }) => {
131
+ if (typeof tokensToClaim[address] === "undefined") tokensToClaim[address] = new BN(0);
132
+ tokensToClaim[address] = tokensToClaim[address].add(new BN(value));
133
+ });
134
+ });
135
+ context.tokenCondition = {
136
+ owner: stakeState.address,
137
+ tokens: Object.keys(tokensToClaim).map((address) => ({
138
+ address,
139
+ value: tokensToClaim[address]
140
+ }))
141
+ };
142
+ next();
143
+ });
144
+ runner.use(pipes.VerifyTokenBalance({
145
+ ownerKey: "stakeState",
146
+ conditionKey: "tokenCondition",
147
+ tokensKey: "revokedTokens"
148
+ }));
149
+ runner.use(pipes.ExtractState({
150
+ from: "assets",
151
+ to: "assetStates",
152
+ status: "OK",
153
+ table: "asset"
154
+ }));
155
+ runner.use(pipes.VerifyTransferrable({ assets: "assetStates" }));
156
+ runner.use(pipes.VerifyUpdater({
157
+ assetKey: "assetStates",
158
+ ownerKey: "stakeState"
159
+ }));
160
+ runner.use(ensure_gas_default((context) => {
161
+ const result = {
162
+ create: 1,
163
+ update: 2,
164
+ payment: 0
165
+ };
166
+ if (context.receiverStates) result.update += context.receiverStates.length;
167
+ if (context.assetStates) result.update += context.assetStates.length;
168
+ return result;
169
+ }));
170
+ runner.use(ensure_cost_default({ attachSenderChanges: true }));
171
+ runner.use(pipes.TakeStateSnapshot());
172
+ runner.use(async (context, next) => {
173
+ const { tx: tx$1, itx, outputs = [], statedb, senderState, senderChange, stakeState, receiverStates = [], updateVaults, assetStates = [] } = context;
174
+ const receiverUpdates = {};
175
+ const assetUpdates = {};
176
+ const stakeUpdates = {
177
+ revokedTokens: stakeState.revokedTokens || {},
178
+ revokedAssets: stakeState.revokedAssets || []
179
+ };
180
+ outputs.forEach((x) => {
181
+ const { owner, tokens, assets } = x;
182
+ const ownerState = receiverStates.find((s) => getRelatedAddresses(s).includes(owner));
183
+ receiverUpdates[ownerState.address] = applyTokenUpdates(tokens || [], ownerState, "add");
184
+ if (senderChange && ownerState.address === senderChange.address) receiverUpdates[ownerState.address] = applyTokenChange(receiverUpdates[ownerState.address], senderChange);
185
+ (assets || []).forEach((a) => {
186
+ assetUpdates[a] = { owner: ownerState.address };
187
+ });
188
+ stakeUpdates.revokedTokens = applyTokenUpdates(tokens || [], { tokens: stakeUpdates.revokedTokens }, "sub").tokens;
189
+ stakeUpdates.revokedAssets = stakeUpdates.revokedAssets.filter((a) => (assets || []).includes(a) === false);
190
+ });
191
+ const isAlsoSigner = !!receiverUpdates[senderState.address];
192
+ const [newSenderState, newReceiverStates, newStakeState, newAssetStates, newEvidenceState] = await Promise.all([
193
+ statedb.account.update(senderState.address, account.update(senderState, Object.assign({ nonce: tx$1.nonce }, receiverUpdates[senderState.address] || (senderChange ? applyTokenChange(senderState, senderChange) : {})), context), context),
194
+ Promise.all(receiverStates.filter((x) => x.address !== senderState.address).map((x) => statedb.account.update(x.address, account.update(x, receiverUpdates[x.address], context), context))),
195
+ statedb.stake.update(stakeState.address, stake.update(stakeState, stakeUpdates, context), context),
196
+ Promise.all(assetStates.map((x) => statedb.asset.update(x.address, asset.update(x, assetUpdates[x.address], context), context))),
197
+ statedb.evidence.create(itx.evidence.hash, evidence.create({
198
+ hash: itx.evidence.hash,
199
+ data: "claim-stake"
200
+ }, context), context)
201
+ ]);
202
+ if (updateVaults) await updateVaults();
203
+ context.senderState = newSenderState;
204
+ context.receiverStates = isAlsoSigner ? newReceiverStates.concat(newSenderState) : newReceiverStates;
205
+ context.stakeState = newStakeState;
206
+ context.assetStates = newAssetStates;
207
+ context.evidenceState = newEvidenceState;
208
+ debug("claim-stake", {
209
+ address: itx.address,
210
+ stakeUpdates,
211
+ receiverUpdates,
212
+ assetUpdates
213
+ });
214
+ next();
215
+ }, { persistError: true });
216
+ runner.use(pipes.VerifyStateDiff());
217
+ var claim_stake_default = runner;
218
+
219
+ //#endregion
220
+ export { claim_stake_default as default };
@@ -0,0 +1,27 @@
1
+ import { BN } from "@ocap/util";
2
+
3
+ //#region src/protocols/governance/return-stake.d.ts
4
+ /** Token input type */
5
+ interface TokenInput {
6
+ address: string;
7
+ value: string;
8
+ }
9
+ /** Multi-input type */
10
+ interface MultiInput {
11
+ owner: string;
12
+ tokensList?: TokenInput[];
13
+ tokens?: TokenInput[];
14
+ assetsList?: string[];
15
+ assets?: string[];
16
+ }
17
+ /** Token condition type */
18
+ interface TokenCondition {
19
+ owner: string;
20
+ tokens: Array<{
21
+ address: string;
22
+ value: BN;
23
+ }>;
24
+ }
25
+ declare const runner: any;
26
+ //#endregion
27
+ export { MultiInput, TokenCondition, TokenInput, runner as default };
@@ -0,0 +1,211 @@
1
+ import { applyTokenChange, applyTokenUpdates } from "../../util.mjs";
2
+ import ensure_cost_default from "../../pipes/ensure-cost.mjs";
3
+ import ensure_gas_default from "../../pipes/ensure-gas.mjs";
4
+ import { Runner, pipes } from "@ocap/tx-pipeline";
5
+ import { CustomError } from "@ocap/util/lib/error";
6
+ import { account, asset, stake } from "@ocap/state";
7
+ import { BN } from "@ocap/util";
8
+ import Debug from "debug";
9
+ import { getListField } from "@ocap/util/lib/get-list-field";
10
+ import { Joi, schemas } from "@arcblock/validator";
11
+ import { getRelatedAddresses } from "@ocap/util/lib/get-related-addr";
12
+ import isEmpty from "lodash/isEmpty.js";
13
+
14
+ //#region src/protocols/governance/return-stake.ts
15
+ const debug = Debug("@ocap/tx-protocols:return-stake");
16
+ const runner = new Runner("return_stake");
17
+ runner.use(pipes.VerifyMultiSig(0));
18
+ const schema = Joi.object({
19
+ address: Joi.DID().prefix().role("ROLE_STAKE").required(),
20
+ message: Joi.string().trim().min(1).max(256).required(),
21
+ outputsList: schemas.multiInput.min(1).required(),
22
+ data: Joi.any().optional().allow(null)
23
+ }).options({
24
+ stripUnknown: true,
25
+ noDefaults: false
26
+ });
27
+ runner.use(({ itx }, next) => {
28
+ const { error } = schema.validate(itx);
29
+ return next(error ? new CustomError("INVALID_TX", `Invalid itx: ${error.message}`) : void 0);
30
+ });
31
+ runner.use(pipes.VerifyTxInput({
32
+ fieldKey: "itx.outputs",
33
+ inputsKey: "outputs",
34
+ sendersKey: "receivers",
35
+ tokensKey: "tokens",
36
+ assetsKey: "assets"
37
+ }));
38
+ runner.use(pipes.VerifyInfo([{
39
+ error: "INSUFFICIENT_DATA",
40
+ message: "Can not return stake without any output",
41
+ fn: (ctx) => {
42
+ const context = ctx;
43
+ return !(isEmpty(context.tokens) && isEmpty(context.assets));
44
+ }
45
+ }]));
46
+ runner.use(pipes.VerifyListSize({ listKey: [
47
+ "outputs",
48
+ "receivers",
49
+ "tokens",
50
+ "assets"
51
+ ] }));
52
+ runner.use(pipes.ExtractState({
53
+ from: "tx.from",
54
+ to: "senderState",
55
+ status: "INVALID_SENDER_STATE",
56
+ table: "account"
57
+ }));
58
+ runner.use(pipes.ExtractState({
59
+ from: "receivers",
60
+ to: "receiverStates",
61
+ status: "INVALID_RECEIVER_STATE",
62
+ table: "account"
63
+ }));
64
+ runner.use(pipes.VerifyBlocked({ stateKeys: ["receiverStates"] }));
65
+ runner.use(pipes.VerifyAccountMigration({
66
+ stateKey: "senderState",
67
+ addressKey: "tx.from"
68
+ }));
69
+ runner.use(pipes.ExtractState({
70
+ from: "itx.address",
71
+ to: "stakeState",
72
+ status: "INVALID_STAKE_STATE",
73
+ table: "stake"
74
+ }));
75
+ runner.use(pipes.VerifyInfo([
76
+ {
77
+ error: "INVALID_TX",
78
+ message: "Can only return from none-self staking",
79
+ fn: (ctx) => {
80
+ const context = ctx;
81
+ return context.stakeState.sender !== context.stakeState.receiver;
82
+ }
83
+ },
84
+ {
85
+ error: "INVALID_TX",
86
+ message: "Can only return stake from receiver",
87
+ fn: (ctx) => {
88
+ const context = ctx;
89
+ return getRelatedAddresses(context.senderState).includes(context.stakeState.receiver);
90
+ }
91
+ },
92
+ {
93
+ error: "INVALID_TX",
94
+ message: "Can only return stake to sender",
95
+ fn: (ctx) => {
96
+ const context = ctx;
97
+ return (context.receiverStates || []).every((x) => getRelatedAddresses(x).includes(context.stakeState.sender));
98
+ }
99
+ }
100
+ ]));
101
+ runner.use(pipes.ExtractState({
102
+ from: "tokens",
103
+ to: "tokenStates",
104
+ status: "INVALID_TOKEN",
105
+ table: "token"
106
+ }));
107
+ runner.use((context, next) => {
108
+ const { stakeState } = context;
109
+ const outputs = context.outputs || [];
110
+ const tokens = {};
111
+ outputs.forEach((output) => {
112
+ getListField(output, "tokens").forEach(({ address, value }) => {
113
+ if (typeof tokens[address] === "undefined") tokens[address] = new BN(0);
114
+ tokens[address] = tokens[address].add(new BN(value));
115
+ });
116
+ });
117
+ context.lockedState = {
118
+ address: stakeState.address,
119
+ tokens: { ...stakeState.tokens || {} },
120
+ assets: [...stakeState.assets || []]
121
+ };
122
+ context.tokenCondition = {
123
+ owner: stakeState.address,
124
+ tokens: Object.keys(tokens).map((address) => ({
125
+ address,
126
+ value: tokens[address]
127
+ }))
128
+ };
129
+ next();
130
+ });
131
+ runner.use(pipes.VerifyTokenBalance({
132
+ ownerKey: "lockedState",
133
+ conditionKey: "tokenCondition"
134
+ }));
135
+ runner.use(pipes.VerifyInfo([{
136
+ error: "INVALID_TX",
137
+ message: "Can not return assets that are not locked in the stake",
138
+ fn: (ctx) => {
139
+ const context = ctx;
140
+ return (context.assets || []).every((x) => (context.lockedState?.assets || []).includes(x));
141
+ }
142
+ }]));
143
+ runner.use(pipes.ExtractState({
144
+ from: "assets",
145
+ to: "assetStates",
146
+ status: "INVALID_ASSET_STATE",
147
+ table: "asset"
148
+ }));
149
+ runner.use(pipes.VerifyTransferrable({ assets: "assetStates" }));
150
+ runner.use(pipes.VerifyUpdater({
151
+ assetKey: "assetStates",
152
+ ownerKey: "stakeState"
153
+ }));
154
+ runner.use(ensure_gas_default((context) => {
155
+ const result = {
156
+ create: 0,
157
+ update: 2,
158
+ payment: 0
159
+ };
160
+ if (context.receiverStates) result.update += context.receiverStates.length;
161
+ if (context.assetStates) result.update += context.assetStates.length;
162
+ return result;
163
+ }));
164
+ runner.use(ensure_cost_default({ attachSenderChanges: true }));
165
+ runner.use(pipes.TakeStateSnapshot());
166
+ runner.use(async (context, next) => {
167
+ const { tx: tx$1, itx, outputs = [], statedb, senderState, receiverStates = [], assetStates = [], stakeState, updateVaults, senderChange } = context;
168
+ const receiverUpdates = {};
169
+ const assetUpdates = {};
170
+ const stakeUpdates = {
171
+ tokens: stakeState.tokens || {},
172
+ assets: stakeState.assets || []
173
+ };
174
+ outputs.forEach((x) => {
175
+ const { owner } = x;
176
+ const tokensList = getListField(x, "tokens");
177
+ const assetsList = getListField(x, "assets");
178
+ stakeUpdates.assets = stakeUpdates.assets.filter((a) => assetsList.includes(a) === false);
179
+ stakeUpdates.tokens = applyTokenUpdates(tokensList, { tokens: stakeUpdates.tokens }, "sub").tokens;
180
+ const ownerState = receiverStates.find((s) => getRelatedAddresses(s).includes(owner));
181
+ receiverUpdates[ownerState.address] = applyTokenUpdates(tokensList, ownerState, "add");
182
+ if (senderChange && ownerState.address === senderChange.address) receiverUpdates[ownerState.address] = applyTokenChange(receiverUpdates[ownerState.address], senderChange);
183
+ assetsList.forEach((a) => {
184
+ assetUpdates[a] = { owner: ownerState.address };
185
+ });
186
+ });
187
+ const [newSenderState, newReceiverStates, newStakeState, newAssetStates] = await Promise.all([
188
+ statedb.account.update(senderState.address, account.update(senderState, Object.assign({ nonce: tx$1.nonce }, senderChange ? applyTokenChange(senderState, senderChange) : {}), context), context),
189
+ Promise.all(receiverStates.map((x) => statedb.account.update(x.address, account.update(x, receiverUpdates[x.address], context), context))),
190
+ statedb.stake.update(stakeState.address, stake.update(stakeState, stakeUpdates, context), context),
191
+ Promise.all(assetStates.map((x) => statedb.asset.update(x.address, asset.update(x, assetUpdates[x.address], context), context)))
192
+ ]);
193
+ if (updateVaults) await updateVaults();
194
+ context.senderState = newSenderState;
195
+ context.receiverStates = newReceiverStates;
196
+ context.stakeState = newStakeState;
197
+ context.assetStates = newAssetStates;
198
+ debug("return-stake", {
199
+ address: itx.address,
200
+ stakeUpdates,
201
+ assetUpdates,
202
+ senderChange,
203
+ ...receiverUpdates
204
+ });
205
+ next();
206
+ }, { persistError: true });
207
+ runner.use(pipes.VerifyStateDiff());
208
+ var return_stake_default = runner;
209
+
210
+ //#endregion
211
+ export { return_stake_default as default };
@@ -0,0 +1,27 @@
1
+ import { BN } from "@ocap/util";
2
+
3
+ //#region src/protocols/governance/revoke-stake.d.ts
4
+ /** Token input type */
5
+ interface TokenInput {
6
+ address: string;
7
+ value: string;
8
+ }
9
+ /** Multi-input type - uses List suffix in proto but runtime has both */
10
+ interface MultiOutput {
11
+ owner: string;
12
+ tokensList?: TokenInput[];
13
+ tokens?: TokenInput[];
14
+ assetsList?: string[];
15
+ assets?: string[];
16
+ }
17
+ /** Token condition type for VerifyTokenBalance */
18
+ interface TokenCondition {
19
+ owner: string;
20
+ tokens: Array<{
21
+ address: string;
22
+ value: BN;
23
+ }>;
24
+ }
25
+ declare const runner: any;
26
+ //#endregion
27
+ export { MultiOutput, TokenCondition, TokenInput, runner as default };