@misofm/sdk 0.15.11 → 0.16.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/README.md +145 -53
- package/dist/client.d.ts +156 -48
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +289 -48
- package/dist/client.js.map +1 -1
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +11 -11
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +1 -1
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +9 -9
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +1 -1
- package/dist/contracts/miso_record/deps/std/type_name.d.ts.map +1 -0
- package/dist/contracts/miso_record/deps/std/type_name.js.map +1 -0
- package/dist/contracts/miso_record/deps/sui/vec_set.d.ts +21 -0
- package/dist/contracts/miso_record/deps/sui/vec_set.d.ts.map +1 -0
- package/dist/contracts/miso_record/deps/sui/vec_set.js +20 -0
- package/dist/contracts/miso_record/deps/sui/vec_set.js.map +1 -0
- package/dist/contracts/miso_record/pressing.d.ts +327 -0
- package/dist/contracts/miso_record/pressing.d.ts.map +1 -0
- package/dist/contracts/miso_record/pressing.js +345 -0
- package/dist/contracts/miso_record/pressing.js.map +1 -0
- package/dist/contracts/miso_record/record.d.ts +190 -0
- package/dist/contracts/miso_record/record.d.ts.map +1 -0
- package/dist/contracts/miso_record/record.js +226 -0
- package/dist/contracts/miso_record/record.js.map +1 -0
- package/dist/contracts/miso_record_shop/deps/std/type_name.d.ts +18 -0
- package/dist/contracts/miso_record_shop/deps/std/type_name.d.ts.map +1 -0
- package/dist/contracts/miso_record_shop/deps/std/type_name.js +20 -0
- package/dist/contracts/miso_record_shop/deps/std/type_name.js.map +1 -0
- package/dist/contracts/miso_record_shop/listing.d.ts +387 -0
- package/dist/contracts/miso_record_shop/listing.d.ts.map +1 -0
- package/dist/contracts/miso_record_shop/listing.js +380 -0
- package/dist/contracts/miso_record_shop/listing.js.map +1 -0
- package/dist/contracts/miso_record_shop/witness.d.ts +7 -0
- package/dist/contracts/miso_record_shop/witness.d.ts.map +1 -0
- package/dist/contracts/miso_record_shop/witness.js +9 -0
- package/dist/contracts/miso_record_shop/witness.js.map +1 -0
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts +10 -12
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +1 -1
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +8 -10
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +1 -1
- package/dist/contracts.d.ts +3 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +5 -4
- package/dist/contracts.js.map +1 -1
- package/dist/deployments.d.ts +37 -4
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +40 -2
- package/dist/deployments.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mix.d.ts +144 -0
- package/dist/mix.d.ts.map +1 -0
- package/dist/mix.js +656 -0
- package/dist/mix.js.map +1 -0
- package/dist/pressing.d.ts +72 -156
- package/dist/pressing.d.ts.map +1 -1
- package/dist/pressing.js +269 -261
- package/dist/pressing.js.map +1 -1
- package/dist/publication.d.ts +5 -2
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js +57 -32
- package/dist/publication.js.map +1 -1
- package/dist/read/catalog.d.ts +8 -5
- package/dist/read/catalog.d.ts.map +1 -1
- package/dist/read/catalog.js +47 -35
- package/dist/read/catalog.js.map +1 -1
- package/dist/read/config.d.ts +6 -4
- package/dist/read/config.d.ts.map +1 -1
- package/dist/read/config.js +1 -2
- package/dist/read/config.js.map +1 -1
- package/dist/read/index.d.ts +1 -1
- package/dist/read/index.d.ts.map +1 -1
- package/dist/read/index.js +1 -1
- package/dist/read/index.js.map +1 -1
- package/dist/read/internal/scalars.d.ts.map +1 -1
- package/dist/read/internal/scalars.js +4 -3
- package/dist/read/internal/scalars.js.map +1 -1
- package/dist/read/internal/walrus.d.ts.map +1 -1
- package/dist/read/internal/walrus.js +2 -1
- package/dist/read/internal/walrus.js.map +1 -1
- package/dist/read/receipts.d.ts +21 -12
- package/dist/read/receipts.d.ts.map +1 -1
- package/dist/read/receipts.js +159 -56
- package/dist/read/receipts.js.map +1 -1
- package/dist/read/types.d.ts +34 -24
- package/dist/read/types.d.ts.map +1 -1
- package/dist/read/wallet.d.ts.map +1 -1
- package/dist/read/wallet.js +31 -46
- package/dist/read/wallet.js.map +1 -1
- package/dist/vault.d.ts +40 -11
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +94 -22
- package/dist/vault.js.map +1 -1
- package/package.json +10 -3
- package/src/client.ts +386 -72
- package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +15 -15
- package/src/contracts/miso_record/deps/sui/vec_set.ts +21 -0
- package/src/contracts/miso_record/pressing.ts +522 -0
- package/src/contracts/miso_record/record.ts +338 -0
- package/src/contracts/miso_record_shop/deps/std/type_name.ts +22 -0
- package/src/contracts/miso_record_shop/listing.ts +602 -0
- package/src/contracts/miso_record_shop/witness.ts +11 -0
- package/src/contracts/recording_royalty_pool/recording_royalty_pool.ts +14 -16
- package/src/contracts.ts +5 -4
- package/src/deployments.ts +131 -38
- package/src/index.ts +2 -0
- package/src/mix.ts +910 -0
- package/src/pressing.ts +428 -423
- package/src/publication.ts +62 -33
- package/src/read/catalog.ts +49 -34
- package/src/read/config.ts +7 -7
- package/src/read/index.ts +9 -1
- package/src/read/internal/scalars.ts +4 -2
- package/src/read/internal/walrus.ts +2 -1
- package/src/read/receipts.ts +181 -66
- package/src/read/types.ts +35 -22
- package/src/read/wallet.ts +29 -50
- package/src/vault.ts +142 -32
- package/dist/contracts/miso_pressing/certificate.d.ts +0 -89
- package/dist/contracts/miso_pressing/certificate.d.ts.map +0 -1
- package/dist/contracts/miso_pressing/certificate.js +0 -108
- package/dist/contracts/miso_pressing/certificate.js.map +0 -1
- package/dist/contracts/miso_pressing/deps/std/type_name.d.ts.map +0 -1
- package/dist/contracts/miso_pressing/deps/std/type_name.js.map +0 -1
- package/dist/contracts/miso_pressing/listing.d.ts +0 -434
- package/dist/contracts/miso_pressing/listing.d.ts.map +0 -1
- package/dist/contracts/miso_pressing/listing.js +0 -401
- package/dist/contracts/miso_pressing/listing.js.map +0 -1
- package/dist/contracts/miso_pressing/pressing.d.ts +0 -334
- package/dist/contracts/miso_pressing/pressing.d.ts.map +0 -1
- package/dist/contracts/miso_pressing/pressing.js +0 -298
- package/dist/contracts/miso_pressing/pressing.js.map +0 -1
- package/src/contracts/miso_pressing/certificate.ts +0 -164
- package/src/contracts/miso_pressing/listing.ts +0 -592
- package/src/contracts/miso_pressing/pressing.ts +0 -399
- /package/dist/contracts/{miso_pressing → miso_record}/deps/std/type_name.d.ts +0 -0
- /package/dist/contracts/{miso_pressing → miso_record}/deps/std/type_name.js +0 -0
- /package/src/contracts/{miso_pressing → miso_record}/deps/std/type_name.ts +0 -0
|
@@ -1,592 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* One currency's offer on a pressing — a _Listing_.
|
|
8
|
-
*
|
|
9
|
-
* A listing answers exactly two questions: **what does it cost** and **can you pay
|
|
10
|
-
* in this currency**. Everything about _what you get_ — the run, the number —
|
|
11
|
-
* belongs to the `Pressing`. So a pressing sold in SUI and in USDC has two
|
|
12
|
-
* listings, each with its own price and switch, both drawing on the same number
|
|
13
|
-
* sequence.
|
|
14
|
-
*
|
|
15
|
-
* A listing's UID is derived off its pressing's UID at `ListingKey<Currency>()`,
|
|
16
|
-
* so there is exactly one listing per (pressing, currency) — ever — and its
|
|
17
|
-
* address is computable from the pressing's alone. The key is _phantom-typed_
|
|
18
|
-
* rather than a stored `TypeName`, which makes the currency part of the key's
|
|
19
|
-
* type: distinct currencies are distinct key types, so `derived_object::claim`
|
|
20
|
-
* enforces once-per-currency by itself and the pressing needs no set of currencies
|
|
21
|
-
* to check against. Listings are **permanent**: never destroyed, never replaced.
|
|
22
|
-
* The offer changes _in place_ — repriced, disabled, re-enabled — and the listing
|
|
23
|
-
* keeps its identity through every change.
|
|
24
|
-
*
|
|
25
|
-
* # Price
|
|
26
|
-
*
|
|
27
|
-
* `Fixed` (pay exactly) or `Floor` (pay at least; overpayment is kept as a tip,
|
|
28
|
-
* not refunded). The whole payment forwards to the release's address. Settable
|
|
29
|
-
* with the `PressingAdminCap` (`set_price`) — repricing is an edit, not a teardown
|
|
30
|
-
* — and a change cannot catch a buyer out: a `Fixed` buyer pays _exactly_, so a
|
|
31
|
-
* stale payment aborts against a new price, and a `Floor` buyer never pays more
|
|
32
|
-
* than the balance they sent.
|
|
33
|
-
*
|
|
34
|
-
* Payment is a `Balance<Currency>`, never a `Coin<Currency>`. A coin is a wrapper
|
|
35
|
-
* an object id, an owner, and a wrapping/unwrapping round trip — that this path
|
|
36
|
-
* has no use for: the money comes in from wherever the PTB got it (a withdrawal
|
|
37
|
-
* off the buyer's accumulator, a `coin::into_balance`, a split of some larger
|
|
38
|
-
* balance) and goes straight back out to the release's address via
|
|
39
|
-
* `balance::send_funds`. Taking the bare value means `buy` never mints an object
|
|
40
|
-
* just to destroy it, and never forces the caller to make one either.
|
|
41
|
-
*
|
|
42
|
-
* # Two switches
|
|
43
|
-
*
|
|
44
|
-
* A listing is `Enabled` or `Disabled`; a disabled listing takes no payment in its
|
|
45
|
-
* currency, while the pressing's other currencies carry on. Above it, the
|
|
46
|
-
* pressing's own `Scheduled → Active → Paused` governs every currency at once
|
|
47
|
-
* (`pressing::mint_next`). A sale needs both open.
|
|
48
|
-
*
|
|
49
|
-
* The **when** lives on the pressing, not here: a drop moment is a fact about the
|
|
50
|
-
* release going on sale, not about one payment rail, and a run that opened in SUI
|
|
51
|
-
* at Friday 8pm and in USDC at some other time would have two drop moments and one
|
|
52
|
-
* number sequence. So a listing carries no schedule — only whether its currency is
|
|
53
|
-
* taken.
|
|
54
|
-
*
|
|
55
|
-
* # The certificate
|
|
56
|
-
*
|
|
57
|
-
* What the buyer paid is not part of the record — it is a fact about the _sale_ —
|
|
58
|
-
* so it rides out on the record's `Certificate`, stamped by `pressing::mint_next`
|
|
59
|
-
* alongside the number. One field, written once, in the transaction that pressed
|
|
60
|
-
* the record. `RecordSoldEvent` also snapshots both the accepted `Price` and the
|
|
61
|
-
* amount paid, so an indexer can distinguish fixed sales from floor sales and
|
|
62
|
-
* compute tips without replaying listing state.
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
import { MoveTuple, MoveEnum, MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
66
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
67
|
-
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
68
|
-
const $moduleName = '@local-pkg/miso_pressing::listing';
|
|
69
|
-
export const ListingKey = new MoveTuple({ name: `${$moduleName}::ListingKey<phantom Currency>`, fields: [bcs.bool()] });
|
|
70
|
-
/** Pricing policy for a listing. */
|
|
71
|
-
export const Price = new MoveEnum({ name: `${$moduleName}::Price`, fields: {
|
|
72
|
-
/** Pay exactly `amount`. */
|
|
73
|
-
Fixed: new MoveStruct({ name: `Price.Fixed`, fields: {
|
|
74
|
-
amount: bcs.u64()
|
|
75
|
-
} }),
|
|
76
|
-
/** Pay at least `amount`; overpayment is forwarded to the release, not refunded. */
|
|
77
|
-
Floor: new MoveStruct({ name: `Price.Floor`, fields: {
|
|
78
|
-
amount: bcs.u64()
|
|
79
|
-
} })
|
|
80
|
-
} });
|
|
81
|
-
/** Whether this currency is accepted. Set at creation and by `set_state`. */
|
|
82
|
-
export const ListingState = new MoveEnum({ name: `${$moduleName}::ListingState`, fields: {
|
|
83
|
-
/** Accepting payment in this currency, if the pressing is also active. */
|
|
84
|
-
Enabled: null,
|
|
85
|
-
/** Not accepting payment in this currency. Other currencies are unaffected. */
|
|
86
|
-
Disabled: null
|
|
87
|
-
} });
|
|
88
|
-
export const Listing = new MoveStruct({ name: `${$moduleName}::Listing<phantom Currency>`, fields: {
|
|
89
|
-
id: bcs.Address,
|
|
90
|
-
/** The release whose address collects the proceeds. */
|
|
91
|
-
release_id: bcs.Address,
|
|
92
|
-
/** The pressing these records come out of. */
|
|
93
|
-
pressing_id: bcs.Address,
|
|
94
|
-
/** What a buyer must pay per record. */
|
|
95
|
-
price: Price,
|
|
96
|
-
/** Whether this currency is accepted right now. */
|
|
97
|
-
state: ListingState
|
|
98
|
-
} });
|
|
99
|
-
export const ListingOpenedEvent = new MoveStruct({ name: `${$moduleName}::ListingOpenedEvent<phantom Currency>`, fields: {
|
|
100
|
-
listing_id: bcs.Address,
|
|
101
|
-
pressing_id: bcs.Address,
|
|
102
|
-
release_id: bcs.Address,
|
|
103
|
-
price: Price,
|
|
104
|
-
state: ListingState
|
|
105
|
-
} });
|
|
106
|
-
export const RecordSoldEvent = new MoveStruct({ name: `${$moduleName}::RecordSoldEvent<phantom Currency>`, fields: {
|
|
107
|
-
listing_id: bcs.Address,
|
|
108
|
-
pressing_id: bcs.Address,
|
|
109
|
-
release_id: bcs.Address,
|
|
110
|
-
record_id: bcs.Address,
|
|
111
|
-
number: bcs.u64(),
|
|
112
|
-
/**
|
|
113
|
-
* The offer accepted by this sale. Together with `paid`, this distinguishes a
|
|
114
|
-
* fixed-price sale from a floor-price sale and makes any tip directly computable.
|
|
115
|
-
*/
|
|
116
|
-
price: Price,
|
|
117
|
-
paid: bcs.u64(),
|
|
118
|
-
buyer: bcs.Address
|
|
119
|
-
} });
|
|
120
|
-
export const ListingStateChangedEvent = new MoveStruct({ name: `${$moduleName}::ListingStateChangedEvent<phantom Currency>`, fields: {
|
|
121
|
-
listing_id: bcs.Address,
|
|
122
|
-
pressing_id: bcs.Address,
|
|
123
|
-
state: ListingState
|
|
124
|
-
} });
|
|
125
|
-
export const ListingPriceChangedEvent = new MoveStruct({ name: `${$moduleName}::ListingPriceChangedEvent<phantom Currency>`, fields: {
|
|
126
|
-
listing_id: bcs.Address,
|
|
127
|
-
pressing_id: bcs.Address,
|
|
128
|
-
price: Price
|
|
129
|
-
} });
|
|
130
|
-
export interface NewFixedPriceArguments {
|
|
131
|
-
amount: RawTransactionArgument<number | bigint>;
|
|
132
|
-
}
|
|
133
|
-
export interface NewFixedPriceOptions {
|
|
134
|
-
package?: string;
|
|
135
|
-
arguments: NewFixedPriceArguments | [
|
|
136
|
-
amount: RawTransactionArgument<number | bigint>
|
|
137
|
-
];
|
|
138
|
-
}
|
|
139
|
-
/** A fixed price: a buyer must pay exactly `amount`. */
|
|
140
|
-
export function newFixedPrice(options: NewFixedPriceOptions) {
|
|
141
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
142
|
-
const argumentsTypes = [
|
|
143
|
-
'u64'
|
|
144
|
-
] satisfies (string | null)[];
|
|
145
|
-
const parameterNames = ["amount"];
|
|
146
|
-
return (tx: Transaction) => tx.moveCall({
|
|
147
|
-
package: packageAddress,
|
|
148
|
-
module: 'listing',
|
|
149
|
-
function: 'new_fixed_price',
|
|
150
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
export interface NewFloorPriceArguments {
|
|
154
|
-
amount: RawTransactionArgument<number | bigint>;
|
|
155
|
-
}
|
|
156
|
-
export interface NewFloorPriceOptions {
|
|
157
|
-
package?: string;
|
|
158
|
-
arguments: NewFloorPriceArguments | [
|
|
159
|
-
amount: RawTransactionArgument<number | bigint>
|
|
160
|
-
];
|
|
161
|
-
}
|
|
162
|
-
/** A floor price: a buyer must pay at least `amount`; overpayment is kept. */
|
|
163
|
-
export function newFloorPrice(options: NewFloorPriceOptions) {
|
|
164
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
165
|
-
const argumentsTypes = [
|
|
166
|
-
'u64'
|
|
167
|
-
] satisfies (string | null)[];
|
|
168
|
-
const parameterNames = ["amount"];
|
|
169
|
-
return (tx: Transaction) => tx.moveCall({
|
|
170
|
-
package: packageAddress,
|
|
171
|
-
module: 'listing',
|
|
172
|
-
function: 'new_floor_price',
|
|
173
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
export interface NewEnabledStateOptions {
|
|
177
|
-
package?: string;
|
|
178
|
-
arguments?: [
|
|
179
|
-
];
|
|
180
|
-
}
|
|
181
|
-
/** The enabled state: this currency is accepted. */
|
|
182
|
-
export function newEnabledState(options: NewEnabledStateOptions = {}) {
|
|
183
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
184
|
-
return (tx: Transaction) => tx.moveCall({
|
|
185
|
-
package: packageAddress,
|
|
186
|
-
module: 'listing',
|
|
187
|
-
function: 'new_enabled_state',
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
export interface NewDisabledStateOptions {
|
|
191
|
-
package?: string;
|
|
192
|
-
arguments?: [
|
|
193
|
-
];
|
|
194
|
-
}
|
|
195
|
-
/** The disabled state: this currency is not accepted. */
|
|
196
|
-
export function newDisabledState(options: NewDisabledStateOptions = {}) {
|
|
197
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
198
|
-
return (tx: Transaction) => tx.moveCall({
|
|
199
|
-
package: packageAddress,
|
|
200
|
-
module: 'listing',
|
|
201
|
-
function: 'new_disabled_state',
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
export interface NewArguments {
|
|
205
|
-
pressing: RawTransactionArgument<string>;
|
|
206
|
-
cap: RawTransactionArgument<string>;
|
|
207
|
-
price: TransactionArgument;
|
|
208
|
-
state: TransactionArgument;
|
|
209
|
-
}
|
|
210
|
-
export interface NewOptions {
|
|
211
|
-
package?: string;
|
|
212
|
-
arguments: NewArguments | [
|
|
213
|
-
pressing: RawTransactionArgument<string>,
|
|
214
|
-
cap: RawTransactionArgument<string>,
|
|
215
|
-
price: TransactionArgument,
|
|
216
|
-
state: TransactionArgument
|
|
217
|
-
];
|
|
218
|
-
typeArguments: [
|
|
219
|
-
string
|
|
220
|
-
];
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* List the pressing for sale in `Currency` at the given price and state, and share
|
|
224
|
-
* it.
|
|
225
|
-
*
|
|
226
|
-
* Exactly one listing per (pressing, currency), ever: the slot is a derived-object
|
|
227
|
-
* claim on the pressing at `ListingKey<Currency>()`, and listings are never
|
|
228
|
-
* destroyed — so a second call for the same currency aborts in the claim. Every
|
|
229
|
-
* later change to this currency's offer is an edit to this object, not a
|
|
230
|
-
* replacement of it.
|
|
231
|
-
*/
|
|
232
|
-
export function _new(options: NewOptions) {
|
|
233
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
234
|
-
const argumentsTypes = [
|
|
235
|
-
null,
|
|
236
|
-
null,
|
|
237
|
-
null,
|
|
238
|
-
null
|
|
239
|
-
] satisfies (string | null)[];
|
|
240
|
-
const parameterNames = ["pressing", "cap", "price", "state"];
|
|
241
|
-
return (tx: Transaction) => tx.moveCall({
|
|
242
|
-
package: packageAddress,
|
|
243
|
-
module: 'listing',
|
|
244
|
-
function: 'new',
|
|
245
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
246
|
-
typeArguments: options.typeArguments
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
export interface BuyArguments {
|
|
250
|
-
self: RawTransactionArgument<string>;
|
|
251
|
-
pressing: RawTransactionArgument<string>;
|
|
252
|
-
payment: TransactionArgument;
|
|
253
|
-
}
|
|
254
|
-
export interface BuyOptions {
|
|
255
|
-
package?: string;
|
|
256
|
-
arguments: BuyArguments | [
|
|
257
|
-
self: RawTransactionArgument<string>,
|
|
258
|
-
pressing: RawTransactionArgument<string>,
|
|
259
|
-
payment: TransactionArgument
|
|
260
|
-
];
|
|
261
|
-
typeArguments: [
|
|
262
|
-
string
|
|
263
|
-
];
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Buy one record: pay this listing's price, take the next number out of the
|
|
267
|
-
* pressing.
|
|
268
|
-
*
|
|
269
|
-
* `payment` is a bare `Balance<Currency>` and must satisfy the price (exactly, for
|
|
270
|
-
* `Fixed`; at least, for `Floor`). The ENTIRE payment forwards to the release's
|
|
271
|
-
* address — under `Floor`, anything above the floor is kept as a tip, not
|
|
272
|
-
* refunded. The record's number is the pressing's next 1-based value, shared with
|
|
273
|
-
* every other currency selling the same run, and its UID is derived off the
|
|
274
|
-
* pressing. The sale's transaction sender and terms are embedded in the record's
|
|
275
|
-
* `Certificate`.
|
|
276
|
-
*
|
|
277
|
-
* Both switches must be open: this listing `Enabled`, checked here, and the run
|
|
278
|
-
* selling at this moment, checked in `pressing::mint_next`.
|
|
279
|
-
*/
|
|
280
|
-
export function buy(options: BuyOptions) {
|
|
281
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
282
|
-
const argumentsTypes = [
|
|
283
|
-
null,
|
|
284
|
-
null,
|
|
285
|
-
null,
|
|
286
|
-
'0x2::clock::Clock'
|
|
287
|
-
] satisfies (string | null)[];
|
|
288
|
-
const parameterNames = ["self", "pressing", "payment"];
|
|
289
|
-
return (tx: Transaction) => tx.moveCall({
|
|
290
|
-
package: packageAddress,
|
|
291
|
-
module: 'listing',
|
|
292
|
-
function: 'buy',
|
|
293
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
294
|
-
typeArguments: options.typeArguments
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
export interface SetStateArguments {
|
|
298
|
-
self: RawTransactionArgument<string>;
|
|
299
|
-
cap: RawTransactionArgument<string>;
|
|
300
|
-
state: TransactionArgument;
|
|
301
|
-
}
|
|
302
|
-
export interface SetStateOptions {
|
|
303
|
-
package?: string;
|
|
304
|
-
arguments: SetStateArguments | [
|
|
305
|
-
self: RawTransactionArgument<string>,
|
|
306
|
-
cap: RawTransactionArgument<string>,
|
|
307
|
-
state: TransactionArgument
|
|
308
|
-
];
|
|
309
|
-
typeArguments: [
|
|
310
|
-
string
|
|
311
|
-
];
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Enable or disable this currency. Leaves every other currency untouched; to stop
|
|
315
|
-
* the whole run at once, pause the pressing (`pressing::set_state`).
|
|
316
|
-
*/
|
|
317
|
-
export function setState(options: SetStateOptions) {
|
|
318
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
319
|
-
const argumentsTypes = [
|
|
320
|
-
null,
|
|
321
|
-
null,
|
|
322
|
-
null
|
|
323
|
-
] satisfies (string | null)[];
|
|
324
|
-
const parameterNames = ["self", "cap", "state"];
|
|
325
|
-
return (tx: Transaction) => tx.moveCall({
|
|
326
|
-
package: packageAddress,
|
|
327
|
-
module: 'listing',
|
|
328
|
-
function: 'set_state',
|
|
329
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
330
|
-
typeArguments: options.typeArguments
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
export interface SetPriceArguments {
|
|
334
|
-
self: RawTransactionArgument<string>;
|
|
335
|
-
cap: RawTransactionArgument<string>;
|
|
336
|
-
price: TransactionArgument;
|
|
337
|
-
}
|
|
338
|
-
export interface SetPriceOptions {
|
|
339
|
-
package?: string;
|
|
340
|
-
arguments: SetPriceArguments | [
|
|
341
|
-
self: RawTransactionArgument<string>,
|
|
342
|
-
cap: RawTransactionArgument<string>,
|
|
343
|
-
price: TransactionArgument
|
|
344
|
-
];
|
|
345
|
-
typeArguments: [
|
|
346
|
-
string
|
|
347
|
-
];
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Reprice the listing in place. Safe against in-flight buys by construction: a
|
|
351
|
-
* `Fixed` buyer pays exactly, so a stale payment aborts against the new price, and
|
|
352
|
-
* a `Floor` buyer never pays more than the coin they sent.
|
|
353
|
-
*/
|
|
354
|
-
export function setPrice(options: SetPriceOptions) {
|
|
355
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
356
|
-
const argumentsTypes = [
|
|
357
|
-
null,
|
|
358
|
-
null,
|
|
359
|
-
null
|
|
360
|
-
] satisfies (string | null)[];
|
|
361
|
-
const parameterNames = ["self", "cap", "price"];
|
|
362
|
-
return (tx: Transaction) => tx.moveCall({
|
|
363
|
-
package: packageAddress,
|
|
364
|
-
module: 'listing',
|
|
365
|
-
function: 'set_price',
|
|
366
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
367
|
-
typeArguments: options.typeArguments
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
export interface DeriveIdArguments {
|
|
371
|
-
pressingId: RawTransactionArgument<string>;
|
|
372
|
-
}
|
|
373
|
-
export interface DeriveIdOptions {
|
|
374
|
-
package?: string;
|
|
375
|
-
arguments: DeriveIdArguments | [
|
|
376
|
-
pressingId: RawTransactionArgument<string>
|
|
377
|
-
];
|
|
378
|
-
typeArguments: [
|
|
379
|
-
string
|
|
380
|
-
];
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* The address `Currency`'s listing on `pressing_id` occupies — pure address math,
|
|
384
|
-
* computable before the listing exists.
|
|
385
|
-
*/
|
|
386
|
-
export function deriveId(options: DeriveIdOptions) {
|
|
387
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
388
|
-
const argumentsTypes = [
|
|
389
|
-
'0x2::object::ID'
|
|
390
|
-
] satisfies (string | null)[];
|
|
391
|
-
const parameterNames = ["pressingId"];
|
|
392
|
-
return (tx: Transaction) => tx.moveCall({
|
|
393
|
-
package: packageAddress,
|
|
394
|
-
module: 'listing',
|
|
395
|
-
function: 'derive_id',
|
|
396
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
397
|
-
typeArguments: options.typeArguments
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
export interface HasListingArguments {
|
|
401
|
-
pressing: RawTransactionArgument<string>;
|
|
402
|
-
}
|
|
403
|
-
export interface HasListingOptions {
|
|
404
|
-
package?: string;
|
|
405
|
-
arguments: HasListingArguments | [
|
|
406
|
-
pressing: RawTransactionArgument<string>
|
|
407
|
-
];
|
|
408
|
-
typeArguments: [
|
|
409
|
-
string
|
|
410
|
-
];
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Whether `pressing` has a listing in `Currency` yet. Reads the derived slot
|
|
414
|
-
* directly, so the pressing stores no set of currencies; to enumerate every
|
|
415
|
-
* listing, index `ListingOpenedEvent<Currency>`.
|
|
416
|
-
*/
|
|
417
|
-
export function hasListing(options: HasListingOptions) {
|
|
418
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
419
|
-
const argumentsTypes = [
|
|
420
|
-
null
|
|
421
|
-
] satisfies (string | null)[];
|
|
422
|
-
const parameterNames = ["pressing"];
|
|
423
|
-
return (tx: Transaction) => tx.moveCall({
|
|
424
|
-
package: packageAddress,
|
|
425
|
-
module: 'listing',
|
|
426
|
-
function: 'has_listing',
|
|
427
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
428
|
-
typeArguments: options.typeArguments
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
export interface ReleaseIdArguments {
|
|
432
|
-
self: RawTransactionArgument<string>;
|
|
433
|
-
}
|
|
434
|
-
export interface ReleaseIdOptions {
|
|
435
|
-
package?: string;
|
|
436
|
-
arguments: ReleaseIdArguments | [
|
|
437
|
-
self: RawTransactionArgument<string>
|
|
438
|
-
];
|
|
439
|
-
typeArguments: [
|
|
440
|
-
string
|
|
441
|
-
];
|
|
442
|
-
}
|
|
443
|
-
export function releaseId(options: ReleaseIdOptions) {
|
|
444
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
445
|
-
const argumentsTypes = [
|
|
446
|
-
null
|
|
447
|
-
] satisfies (string | null)[];
|
|
448
|
-
const parameterNames = ["self"];
|
|
449
|
-
return (tx: Transaction) => tx.moveCall({
|
|
450
|
-
package: packageAddress,
|
|
451
|
-
module: 'listing',
|
|
452
|
-
function: 'release_id',
|
|
453
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
454
|
-
typeArguments: options.typeArguments
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
export interface PressingIdArguments {
|
|
458
|
-
self: RawTransactionArgument<string>;
|
|
459
|
-
}
|
|
460
|
-
export interface PressingIdOptions {
|
|
461
|
-
package?: string;
|
|
462
|
-
arguments: PressingIdArguments | [
|
|
463
|
-
self: RawTransactionArgument<string>
|
|
464
|
-
];
|
|
465
|
-
typeArguments: [
|
|
466
|
-
string
|
|
467
|
-
];
|
|
468
|
-
}
|
|
469
|
-
export function pressingId(options: PressingIdOptions) {
|
|
470
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
471
|
-
const argumentsTypes = [
|
|
472
|
-
null
|
|
473
|
-
] satisfies (string | null)[];
|
|
474
|
-
const parameterNames = ["self"];
|
|
475
|
-
return (tx: Transaction) => tx.moveCall({
|
|
476
|
-
package: packageAddress,
|
|
477
|
-
module: 'listing',
|
|
478
|
-
function: 'pressing_id',
|
|
479
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
480
|
-
typeArguments: options.typeArguments
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
export interface PriceArguments {
|
|
484
|
-
self: RawTransactionArgument<string>;
|
|
485
|
-
}
|
|
486
|
-
export interface PriceOptions {
|
|
487
|
-
package?: string;
|
|
488
|
-
arguments: PriceArguments | [
|
|
489
|
-
self: RawTransactionArgument<string>
|
|
490
|
-
];
|
|
491
|
-
typeArguments: [
|
|
492
|
-
string
|
|
493
|
-
];
|
|
494
|
-
}
|
|
495
|
-
export function price(options: PriceOptions) {
|
|
496
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
497
|
-
const argumentsTypes = [
|
|
498
|
-
null
|
|
499
|
-
] satisfies (string | null)[];
|
|
500
|
-
const parameterNames = ["self"];
|
|
501
|
-
return (tx: Transaction) => tx.moveCall({
|
|
502
|
-
package: packageAddress,
|
|
503
|
-
module: 'listing',
|
|
504
|
-
function: 'price',
|
|
505
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
506
|
-
typeArguments: options.typeArguments
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
export interface StateArguments {
|
|
510
|
-
self: RawTransactionArgument<string>;
|
|
511
|
-
}
|
|
512
|
-
export interface StateOptions {
|
|
513
|
-
package?: string;
|
|
514
|
-
arguments: StateArguments | [
|
|
515
|
-
self: RawTransactionArgument<string>
|
|
516
|
-
];
|
|
517
|
-
typeArguments: [
|
|
518
|
-
string
|
|
519
|
-
];
|
|
520
|
-
}
|
|
521
|
-
export function state(options: StateOptions) {
|
|
522
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
523
|
-
const argumentsTypes = [
|
|
524
|
-
null
|
|
525
|
-
] satisfies (string | null)[];
|
|
526
|
-
const parameterNames = ["self"];
|
|
527
|
-
return (tx: Transaction) => tx.moveCall({
|
|
528
|
-
package: packageAddress,
|
|
529
|
-
module: 'listing',
|
|
530
|
-
function: 'state',
|
|
531
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
532
|
-
typeArguments: options.typeArguments
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
export interface IsLiveArguments {
|
|
536
|
-
self: RawTransactionArgument<string>;
|
|
537
|
-
pressing: RawTransactionArgument<string>;
|
|
538
|
-
}
|
|
539
|
-
export interface IsLiveOptions {
|
|
540
|
-
package?: string;
|
|
541
|
-
arguments: IsLiveArguments | [
|
|
542
|
-
self: RawTransactionArgument<string>,
|
|
543
|
-
pressing: RawTransactionArgument<string>
|
|
544
|
-
];
|
|
545
|
-
typeArguments: [
|
|
546
|
-
string
|
|
547
|
-
];
|
|
548
|
-
}
|
|
549
|
-
/**
|
|
550
|
-
* Whether `buy` would be accepted right now: the right pressing, this currency
|
|
551
|
-
* enabled, and the run selling at this moment (open, and past its drop time if it
|
|
552
|
-
* has one).
|
|
553
|
-
*/
|
|
554
|
-
export function isLive(options: IsLiveOptions) {
|
|
555
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
556
|
-
const argumentsTypes = [
|
|
557
|
-
null,
|
|
558
|
-
null,
|
|
559
|
-
'0x2::clock::Clock'
|
|
560
|
-
] satisfies (string | null)[];
|
|
561
|
-
const parameterNames = ["self", "pressing"];
|
|
562
|
-
return (tx: Transaction) => tx.moveCall({
|
|
563
|
-
package: packageAddress,
|
|
564
|
-
module: 'listing',
|
|
565
|
-
function: 'is_live',
|
|
566
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
567
|
-
typeArguments: options.typeArguments
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
export interface AmountArguments {
|
|
571
|
-
self: TransactionArgument;
|
|
572
|
-
}
|
|
573
|
-
export interface AmountOptions {
|
|
574
|
-
package?: string;
|
|
575
|
-
arguments: AmountArguments | [
|
|
576
|
-
self: TransactionArgument
|
|
577
|
-
];
|
|
578
|
-
}
|
|
579
|
-
/** The price amount (the fixed price, or the floor). */
|
|
580
|
-
export function amount(options: AmountOptions) {
|
|
581
|
-
const packageAddress = options.package ?? '@local-pkg/miso_pressing';
|
|
582
|
-
const argumentsTypes = [
|
|
583
|
-
null
|
|
584
|
-
] satisfies (string | null)[];
|
|
585
|
-
const parameterNames = ["self"];
|
|
586
|
-
return (tx: Transaction) => tx.moveCall({
|
|
587
|
-
package: packageAddress,
|
|
588
|
-
module: 'listing',
|
|
589
|
-
function: 'amount',
|
|
590
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
591
|
-
});
|
|
592
|
-
}
|