@tinyburg/treasury-sdk 0.0.0-stage → 0.2.1

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,53 @@
1
+ /**
2
+ * The scopes the treasury api is guarded by, as one `treasury` area.
3
+ *
4
+ * These guard the treasury's own api - proposing, accepting and watching
5
+ * trades - not the towers the trades move items between. Acting on a tower
6
+ * (depositing an item into escrow, splicing a save) happens through the
7
+ * tinyburg api under that game's own scopes, with a grant the player gives the
8
+ * treasury separately on the consent screen. Splitting the two means "let the
9
+ * treasury manage my trades" and "let the treasury touch my tower" are
10
+ * distinct questions with distinct answers.
11
+ *
12
+ * The area is built with the same `defineArea` every game's scopes are, so
13
+ * `Treasury.read.list_trades` is the leaf named `treasury:list_trades`, and
14
+ * `Treasury.read.list_trades.required` is what goes on the endpoint.
15
+ *
16
+ * @since 1.0.0
17
+ * @category Scopes
18
+ */
19
+ import { type ScopeDescription } from "@tinyburg/nimblebit-sdk/NimblebitScopes";
20
+ /**
21
+ * @since 1.0.0
22
+ * @category Areas
23
+ */
24
+ export declare const Treasury: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Area & {
25
+ readonly read: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Branch & {
26
+ readonly get_trade: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
27
+ readonly grant_status: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
28
+ readonly list_inventory: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
29
+ readonly list_trades: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
30
+ };
31
+ readonly write: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Branch & {
32
+ readonly accept: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
33
+ readonly cancel: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
34
+ readonly confirm_splice: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
35
+ readonly propose: import("@tinyburg/nimblebit-sdk/NimblebitScopes").Leaf;
36
+ };
37
+ };
38
+ /**
39
+ * The shape of the treasury's area, for code that takes it as a value.
40
+ *
41
+ * @since 1.0.0
42
+ * @category Areas
43
+ */
44
+ export type TreasuryArea = typeof Treasury;
45
+ /**
46
+ * Every scope in the tree, the area first, then each branch, then its
47
+ * leaves. The order a consent screen lists them in.
48
+ *
49
+ * @since 1.0.0
50
+ * @category Tree
51
+ */
52
+ export declare const all: () => ReadonlyArray<ScopeDescription>;
53
+ //# sourceMappingURL=Scopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scopes.d.ts","sourceRoot":"","sources":["../src/Scopes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,gBAAgB,EAAc,MAAM,yCAAyC,CAAC;AAE5F;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;CAqBnB,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,QAAQ,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,QAAO,aAAa,CAAC,gBAAgB,CAMpD,CAAC"}
package/dist/Scopes.js ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The scopes the treasury api is guarded by, as one `treasury` area.
3
+ *
4
+ * These guard the treasury's own api - proposing, accepting and watching
5
+ * trades - not the towers the trades move items between. Acting on a tower
6
+ * (depositing an item into escrow, splicing a save) happens through the
7
+ * tinyburg api under that game's own scopes, with a grant the player gives the
8
+ * treasury separately on the consent screen. Splitting the two means "let the
9
+ * treasury manage my trades" and "let the treasury touch my tower" are
10
+ * distinct questions with distinct answers.
11
+ *
12
+ * The area is built with the same `defineArea` every game's scopes are, so
13
+ * `Treasury.read.list_trades` is the leaf named `treasury:list_trades`, and
14
+ * `Treasury.read.list_trades.required` is what goes on the endpoint.
15
+ *
16
+ * @since 1.0.0
17
+ * @category Scopes
18
+ */
19
+ import { defineArea } from "@tinyburg/nimblebit-sdk/NimblebitScopes";
20
+ /**
21
+ * @since 1.0.0
22
+ * @category Areas
23
+ */
24
+ export const Treasury = /*#__PURE__*/defineArea({
25
+ name: "treasury",
26
+ description: "Trades escrowed by the Tinyburg treasury",
27
+ read: {
28
+ description: "See your trades and what could go into them, without changing anything",
29
+ leaves: {
30
+ grant_status: "Check whether the treasury can act on your towers",
31
+ list_trades: "List your trades and the open offers you could accept",
32
+ get_trade: "See one trade's full state and history",
33
+ list_inventory: "See which of a tower's items could be traded"
34
+ }
35
+ },
36
+ write: {
37
+ description: "Propose, accept, cancel and confirm trades",
38
+ leaves: {
39
+ propose: "Propose a trade with another player",
40
+ accept: "Accept a trade proposed to you",
41
+ cancel: "Cancel a trade you are part of",
42
+ confirm_splice: "Confirm a save-splice trade for execution"
43
+ }
44
+ }
45
+ });
46
+ /**
47
+ * Every scope in the tree, the area first, then each branch, then its
48
+ * leaves. The order a consent screen lists them in.
49
+ *
50
+ * @since 1.0.0
51
+ * @category Tree
52
+ */
53
+ export const all = () => [Treasury, Treasury.read, ...Treasury.read.children, Treasury.write, ...Treasury.write.children];
54
+ //# sourceMappingURL=Scopes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scopes.js","names":[],"sources":["../src/Scopes.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;AAmBA,SAAgC,UAAU,QAAQ,yCAAyC;AAE3F;;;;AAIA,OAAO,MAAM,QAAQ,gBAAG,UAAU,CAAC;EAC/B,IAAI,EAAE,UAAU;EAChB,WAAW,EAAE,0CAA0C;EACvD,IAAI,EAAE;IACF,WAAW,EAAE,wEAAwE;IACrF,MAAM,EAAE;MACJ,YAAY,EAAE,mDAAmD;MACjE,WAAW,EAAE,uDAAuD;MACpE,SAAS,EAAE,wCAAwC;MACnD,cAAc,EAAE;;GAEvB;EACD,KAAK,EAAE;IACH,WAAW,EAAE,4CAA4C;IACzD,MAAM,EAAE;MACJ,OAAO,EAAE,qCAAqC;MAC9C,MAAM,EAAE,gCAAgC;MACxC,MAAM,EAAE,gCAAgC;MACxC,cAAc,EAAE;;;CAG3B,CAAC;AAUF;;;;;;;AAOA,OAAO,MAAM,GAAG,GAAG,MAAuC,CACtD,QAAQ,EACR,QAAQ,CAAC,IAAI,EACb,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,EACzB,QAAQ,CAAC,KAAK,EACd,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAC7B","ignoreList":[]}