@ixo/oracle-runtime-workers 0.31.0 → 0.33.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.
- package/package.json +4 -4
- package/src/core/middlewares/tool-repetition-guard.ts +6 -3
- package/src/core/middlewares/turn-boundary.ts +6 -1
- package/src/core/tool-not-run.ts +30 -0
- package/src/core/wrap-plugin-tool.ts +9 -1
- package/src/do/user-oracle-do.ts +78 -17
- package/src/hub-actions/chain-tx-refusals.ts +307 -0
- package/src/hub-actions/client.ts +128 -30
- package/src/hub-actions/request.ts +32 -25
- package/src/hub-actions/transfer.ts +187 -33
- package/src/plugin-api/types.ts +103 -25
- package/src/plugins/hub-actions/chain-tx-catalog.ts +1451 -0
- package/src/plugins/hub-actions/hub-actions.plugin.ts +558 -222
- package/src/plugins/ixo-chain/ixo-chain.plugin.ts +1 -1
- package/src/plugins/ixo-chain/kinds/chain/index.ts +2 -0
- package/src/plugins/ixo-chain/kinds/chain/validators.ts +151 -0
- package/src/plugins/ixo-chain/kinds/indexed/dao-proposals.ts +37 -2
- package/src/plugins/ixo-chain/kinds/indexed/daos.ts +145 -9
- package/src/plugins/yoma/engine.ts +107 -55
- package/src/plugins/yoma/submission.ts +3 -6
- package/src/plugins/yoma/yoma.plugin.ts +12 -3
package/src/plugin-api/types.ts
CHANGED
|
@@ -29,30 +29,96 @@ import type {
|
|
|
29
29
|
ActionReferenceV1,
|
|
30
30
|
ActionOutcomeV1,
|
|
31
31
|
ActionCapabilitiesV1,
|
|
32
|
+
ChainTxGroupAction,
|
|
32
33
|
ChainTxMessage,
|
|
33
34
|
} from '@ixo/action-protocol';
|
|
34
35
|
|
|
36
|
+
/** `Omit` applied to each member of a union (plain `Omit` merges them). */
|
|
37
|
+
export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown
|
|
38
|
+
? Omit<T, K>
|
|
39
|
+
: never;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The owner's own identity in chain-transaction messages, which the host
|
|
43
|
+
* fills and the model never names: the filer's or disputer's `agentDid`
|
|
44
|
+
* (claims, reservations, disputes), an evaluation's `agentDid` and
|
|
45
|
+
* `agentAddress`, a claim permission's `creatorDid`, an entity update's
|
|
46
|
+
* `controllerDid` and a new entity's `ownerDid`: always `did:ixo:<signer>`,
|
|
47
|
+
* or the signer for an address.
|
|
48
|
+
*/
|
|
49
|
+
export type ChainTxOwnerField =
|
|
50
|
+
| 'agentDid'
|
|
51
|
+
| 'agentAddress'
|
|
52
|
+
| 'creatorDid'
|
|
53
|
+
| 'controllerDid'
|
|
54
|
+
| 'ownerDid';
|
|
55
|
+
|
|
56
|
+
/** The stake steps: their amount is IXO, written in display units. */
|
|
57
|
+
export type ChainTxStakeType =
|
|
58
|
+
| 'cosmos.staking.delegate'
|
|
59
|
+
| 'cosmos.staking.undelegate'
|
|
60
|
+
| 'cosmos.staking.redelegate';
|
|
61
|
+
|
|
62
|
+
/** A bank step as the model writes it: a display amount of a listed token. */
|
|
63
|
+
export type ChainTxBankInput = {
|
|
64
|
+
type: 'cosmos.bank.send';
|
|
65
|
+
toAddress: string;
|
|
66
|
+
/** A plain decimal in the token's display units ("1.5"). */
|
|
67
|
+
amount: string;
|
|
68
|
+
denom?: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** A stake step as the model writes it: a display amount of IXO. */
|
|
72
|
+
export type ChainTxStakeInput = DistributiveOmit<
|
|
73
|
+
Extract<ChainTxMessage, { type: ChainTxStakeType }>,
|
|
74
|
+
'amountBaseUnits'
|
|
75
|
+
> & {
|
|
76
|
+
/** A plain decimal in IXO ("100" or "0.5"). */
|
|
77
|
+
amount: string;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* One action of a new group proposal (`daodao.proposal.create` `actions`)
|
|
82
|
+
* as the model writes it: the protocol's action, with a bank or stake
|
|
83
|
+
* action's amount in display units as at top level. The group's own
|
|
84
|
+
* account is its actor, so none of them names the owner.
|
|
85
|
+
*/
|
|
86
|
+
export type ChainTxGroupActionInput =
|
|
87
|
+
| ChainTxBankInput
|
|
88
|
+
| ChainTxStakeInput
|
|
89
|
+
| Exclude<
|
|
90
|
+
ChainTxGroupAction,
|
|
91
|
+
{ type: 'cosmos.bank.send' | ChainTxStakeType }
|
|
92
|
+
>;
|
|
93
|
+
|
|
35
94
|
/**
|
|
36
95
|
* A chain-transaction message as the model writes it: the protocol's
|
|
37
|
-
* message without the owner's identity, which the
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
96
|
+
* message without the owner's identity (`ChainTxOwnerField`), which the
|
|
97
|
+
* host fills. A bank step names a display `amount` of a token from the
|
|
98
|
+
* owner's list (`denom`, absent = uixo); a stake step a display `amount` of
|
|
99
|
+
* IXO. The host converts both to the protocol's `amountBaseUnits` (the
|
|
100
|
+
* listed decimals; 6 for IXO), at top level and inside a new group
|
|
101
|
+
* proposal's actions. Every other amount (impact tokens, a collection's
|
|
102
|
+
* payments) is already in the protocol's units.
|
|
42
103
|
*/
|
|
43
104
|
export type ChainTxMessageInput =
|
|
44
|
-
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
105
|
+
| ChainTxBankInput
|
|
106
|
+
| ChainTxStakeInput
|
|
107
|
+
| (Omit<
|
|
108
|
+
Extract<ChainTxMessage, { type: 'daodao.proposal.create' }>,
|
|
109
|
+
'actions'
|
|
110
|
+
> & { actions: ChainTxGroupActionInput[] })
|
|
111
|
+
| DistributiveOmit<
|
|
112
|
+
Exclude<
|
|
113
|
+
ChainTxMessage,
|
|
114
|
+
{
|
|
115
|
+
type:
|
|
116
|
+
| 'cosmos.bank.send'
|
|
117
|
+
| ChainTxStakeType
|
|
118
|
+
| 'daodao.proposal.create';
|
|
119
|
+
}
|
|
120
|
+
>,
|
|
121
|
+
ChainTxOwnerField
|
|
56
122
|
>;
|
|
57
123
|
|
|
58
124
|
/**
|
|
@@ -812,7 +878,13 @@ export interface RuntimeContext<TConfig = MergedConfig> {
|
|
|
812
878
|
|
|
813
879
|
/** Host-owned action coordinator. It accepts only runtime-derived channel context. */
|
|
814
880
|
hubActions?: {
|
|
815
|
-
|
|
881
|
+
/**
|
|
882
|
+
* The Hub's capabilities for this oracle account (cached 60 s).
|
|
883
|
+
* `turn`: a read on a turn's critical path (a tool list): a short
|
|
884
|
+
* timeout, no new read within 30 s of a failed one, and the last
|
|
885
|
+
* capabilities read while reads fail.
|
|
886
|
+
*/
|
|
887
|
+
capabilities(opts?: { turn?: boolean }): Promise<ActionCapabilitiesV1>;
|
|
816
888
|
options(input: {
|
|
817
889
|
ownerDid: string;
|
|
818
890
|
provider: string;
|
|
@@ -822,13 +894,19 @@ export interface RuntimeContext<TConfig = MergedConfig> {
|
|
|
822
894
|
/**
|
|
823
895
|
* One chain transaction (`ixo.chain.tx.v1`) of 1–8 messages: the host
|
|
824
896
|
* adds the chain id and network (the account's), the signer (the
|
|
825
|
-
* owner's address) and the owner's identity
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
*
|
|
829
|
-
*
|
|
830
|
-
*
|
|
831
|
-
* digits than its decimals, zero or more than the listed balance.
|
|
897
|
+
* owner's address) and the owner's identity (`ChainTxOwnerField`:
|
|
898
|
+
* `did:ixo:<signer>`, an evaluation's `agentAddress` = the signer) and
|
|
899
|
+
* prepares it like any operation (no fee: the Hub simulates gas and
|
|
900
|
+
* sets it). A bank step's display `amount` is converted to base units
|
|
901
|
+
* from the owner's token list (one options read per call, only when
|
|
902
|
+
* there is a bank or stake step), refused for a token not listed, more
|
|
903
|
+
* digits than its decimals, zero or more than the listed balance. A
|
|
904
|
+
* stake step's IXO `amount` is converted with 6 decimals; what a stake
|
|
905
|
+
* takes from the wallet counts against the listed IXO balance with the
|
|
906
|
+
* IXO bank steps, when the list has IXO. A new group proposal's bank and
|
|
907
|
+
* stake actions are converted the same way but never checked against
|
|
908
|
+
* the owner's balance: the group's own account pays them when the group
|
|
909
|
+
* carries the proposal out.
|
|
832
910
|
*/
|
|
833
911
|
chainTransaction(input: {
|
|
834
912
|
ownerDid: string;
|