@dopamint-fun/open-sdk 0.2.0-dev.0 → 0.2.0-dev.10
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/README.md +3 -3
- package/dist/agentHttp.js +12 -15
- package/dist/bytes.js +1 -1
- package/dist/claim.js +38 -22
- package/dist/cli.js +79 -56
- package/dist/identity.js +19 -37
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -7
- package/dist/offer.js +3 -3
- package/dist/openTournament.d.ts +22 -0
- package/dist/openTournament.js +34 -3
- package/dist/refusal.d.ts +5 -0
- package/dist/refusal.js +21 -0
- package/dist/room.d.ts +29 -7
- package/dist/room.js +40 -10
- package/dist/seatState.d.ts +61 -5
- package/dist/seatState.js +162 -7
- package/dist/seatTurn.d.ts +15 -2
- package/dist/seatTurn.js +99 -22
- package/dist/session.d.ts +12 -0
- package/dist/session.js +153 -55
- package/dist/sessionCodec.d.ts +162 -2
- package/dist/sessionCodec.js +658 -20
- package/dist/sessionWire.d.ts +6 -5
- package/dist/sessionWire.js +8 -7
- package/dist/settlement.d.ts +5 -1
- package/dist/settlement.js +6 -7
- package/dist/tour.js +4 -4
- package/package.json +2 -2
package/dist/sessionWire.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ByteWriter } from "./bytes.js";
|
|
2
2
|
/** The participant session version this build speaks.
|
|
3
3
|
*
|
|
4
|
-
* It is the contract that carries the named
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* refused
|
|
8
|
-
|
|
4
|
+
* It is the contract that carries the named prediction-gate lifecycle - the
|
|
5
|
+
* prepared and open notices, the terminal release overlay, and the optional
|
|
6
|
+
* handshake view a held seat joins or resumes with - so an authority that
|
|
7
|
+
* cannot name it in its join advertisement is refused at discovery and a
|
|
8
|
+
* selected context from any other version is refused rather than re-encoded. */
|
|
9
|
+
export declare const SESSION_VERSION = 3;
|
|
9
10
|
/** A selected participant session version this build cannot speak.
|
|
10
11
|
*
|
|
11
12
|
* Thrown where a *selected* version enters or leaves the process -- a
|
package/dist/sessionWire.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Join, action, and resume signing bodies live here; acknowledgements are
|
|
5
5
|
* unsigned and encoded next to the authority decoder. The layouts are pinned
|
|
6
|
-
* by `libs/dopa-open
|
|
6
|
+
* by `libs/dopa-open/client-rs/vectors/ts-signer-parity.json`.
|
|
7
7
|
*/
|
|
8
8
|
import { ByteWriter, frameSigningBytes, textBytes } from "./bytes.js";
|
|
9
9
|
const JOIN_DOMAIN = textBytes("arena_session::join");
|
|
@@ -14,11 +14,12 @@ const ACTION_PROPOSAL_TAG = 0x04;
|
|
|
14
14
|
const SESSION_RESUME_REQUEST_TAG = 0x0a;
|
|
15
15
|
/** The participant session version this build speaks.
|
|
16
16
|
*
|
|
17
|
-
* It is the contract that carries the named
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* refused
|
|
21
|
-
|
|
17
|
+
* It is the contract that carries the named prediction-gate lifecycle - the
|
|
18
|
+
* prepared and open notices, the terminal release overlay, and the optional
|
|
19
|
+
* handshake view a held seat joins or resumes with - so an authority that
|
|
20
|
+
* cannot name it in its join advertisement is refused at discovery and a
|
|
21
|
+
* selected context from any other version is refused rather than re-encoded. */
|
|
22
|
+
export const SESSION_VERSION = 3;
|
|
22
23
|
/** A selected participant session version this build cannot speak.
|
|
23
24
|
*
|
|
24
25
|
* Thrown where a *selected* version enters or leaves the process -- a
|
|
@@ -28,7 +29,7 @@ export const SESSION_VERSION = 2;
|
|
|
28
29
|
export class UnsupportedSessionVersionError extends Error {
|
|
29
30
|
version;
|
|
30
31
|
constructor(version) {
|
|
31
|
-
super(`unsupported participant session version ${version}; expected
|
|
32
|
+
super(`unsupported participant session version ${version}; expected 3`);
|
|
32
33
|
this.version = version;
|
|
33
34
|
this.name = "UnsupportedSessionVersionError";
|
|
34
35
|
}
|
package/dist/settlement.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/** The Product API's deployed default origin. `dopa-open`'s `--product-url`
|
|
2
|
+
* (and `DOPA_OPEN_PRODUCT_URL`) default here, matching the Rust client and
|
|
3
|
+
* CLI's `DEFAULT_OPEN_API_BASE_URL`, so a caller only has to override it for
|
|
4
|
+
* a local stack or a non-default plane. */
|
|
5
|
+
export declare const DEFAULT_OPEN_API_BASE_URL = "https://open.dopamint.fun";
|
|
1
6
|
export interface SeatEntitlement {
|
|
2
7
|
seat: number;
|
|
3
8
|
amount: bigint;
|
|
@@ -52,5 +57,4 @@ export declare function buildConsentRequest(args: ConsentDisclosure & {
|
|
|
52
57
|
signature: Uint8Array;
|
|
53
58
|
}): ConsentRequest;
|
|
54
59
|
export declare function settlementConsentPath(executionIdHex: string): string;
|
|
55
|
-
export declare function authorityOriginFromSessionBase(sessionBaseUrl: string): string;
|
|
56
60
|
export declare function digestForPrompt(prompt: ConsentPrompt): Uint8Array;
|
package/dist/settlement.js
CHANGED
|
@@ -2,6 +2,11 @@ import { ByteReader, ByteWriter, equalBytes, fromHex, textBytes, toHex0x, } from
|
|
|
2
2
|
import { digestFramed } from "./crypto.js";
|
|
3
3
|
const ANCHOR_DOMAIN_ID_V1 = textBytes("arena_tunnel::anchor_domain_id_v1");
|
|
4
4
|
const SETTLEMENT_PURPOSE = textBytes("arena_tunnel::settlement");
|
|
5
|
+
/** The Product API's deployed default origin. `dopa-open`'s `--product-url`
|
|
6
|
+
* (and `DOPA_OPEN_PRODUCT_URL`) default here, matching the Rust client and
|
|
7
|
+
* CLI's `DEFAULT_OPEN_API_BASE_URL`, so a caller only has to override it for
|
|
8
|
+
* a local stack or a non-default plane. */
|
|
9
|
+
export const DEFAULT_OPEN_API_BASE_URL = "https://open.dopamint.fun";
|
|
5
10
|
export function encodeTerminalState(state) {
|
|
6
11
|
const writer = new ByteWriter()
|
|
7
12
|
.pushU16(1)
|
|
@@ -103,13 +108,7 @@ export function buildConsentRequest(args) {
|
|
|
103
108
|
}
|
|
104
109
|
export function settlementConsentPath(executionIdHex) {
|
|
105
110
|
const hex = executionIdHex.replace(/^0x/, "");
|
|
106
|
-
return `/
|
|
107
|
-
}
|
|
108
|
-
export function authorityOriginFromSessionBase(sessionBaseUrl) {
|
|
109
|
-
const idx = sessionBaseUrl.indexOf("/v1/exec/");
|
|
110
|
-
if (idx <= 0)
|
|
111
|
-
throw new Error(`admission session_base_url is not an execution session URL: ${sessionBaseUrl}`);
|
|
112
|
-
return sessionBaseUrl.slice(0, idx);
|
|
111
|
+
return `/v1/authority/executions/${hex}/settlements`;
|
|
113
112
|
}
|
|
114
113
|
export function digestForPrompt(prompt) {
|
|
115
114
|
const terminal = decodeTerminalState(fromHex(prompt.encoded_terminal_state));
|
package/dist/tour.js
CHANGED
|
@@ -63,8 +63,8 @@ function unavailable(error) {
|
|
|
63
63
|
}
|
|
64
64
|
export async function enterTour(client, tour, floor = {}) {
|
|
65
65
|
const target = tour === "playground"
|
|
66
|
-
? "/
|
|
67
|
-
: "/
|
|
66
|
+
? "/v1/tours/playground/entries"
|
|
67
|
+
: "/v1/tours/tournament/entries";
|
|
68
68
|
if (floor.minAgents !== undefined && tour !== "playground")
|
|
69
69
|
throw new Error("a floor of real agents only applies to the playground");
|
|
70
70
|
/* No body at all when nothing is stated: the join every client sent before
|
|
@@ -124,13 +124,13 @@ export async function queueUntilSeated(client, tour, options = {}) {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
export async function readPosition(client, tableId) {
|
|
127
|
-
const { status, json } = await signedFetch(client, "GET", `/
|
|
127
|
+
const { status, json } = await signedFetch(client, "GET", `/v1/tables/${tableId}/decision`);
|
|
128
128
|
if (status !== 200)
|
|
129
129
|
throw new Error(refusalMessage("decision read", status, json));
|
|
130
130
|
return json;
|
|
131
131
|
}
|
|
132
132
|
export async function act(client, tableId, move) {
|
|
133
|
-
const { status, json } = await signedFetch(client, "POST", `/
|
|
133
|
+
const { status, json } = await signedFetch(client, "POST", `/v1/tables/${tableId}/actions`, move);
|
|
134
134
|
if (status !== 200)
|
|
135
135
|
throw new Error(refusalMessage("action", status, json));
|
|
136
136
|
return json;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dopamint-fun/open-sdk",
|
|
3
|
-
"version": "0.2.0-dev.
|
|
3
|
+
"version": "0.2.0-dev.10",
|
|
4
4
|
"description": "DOPA-OPEN client SDK: generate and hold your own agent key, sign registrations, and play a Participant Session",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/CommandOSSLabs/dopamint-arena.git",
|
|
9
|
-
"directory": "libs/dopa-open
|
|
9
|
+
"directory": "libs/dopa-open/client-ts"
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "dist/index.js",
|