@vordium/sdk 0.2.2 → 0.4.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.
@@ -0,0 +1,168 @@
1
+ /** The words of an action whose outcome is not yet known: {action: {state: {text, next}}}. Placeholders in
2
+ * braces are filled by the caller. */
3
+ export declare const OUTCOME_WORDS: {
4
+ readonly headline: {
5
+ readonly pending_checking: "Pending — checking";
6
+ };
7
+ readonly limit_s: 120;
8
+ readonly actions: {
9
+ readonly order: {
10
+ readonly pending_checking: {
11
+ readonly text: "Pending — checking. Your order was sent but the answer was lost. Checking the network for it.";
12
+ readonly next: "Do not place it again. This takes up to 2 minutes.";
13
+ };
14
+ readonly applied: {
15
+ readonly text: "{order_words}. Found on the network at block {height}.";
16
+ readonly next: "";
17
+ };
18
+ readonly refused: {
19
+ readonly text: "Not placed: {meaning}.";
20
+ readonly next: "{action}";
21
+ };
22
+ readonly not_applied: {
23
+ readonly text: "Not placed. The network did not take it, and its time to apply has passed.";
24
+ readonly next: "You can place it again.";
25
+ };
26
+ readonly still_unknown: {
27
+ readonly text: "Still not known after 2 minutes. It was not sent again and may still apply.";
28
+ readonly next: "Check your open orders before you place it again.";
29
+ };
30
+ };
31
+ readonly cancel: {
32
+ readonly pending_checking: {
33
+ readonly text: "Pending — checking. Your cancel was sent but the answer was lost. Checking whether the order is gone.";
34
+ readonly next: "Wait. This takes up to 2 minutes.";
35
+ };
36
+ readonly applied: {
37
+ readonly text: "Cancelled. The order is off the book.";
38
+ readonly next: "";
39
+ };
40
+ readonly applied_other: {
41
+ readonly text: "Filled before the cancel.";
42
+ readonly next: "Check your position.";
43
+ };
44
+ readonly refused: {
45
+ readonly text: "Not cancelled: {meaning}.";
46
+ readonly next: "{action}";
47
+ };
48
+ readonly still_unknown: {
49
+ readonly text: "Still not known after 2 minutes. The order is still on the book.";
50
+ readonly next: "You can cancel it again: cancelling twice has no extra effect.";
51
+ };
52
+ readonly still_unknown_gone: {
53
+ readonly text: "Still not known after 2 minutes. The order is off the book: it was cancelled or filled.";
54
+ readonly next: "Check your position.";
55
+ };
56
+ readonly still_unknown_unread: {
57
+ readonly text: "Still not known after 2 minutes. The network's reads did not answer.";
58
+ readonly next: "You can cancel it again: cancelling twice has no extra effect.";
59
+ };
60
+ };
61
+ readonly cancel_all: {
62
+ readonly pending_checking: {
63
+ readonly text: "Pending — checking. Cancel all was sent but the answer was lost. Checking your open orders.";
64
+ readonly next: "Wait. This takes up to 2 minutes.";
65
+ };
66
+ readonly applied: {
67
+ readonly text: "All {n} orders cancelled.";
68
+ readonly next: "";
69
+ };
70
+ readonly applied_other: {
71
+ readonly text: "{n} of {m} cancelled; {k} filled first.";
72
+ readonly next: "";
73
+ };
74
+ readonly refused: {
75
+ readonly text: "Not cancelled: {meaning}.";
76
+ readonly next: "";
77
+ };
78
+ readonly still_unknown: {
79
+ readonly text: "Still not known after 2 minutes. {n} orders are still open.";
80
+ readonly next: "Check your open orders; cancel what is still open.";
81
+ };
82
+ readonly still_unknown_unread: {
83
+ readonly text: "Still not known after 2 minutes. The network's reads did not answer.";
84
+ readonly next: "Check your open orders; cancel what is still open.";
85
+ };
86
+ };
87
+ readonly close_all: {
88
+ readonly pending_checking: {
89
+ readonly text: "Pending — checking. The closes were sent but the answers were lost. Checking your positions.";
90
+ readonly next: "Wait. This takes up to 2 minutes.";
91
+ };
92
+ readonly applied: {
93
+ readonly text: "{n} positions closed.";
94
+ readonly next: "";
95
+ };
96
+ readonly applied_other: {
97
+ readonly text: "{n} of {m} closed. {k} still open.";
98
+ readonly next: "Close them on the trading page.";
99
+ };
100
+ readonly refused: {
101
+ readonly text: "Not closed: {meaning}.";
102
+ readonly next: "";
103
+ };
104
+ readonly still_unknown: {
105
+ readonly text: "Still not known after 2 minutes. {n} positions are still open.";
106
+ readonly next: "Close what is still open on the trading page.";
107
+ };
108
+ };
109
+ readonly revoke: {
110
+ readonly pending_checking: {
111
+ readonly text: "Pending — checking. The revoke was sent. Checking that the agent is revoked.";
112
+ readonly next: "Wait. This takes up to 2 minutes.";
113
+ };
114
+ readonly applied: {
115
+ readonly text: "Agent revoked at block {height}. {m} orders cancelled.";
116
+ readonly next: "";
117
+ };
118
+ readonly refused: {
119
+ readonly text: "Not revoked: {meaning}.";
120
+ readonly next: "";
121
+ };
122
+ readonly still_unknown: {
123
+ readonly text: "Still not known after 2 minutes. The agent is still live.";
124
+ readonly next: "You can revoke again: it has no extra effect.";
125
+ };
126
+ readonly still_unknown_unread: {
127
+ readonly text: "Still not known after 2 minutes. The network's reads did not answer.";
128
+ readonly next: "You can revoke again: it has no extra effect.";
129
+ };
130
+ };
131
+ readonly stop: {
132
+ readonly pending_checking: {
133
+ readonly text: "Pending — checking. The stop was sent. Checking that your trading key and agents are stopped.";
134
+ readonly next: "Wait. This takes up to 2 minutes.";
135
+ };
136
+ readonly applied: {
137
+ readonly text: "Stopped on the network: no trading key, no live agent, no open order.";
138
+ readonly next: "";
139
+ };
140
+ readonly applied_other: {
141
+ readonly text: "Your trading key and every agent are stopped. {n} orders your wallet placed itself stay open.";
142
+ readonly next: "";
143
+ };
144
+ readonly refused: {
145
+ readonly text: "Not stopped: {meaning}.";
146
+ readonly next: "";
147
+ };
148
+ readonly not_applied: {
149
+ readonly text: "Not stopped. That signature has passed its time to apply.";
150
+ readonly next: "Press Stop everything now again.";
151
+ };
152
+ readonly still_unknown: {
153
+ readonly text: "Still not known after 2 minutes. {what_is_live}.";
154
+ readonly next: "You can stop again: it has no extra effect.";
155
+ };
156
+ };
157
+ };
158
+ readonly resend_while_pending: {
159
+ readonly order: null;
160
+ readonly cancel: "Send the same cancel again";
161
+ readonly cancel_all: null;
162
+ readonly close_all: null;
163
+ readonly revoke: "Send the same revoke again";
164
+ readonly stop: "Send the same stop again";
165
+ };
166
+ readonly check_again: "Check again";
167
+ readonly place_as_new: "Place as a new order";
168
+ };
@@ -0,0 +1,169 @@
1
+ // GENERATED from the shared outcome word file (sha256 dc1376362841a1bd9e4870c3471b9a0a7b4f1246ab6736a5f42a10747422920f). Do not edit by hand: regenerate it.
2
+ /** The words of an action whose outcome is not yet known: {action: {state: {text, next}}}. Placeholders in
3
+ * braces are filled by the caller. */
4
+ export const OUTCOME_WORDS = {
5
+ "headline": {
6
+ "pending_checking": "Pending — checking"
7
+ },
8
+ "limit_s": 120,
9
+ "actions": {
10
+ "order": {
11
+ "pending_checking": {
12
+ "text": "Pending — checking. Your order was sent but the answer was lost. Checking the network for it.",
13
+ "next": "Do not place it again. This takes up to 2 minutes."
14
+ },
15
+ "applied": {
16
+ "text": "{order_words}. Found on the network at block {height}.",
17
+ "next": ""
18
+ },
19
+ "refused": {
20
+ "text": "Not placed: {meaning}.",
21
+ "next": "{action}"
22
+ },
23
+ "not_applied": {
24
+ "text": "Not placed. The network did not take it, and its time to apply has passed.",
25
+ "next": "You can place it again."
26
+ },
27
+ "still_unknown": {
28
+ "text": "Still not known after 2 minutes. It was not sent again and may still apply.",
29
+ "next": "Check your open orders before you place it again."
30
+ }
31
+ },
32
+ "cancel": {
33
+ "pending_checking": {
34
+ "text": "Pending — checking. Your cancel was sent but the answer was lost. Checking whether the order is gone.",
35
+ "next": "Wait. This takes up to 2 minutes."
36
+ },
37
+ "applied": {
38
+ "text": "Cancelled. The order is off the book.",
39
+ "next": ""
40
+ },
41
+ "applied_other": {
42
+ "text": "Filled before the cancel.",
43
+ "next": "Check your position."
44
+ },
45
+ "refused": {
46
+ "text": "Not cancelled: {meaning}.",
47
+ "next": "{action}"
48
+ },
49
+ "still_unknown": {
50
+ "text": "Still not known after 2 minutes. The order is still on the book.",
51
+ "next": "You can cancel it again: cancelling twice has no extra effect."
52
+ },
53
+ "still_unknown_gone": {
54
+ "text": "Still not known after 2 minutes. The order is off the book: it was cancelled or filled.",
55
+ "next": "Check your position."
56
+ },
57
+ "still_unknown_unread": {
58
+ "text": "Still not known after 2 minutes. The network's reads did not answer.",
59
+ "next": "You can cancel it again: cancelling twice has no extra effect."
60
+ }
61
+ },
62
+ "cancel_all": {
63
+ "pending_checking": {
64
+ "text": "Pending — checking. Cancel all was sent but the answer was lost. Checking your open orders.",
65
+ "next": "Wait. This takes up to 2 minutes."
66
+ },
67
+ "applied": {
68
+ "text": "All {n} orders cancelled.",
69
+ "next": ""
70
+ },
71
+ "applied_other": {
72
+ "text": "{n} of {m} cancelled; {k} filled first.",
73
+ "next": ""
74
+ },
75
+ "refused": {
76
+ "text": "Not cancelled: {meaning}.",
77
+ "next": ""
78
+ },
79
+ "still_unknown": {
80
+ "text": "Still not known after 2 minutes. {n} orders are still open.",
81
+ "next": "Check your open orders; cancel what is still open."
82
+ },
83
+ "still_unknown_unread": {
84
+ "text": "Still not known after 2 minutes. The network's reads did not answer.",
85
+ "next": "Check your open orders; cancel what is still open."
86
+ }
87
+ },
88
+ "close_all": {
89
+ "pending_checking": {
90
+ "text": "Pending — checking. The closes were sent but the answers were lost. Checking your positions.",
91
+ "next": "Wait. This takes up to 2 minutes."
92
+ },
93
+ "applied": {
94
+ "text": "{n} positions closed.",
95
+ "next": ""
96
+ },
97
+ "applied_other": {
98
+ "text": "{n} of {m} closed. {k} still open.",
99
+ "next": "Close them on the trading page."
100
+ },
101
+ "refused": {
102
+ "text": "Not closed: {meaning}.",
103
+ "next": ""
104
+ },
105
+ "still_unknown": {
106
+ "text": "Still not known after 2 minutes. {n} positions are still open.",
107
+ "next": "Close what is still open on the trading page."
108
+ }
109
+ },
110
+ "revoke": {
111
+ "pending_checking": {
112
+ "text": "Pending — checking. The revoke was sent. Checking that the agent is revoked.",
113
+ "next": "Wait. This takes up to 2 minutes."
114
+ },
115
+ "applied": {
116
+ "text": "Agent revoked at block {height}. {m} orders cancelled.",
117
+ "next": ""
118
+ },
119
+ "refused": {
120
+ "text": "Not revoked: {meaning}.",
121
+ "next": ""
122
+ },
123
+ "still_unknown": {
124
+ "text": "Still not known after 2 minutes. The agent is still live.",
125
+ "next": "You can revoke again: it has no extra effect."
126
+ },
127
+ "still_unknown_unread": {
128
+ "text": "Still not known after 2 minutes. The network's reads did not answer.",
129
+ "next": "You can revoke again: it has no extra effect."
130
+ }
131
+ },
132
+ "stop": {
133
+ "pending_checking": {
134
+ "text": "Pending — checking. The stop was sent. Checking that your trading key and agents are stopped.",
135
+ "next": "Wait. This takes up to 2 minutes."
136
+ },
137
+ "applied": {
138
+ "text": "Stopped on the network: no trading key, no live agent, no open order.",
139
+ "next": ""
140
+ },
141
+ "applied_other": {
142
+ "text": "Your trading key and every agent are stopped. {n} orders your wallet placed itself stay open.",
143
+ "next": ""
144
+ },
145
+ "refused": {
146
+ "text": "Not stopped: {meaning}.",
147
+ "next": ""
148
+ },
149
+ "not_applied": {
150
+ "text": "Not stopped. That signature has passed its time to apply.",
151
+ "next": "Press Stop everything now again."
152
+ },
153
+ "still_unknown": {
154
+ "text": "Still not known after 2 minutes. {what_is_live}.",
155
+ "next": "You can stop again: it has no extra effect."
156
+ }
157
+ }
158
+ },
159
+ "resend_while_pending": {
160
+ "order": null,
161
+ "cancel": "Send the same cancel again",
162
+ "cancel_all": null,
163
+ "close_all": null,
164
+ "revoke": "Send the same revoke again",
165
+ "stop": "Send the same stop again"
166
+ },
167
+ "check_again": "Check again",
168
+ "place_as_new": "Place as a new order"
169
+ };
@@ -17,10 +17,15 @@ export interface Pin {
17
17
  export declare const PINS: Readonly<Record<'mainnet' | 'testnet', Readonly<Pin>>>;
18
18
  /** The network reports a chain id or genesis other than its pin. Nothing was signed. */
19
19
  export declare class PinMismatch extends NetworkMismatch {
20
+ /** When the reason is the signed release record: its code (`expired`, `rollback`, `not_served`, `unsigned`,
21
+ * `bad_signature`, `not_listed`, …), else null. */
22
+ recordCode: string | null;
20
23
  constructor(message: string);
21
24
  }
22
25
  /** The network is not a named network and carries no pin. It can be read; nothing is signed for it. */
23
26
  export declare class UnpinnedNetwork extends NetworkMismatch {
27
+ /** When the reason is the signed release record (a network named only by its chain id): its code, else null. */
28
+ recordCode: string | null;
24
29
  constructor(message: string);
25
30
  }
26
31
  /** A pin checked for shape: a positive safe-integer chain id and a 32-byte genesis (returned lower-case, no 0x). */
package/dist/esm/pins.js CHANGED
@@ -5,6 +5,9 @@ export const PINS = Object.freeze({
5
5
  });
6
6
  /** The network reports a chain id or genesis other than its pin. Nothing was signed. */
7
7
  export class PinMismatch extends NetworkMismatch {
8
+ /** When the reason is the signed release record: its code (`expired`, `rollback`, `not_served`, `unsigned`,
9
+ * `bad_signature`, `not_listed`, …), else null. */
10
+ recordCode = null;
8
11
  constructor(message) {
9
12
  super(message);
10
13
  this.name = 'PinMismatch';
@@ -12,6 +15,8 @@ export class PinMismatch extends NetworkMismatch {
12
15
  }
13
16
  /** The network is not a named network and carries no pin. It can be read; nothing is signed for it. */
14
17
  export class UnpinnedNetwork extends NetworkMismatch {
18
+ /** When the reason is the signed release record (a network named only by its chain id): its code, else null. */
19
+ recordCode = null;
15
20
  constructor(message) {
16
21
  super(message);
17
22
  this.name = 'UnpinnedNetwork';
@@ -24,6 +24,10 @@ export declare const RELEASE_KEY_FINGERPRINT = "C5EB4728F660369CE519D834B48FB4B7
24
24
  export declare const RELEASE_KEY = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmDMEaqXHBhYJKwYBBAHaRw8BAQdA8NRFgXw3NaEYFesojdDl1TlSlk9O5bXhsM4i\no7k3e+q0J1ZvcmRpdW0gUmVsZWFzZXMgPHJlbGVhc2VzQHZvcmRpdW0uY29tPoi1\nBBMWCgBdFiEExetHKPZgNpzlGdg0tI+0tx79SK4FAmqlxwYbFIAAAAAABAAObWFu\ndTIsMi41KzEuMTIsMCwzAhsDBQkDwmcABQsJCAcCAiICBhUKCQgLAgQWAgMBAh4H\nAheAAAoJELSPtLce/UiuMUgA/2VojVnml+DJHQ6xbxhnbrNeD5p8H4lXsVASdpvs\nRsCIAQCkMr8M76++QNGj08s+apf7CDgEVwbBFo4shxsYAU+gDw==\n=20lT\n-----END PGP PUBLIC KEY BLOCK-----\n";
25
25
  /** Where each named network's record is read, in order. The signature is read at the same address + ".asc". */
26
26
  export declare const RELEASE_RECORD_URLS: Readonly<Record<'mainnet' | 'testnet', readonly string[]>>;
27
+ /** The lowest record sequence this SDK release accepts for each chain id, also on a computer that has read no record yet
28
+ * (an empty state folder): the release process sets it to the sequence of the record served when the release is made.
29
+ * 0 = no floor. A floor above 0 also counts as a record already seen: while none is served, nothing is signed. */
30
+ export declare const MIN_RECORD_SEQUENCE: Readonly<Record<number, number>>;
27
31
  /** The record format this SDK reads. */
28
32
  export declare const RELEASE_RECORD_SCHEMA = "vordium.release-record/3";
29
33
  /** Where the release key is served. Read only when the key's expiry is near or past (see {@link refreshKey}). */
@@ -127,6 +131,8 @@ export interface ReadRecordOptions {
127
131
  store?: NonceStore;
128
132
  /** This computer's clock in milliseconds (tests replace it). */
129
133
  now?: () => number;
134
+ /** Tests only: the lowest sequence accepted per chain id, instead of {@link MIN_RECORD_SEQUENCE}. */
135
+ minSequence?: Readonly<Record<number, number>>;
130
136
  }
131
137
  /**
132
138
  * Read the signed record for `chainId` from the first of `urls` that serves one (through `transport.getBytes`; a
@@ -40,6 +40,10 @@ export const RELEASE_RECORD_URLS = Object.freeze({
40
40
  mainnet: Object.freeze(['https://binaries.vordium.com/mainnet/releases.json', 'https://rpc.vordium.com/releases.json']),
41
41
  testnet: Object.freeze(['https://binaries.vordium.com/testnet/releases.json']),
42
42
  });
43
+ /** The lowest record sequence this SDK release accepts for each chain id, also on a computer that has read no record yet
44
+ * (an empty state folder): the release process sets it to the sequence of the record served when the release is made.
45
+ * 0 = no floor. A floor above 0 also counts as a record already seen: while none is served, nothing is signed. */
46
+ export const MIN_RECORD_SEQUENCE = Object.freeze({ 101101: 0, 101102: 0 });
43
47
  /** The record format this SDK reads. */
44
48
  export const RELEASE_RECORD_SCHEMA = 'vordium.release-record/3';
45
49
  /** Where the release key is served. Read only when the key's expiry is near or past (see {@link refreshKey}). */
@@ -721,18 +725,48 @@ async function mark(store, key, fn) {
721
725
  throw new RecordRefused('state', `The stored sequence of the release record cannot be read (${e.message}). Nothing is signed. Check the file, or remove it to accept the next record.`);
722
726
  }
723
727
  }
724
- /** The highest sequence of a verified record seen for `chainId` (null when none). Kept in `store` as sequence + 1. */
725
- async function seenSequence(store, fp, chainId) {
728
+ /** The sequence the Python SDK keeps in the same state folder (its file holds the plain sequence), or null. A file that
729
+ * cannot be read is not counted here (that SDK refuses on it itself). */
730
+ async function otherSdkSequence(store, fp, chainId) {
731
+ const file = store.where?.(stateKey(fp, chainId));
732
+ if (!file)
733
+ return null;
734
+ try {
735
+ const fs = (await import('node:fs/promises'));
736
+ const text = (await fs.readFile(file.replace(/release-record-mark\.([^/\\]+)$/, 'release-record.$1'), 'utf8')).trim();
737
+ return /^\d+$/.test(text) ? Number(text) : null;
738
+ }
739
+ catch {
740
+ return null;
741
+ }
742
+ }
743
+ const floorOf = (chainId, min) => {
744
+ const v = (min ?? MIN_RECORD_SEQUENCE)[chainId];
745
+ return typeof v === 'number' && Number.isSafeInteger(v) && v > 0 ? v : null;
746
+ };
747
+ /** The highest sequence of a verified record seen for `chainId` on this computer, by this SDK or the Python SDK in the
748
+ * same state folder, and at least this release's {@link MIN_RECORD_SEQUENCE} (null when none). Kept in `store` as
749
+ * sequence + 1. */
750
+ async function seenSequence(store, fp, chainId, min) {
726
751
  const v = await mark(store, stateKey(fp, chainId), (last) => last);
727
- return v > 0 ? v - 1 : null;
752
+ const vals = [v > 0 ? v - 1 : null, await otherSdkSequence(store, fp, chainId), floorOf(chainId, min)].filter((x) => x !== null);
753
+ return vals.length ? Math.max(...vals) : null;
728
754
  }
729
- /** Refuse `sequence` when it is lower than the highest seen for `chainId`; else keep the highest. */
730
- async function acceptSequence(store, fp, chainId, sequence) {
731
- await mark(store, stateKey(fp, chainId), (last) => {
755
+ /** Refuse `sequence` when it is lower than this release's floor or the highest seen for `chainId` (by either SDK); else
756
+ * keep the highest. */
757
+ async function acceptSequence(store, fp, chainId, sequence, min) {
758
+ const floor = floorOf(chainId, min);
759
+ if (floor !== null && sequence < floor) {
760
+ throw new RecordRefused('rollback', `The signed release record for chain ${chainId} has sequence ${sequence}, lower than sequence ${floor}, the lowest this SDK release accepts: an older record is being served. It is not used.`);
761
+ }
762
+ await mark(store, stateKey(fp, chainId), (own) => own); // the store knows its folder once it has been used
763
+ const other = await otherSdkSequence(store, fp, chainId);
764
+ await mark(store, stateKey(fp, chainId), (own) => {
765
+ const last = other === null ? own : Math.max(own, other + 1);
732
766
  if (last > 0 && sequence < last - 1) {
733
767
  throw new RecordRefused('rollback', `The signed release record for chain ${chainId} has sequence ${sequence}, lower than sequence ${last - 1} already seen on this computer: an older record is being served. It is not used.`);
734
768
  }
735
- return Math.max(last, sequence + 1);
769
+ return Math.max(own, sequence + 1);
736
770
  });
737
771
  }
738
772
  async function fetchBytes(t, url, timeoutMs, limit) {
@@ -793,12 +827,12 @@ export async function readRecord(chainId, urls, keys, opts) {
793
827
  if (!record)
794
828
  continue;
795
829
  if (nowMs() / 1000 > record.validUntil) {
796
- throw new RecordRefused('expired', `The signed release record expired at ${new Date(record.validUntil * 1000).toISOString().slice(0, 16).replace('T', ' ')} UTC. It is not used.`);
830
+ throw new RecordRefused('expired', `The signed release record expired at ${new Date(record.validUntil * 1000).toISOString().slice(0, 16).replace('T', ' ')} UTC. It is not used. Try again later; if this persists, check this computer's clock.`);
797
831
  }
798
832
  const entry = record.networks.get(chainId);
799
833
  if (!entry)
800
834
  throw new RecordRefused('not_listed', `The signed release record does not list chain ${chainId}. Nothing is signed for it.`);
801
- await acceptSequence(store, signed.fingerprint, chainId, record.sequence);
835
+ await acceptSequence(store, signed.fingerprint, chainId, record.sequence, opts.minSequence);
802
836
  return { record, entry, url };
803
837
  }
804
838
  catch (e) {
@@ -810,7 +844,10 @@ export async function readRecord(chainId, urls, keys, opts) {
810
844
  if (problem)
811
845
  throw problem;
812
846
  for (const k of keys) {
813
- const last = await seenSequence(store, k.fingerprint, chainId);
847
+ const last = await seenSequence(store, k.fingerprint, chainId, opts.minSequence);
848
+ if (last !== null && (await seenSequence(store, k.fingerprint, chainId, {})) === null) {
849
+ throw new RecordRefused('not_served', `No signed release record for chain ${chainId} is served now, and this SDK release needs one with sequence ${last} or later. Nothing is signed until it is served.`);
850
+ }
814
851
  if (last !== null) {
815
852
  throw new RecordRefused('not_served', `No signed release record for chain ${chainId} is served now, though one (sequence ${last}) was read on this computer before. Nothing is signed until it is served again.`);
816
853
  }
@@ -32,6 +32,7 @@ export declare const TYPE_STRINGS: {
32
32
  readonly RevokeAgent: "RevokeAgent(address owner,address agent,uint64 nonce)";
33
33
  readonly SessionCreate: "SessionCreate(address sessionKey,uint256 expiresAt,uint256 nonce)";
34
34
  readonly SessionRevoke: "SessionRevoke(address owner,uint256 nonce)";
35
+ readonly StopAllSigners: "StopAllSigners(address owner,uint256 nonce,uint256 validUntil)";
35
36
  };
36
37
  export type PrimaryType = Exclude<keyof typeof TYPE_STRINGS, 'BatchAction'>;
37
38
  export declare function parseTypeString(s: string): {
package/dist/esm/types.js CHANGED
@@ -27,6 +27,7 @@ export const TYPE_STRINGS = {
27
27
  // VordexSession
28
28
  SessionCreate: 'SessionCreate(address sessionKey,uint256 expiresAt,uint256 nonce)',
29
29
  SessionRevoke: 'SessionRevoke(address owner,uint256 nonce)',
30
+ StopAllSigners: 'StopAllSigners(address owner,uint256 nonce,uint256 validUntil)',
30
31
  };
31
32
  export function parseTypeString(s) {
32
33
  const m = /^([A-Za-z0-9]+)\(([^()]*)\)$/.exec(s);
@@ -51,5 +52,5 @@ export function typesFor(primary) {
51
52
  }
52
53
  /** Which domain each operation is signed in. */
53
54
  export function domainOf(primary) {
54
- return primary === 'SessionCreate' || primary === 'SessionRevoke' ? 'VordexSession' : 'VordCore';
55
+ return primary === 'SessionCreate' || primary === 'SessionRevoke' || primary === 'StopAllSigners' ? 'VordexSession' : 'VordCore';
55
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vordium/sdk",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "TypeScript and JavaScript SDK for Vordium Chain and the Vordex perpetuals exchange: signing, orders, session keys, agents, TWAP, margin mode and live feeds.",
5
5
  "license": "MIT",
6
6
  "author": "Vordium <dev@vordium.com>",