@misofm/sdk 0.12.0 → 0.12.2

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.
Files changed (47) hide show
  1. package/README.md +11 -32
  2. package/dist/client.d.ts +3 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +5 -0
  5. package/dist/client.js.map +1 -1
  6. package/dist/contracts/party_wallet/party_wallet.d.ts +214 -0
  7. package/dist/contracts/party_wallet/party_wallet.d.ts.map +1 -0
  8. package/dist/contracts/party_wallet/party_wallet.js +214 -0
  9. package/dist/contracts/party_wallet/party_wallet.js.map +1 -0
  10. package/dist/contracts/party_wallet/witness.d.ts +6 -0
  11. package/dist/contracts/party_wallet/witness.d.ts.map +1 -0
  12. package/dist/contracts/party_wallet/witness.js +8 -0
  13. package/dist/contracts/party_wallet/witness.js.map +1 -0
  14. package/dist/contracts/royalty_pool/stake.d.ts +6 -0
  15. package/dist/contracts/royalty_pool/stake.d.ts.map +1 -1
  16. package/dist/contracts/royalty_pool/stake.js +6 -0
  17. package/dist/contracts/royalty_pool/stake.js.map +1 -1
  18. package/dist/contracts/vault/vault.d.ts +2 -1
  19. package/dist/contracts/vault/vault.d.ts.map +1 -1
  20. package/dist/contracts/vault/vault.js +2 -1
  21. package/dist/contracts/vault/vault.js.map +1 -1
  22. package/dist/contracts.d.ts +1 -0
  23. package/dist/contracts.d.ts.map +1 -1
  24. package/dist/contracts.js +1 -0
  25. package/dist/contracts.js.map +1 -1
  26. package/dist/deployments.d.ts +82 -6
  27. package/dist/deployments.d.ts.map +1 -1
  28. package/dist/deployments.js +46 -5
  29. package/dist/deployments.js.map +1 -1
  30. package/dist/read/client.d.ts +2 -3
  31. package/dist/read/client.d.ts.map +1 -1
  32. package/dist/read/client.js +1 -2
  33. package/dist/read/client.js.map +1 -1
  34. package/dist/read/config.d.ts +1 -5
  35. package/dist/read/config.d.ts.map +1 -1
  36. package/dist/read/config.js +29 -11
  37. package/dist/read/config.js.map +1 -1
  38. package/package.json +4 -4
  39. package/src/client.ts +10 -0
  40. package/src/contracts/party_wallet/party_wallet.ts +350 -0
  41. package/src/contracts/party_wallet/witness.ts +7 -0
  42. package/src/contracts/royalty_pool/stake.ts +8 -2
  43. package/src/contracts/vault/vault.ts +2 -1
  44. package/src/contracts.ts +1 -0
  45. package/src/deployments.ts +52 -5
  46. package/src/read/client.ts +2 -3
  47. package/src/read/config.ts +30 -13
@@ -5,16 +5,22 @@
5
5
 
6
6
  /**
7
7
  * A position holding share tokens registered against a `RoyaltyPool`.
8
- *
8
+ *
9
9
  * Stakes are owned objects with an immutable balance — to increase a holder's
10
10
  * total staked amount, mint additional Stake objects rather than modify an
11
11
  * existing one. This mirrors Sui's native staking model.
12
- *
12
+ *
13
13
  * Each stake tracks the royalty pools it is currently registered with via an
14
14
  * inline `VecMap<TypeName, Registration>`, keyed by the pool's `Currency`
15
15
  * `TypeName`. The stake cannot be destroyed while any registrations remain. Pool
16
16
  * registrations are mutated by `royalty_pool::pool` through the package-private
17
17
  * accessors below.
18
+ *
19
+ * Custody warning: `pool::claim_rewards` pays accrued rewards to the _caller_, and
20
+ * `Stake` is `key + store` — a bare shared stake (or one wrapped in a shared
21
+ * object that hands out `&mut`) is drainable by anyone. Stakes must stay
22
+ * address-owned, or wrapped by a contract that pins the reward route (e.g.
23
+ * `routed_stake`); the pool cannot enforce this itself.
18
24
  */
19
25
 
20
26
  import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
@@ -229,7 +229,8 @@ export interface BorrowAsPluginOptions<Witness extends BcsType<any>> {
229
229
  * Temporarily lend the full custodied capability to an authorized plugin.
230
230
  *
231
231
  * `Borrow` has no abilities, so the exact capability must be returned through
232
- * `put_back` in this transaction.
232
+ * `put_back` in this transaction. Aborts if the supplied type is not the exact
233
+ * non-generic `0xpkg::witness::Witness` shape or is not authorized on this Vault.
233
234
  */
234
235
  export function borrowAsPlugin<Witness extends BcsType<any>>(options: BorrowAsPluginOptions<Witness>) {
235
236
  const packageAddress = options.package ?? '@local-pkg/vault';
package/src/contracts.ts CHANGED
@@ -20,6 +20,7 @@ export * as royaltyPoolStake from "./contracts/royalty_pool/stake.ts";
20
20
  export * as vault from "./contracts/vault/vault.ts";
21
21
  export * as compositionRoyaltyPool from "./contracts/composition_royalty_pool/composition_royalty_pool.ts";
22
22
  export * as recordingRoyaltyPool from "./contracts/recording_royalty_pool/recording_royalty_pool.ts";
23
+ export * as partyWallet from "./contracts/party_wallet/party_wallet.ts";
23
24
  export * as routedStake from "./contracts/routed_stake/routed_stake.ts";
24
25
  export * as compositionRoutedStake from "./contracts/composition_routed_stake/composition_routed_stake.ts";
25
26
 
@@ -5,9 +5,14 @@ import type {
5
5
  MisoDeployment,
6
6
  MisoNetwork,
7
7
  } from "@misonetwork/sdk/deployments";
8
+ import { MISO_DEPLOYMENTS } from "@misonetwork/sdk/deployments";
8
9
 
9
10
  /** Complete on-chain identity used by the Miso platform SDK on one network. */
10
11
  export interface MisoPlatformDeployment {
12
+ /** Network name this immutable deployment set belongs to. */
13
+ readonly network: MisoNetwork;
14
+ /** Full ledger genesis digest used to reject a mislabeled RPC endpoint. */
15
+ readonly chainIdentifier: string;
11
16
  /** The complete protocol and Party deployment this platform build targets. */
12
17
  readonly protocol: MisoDeployment;
13
18
  readonly packages: {
@@ -26,6 +31,8 @@ export interface MisoPlatformDeployment {
26
31
  readonly compositionRoyaltyPoolPlugin: string;
27
32
  /** Vault plugin that creates and cranks Recording royalty pools. */
28
33
  readonly recordingRoyaltyPoolPlugin: string;
34
+ /** Vault plugin that manages a Party's royalty-bearing wallet. */
35
+ readonly partyWalletPlugin: string;
29
36
  /** Generic stake wrapper used by the composition routed-stake plugin. */
30
37
  readonly routedStake: string;
31
38
  /** Vault plugin for Composition-owned Recording-share staking. */
@@ -61,12 +68,52 @@ export interface MisoPlatformDeployment {
61
68
  /**
62
69
  * Platform deployments bundled with this SDK release.
63
70
  *
64
- * This release deliberately contains no bundled network deployment. The core
65
- * protocol is being republished as an immutable stack, so every old package ID
66
- * is an incompatible ABI and must not be selected by accident. The admin-cli
67
- * deployment flow injects verified IDs in a follow-up change.
71
+ * IDs come only from the verified output of the Ledger-backed deployment run.
72
+ * Consumers may still pass an explicit complete deployment for custom networks.
68
73
  */
69
- export const MISO_PLATFORM_DEPLOYMENTS = {} as const satisfies Partial<
74
+ export const MISO_PLATFORM_DEPLOYMENTS = {
75
+ testnet: {
76
+ network: "testnet",
77
+ chainIdentifier: "69WiPg3DAQiwdxfncX6wYQ2siKwAe6L9BZthQea3JNMD",
78
+ protocol: MISO_DEPLOYMENTS.testnet,
79
+ packages: {
80
+ pressing: "0x95fba53c968978f75d6ca8a5e6f0f3ba83fdc3af301bc8419be354a3990af5b9",
81
+ record: "0x6150c474200f63bf73072642564886e5ecb1a4c0498ede31acd7908d94dbc83b",
82
+ minato: "0x8466e9864c1d947888e73b0e349b035bc22805579eef18f132966f56c8efe1d2",
83
+ credit: "0x20d8e38f49445cbae45fd66c262c2cbc4bf4cccab487b3fb443a491dc24071cd",
84
+ compositionCredits: "0x8b376967e9c32169727ec5341890f28c66d8577d7bfcecb83aa78aec3e84dce5",
85
+ recordingCredits: "0x7096a47b0ba12063c037d6d417bffade758665a3f313574c8ba218823cfb159a",
86
+ releaseCredits: "0xbe293700ef758c95b69838df6cfa8377b9cad1dd59cbf933974f68b1766d87b5",
87
+ royaltyPool: "0xbeddbcfc2c42ed1bcaa74dc241957621b48241451e10af136c20cdc7df8266b8",
88
+ vault: "0x7075ce4bfc2c738e774c94f1eeb7dc532a5f11ead9b4e3815d90dc16053eae9c",
89
+ compositionRoyaltyPoolPlugin: "0x8d61aecceb597441a0d675b44291706742859c8ff7755b3ed143823daa430c50",
90
+ recordingRoyaltyPoolPlugin: "0x6de70d4e87a328259f00f354227fb329c63fbf50efb87f057c5da26d6908e1d1",
91
+ partyWalletPlugin: "0xccf17215193d1ae64a47480c83df9af2881ffdb75e5ac842ab3898cadd9eeca0",
92
+ routedStake: "0x7a55b1841043efea865d65a6601e057400a79a0aa7bb11e781a25dbe622cbe5f",
93
+ compositionRoutedStakePlugin: "0x54fb4befa1be03f7457abfddcfb9334c20a8df3e01c44aa257f1c3d718cd57ee",
94
+ coverArt: "0x2dae28058b89df93224bacfb9af42fd3ab41f001c2c815fd57fd575024d9a50b",
95
+ releaseCoverArt: "0x649b18f2bb3d94f6a611a8e4ad3a29dcf8b7bba3f684056d60897a8a5e835106",
96
+ genre: "0x978d5f67a4fdc3eb688ed3aeb23c6c3c37ae44e358fb709001e6ab21e6f19f34",
97
+ releaseDescription: "0x3e26e4c4c5b3f51070d6d7bb1527eaa304f34ae5dfde078661e180e7594d6d28",
98
+ releaseDspLink: "0xd9f9e7240c397a82e4af1ecb9ec75b29a91ef4084127eabcf22fbf24e72cab2f",
99
+ releaseGenre: "0xc1012f9768f178ca908ef4a6cfd150ad33baaa3587dc2154ea9852858243cd57",
100
+ releaseKind: "0x3e74c960d9446ae2ebf228456ddc1b099d2090501c9cbcd284a999aa2e774e12",
101
+ releaseRevenueDistributorPlugin: "0x42a22b24129988a5ce8069a1f78eb31d9aa5edf360d729ae3c2c0b8ed18876e1",
102
+ recordingAdvisory: "0x28e0e72c5b892fc888a9007afa59ebe04ed8e47f12632ddb42cd685d09c4af2e",
103
+ recordingLanguage: "0x4b284a9435cf4f48e3785e4485d16be2fcbcef5beaa2b44b6556d9c1028e2c0d",
104
+ recordingMasterReference: "0x2b06ab58f2d5a915b42fc5879d52241fc72e804b3da782fa752b2d2f242170c0",
105
+ recordingPreview: "0x449aafe29707adf249df7e90355ecb19d939ea77d9e19fd3e2fdb220e73e74f0",
106
+ ori: "0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78",
107
+ },
108
+ objects: {
109
+ releaseRegistry: "0xf5941ae9640f6f24b75e921da16c95fd23d776b9e6518c275a50a5ce6337c8ba",
110
+ genreRegistry: "0xad34d6b717b8c59ed9ac47a520feab31324f0c04d70fd31922be45d8209fce1c",
111
+ },
112
+ legacy: {
113
+ releaseCoverArtPackages: [],
114
+ },
115
+ },
116
+ } as const satisfies Partial<
70
117
  Record<MisoNetwork, MisoPlatformDeployment>
71
118
  >;
72
119
 
@@ -51,13 +51,12 @@ export interface MisoClient {
51
51
  export interface CreateMisoClientOptions extends MisoConfigOverrides {
52
52
  /** "testnet" | "mainnet". A bare string (e.g. a Worker's `NETWORK` var) is accepted. */
53
53
  network?: Network | string;
54
- /** Complete verified configuration; required until a deployment is bundled. */
54
+ /** Complete verified configuration for a custom or unbundled deployment. */
55
55
  config?: MisoConfig;
56
56
  }
57
57
 
58
58
  /**
59
- * Build the client from a complete verified configuration. The network-only
60
- * shortcut remains for a future bundled deployment, but currently fails closed.
59
+ * Build the client from a bundled network or a complete verified custom config.
61
60
  */
62
61
  export function createMisoClient(options: CreateMisoClientOptions = {}): MisoClient {
63
62
  const { network, config: providedConfig, ...overrides } = options;
@@ -7,11 +7,12 @@
7
7
  // `lib/money.ts`, `lib/pressing.ts`) lives here instead, so a redeploy is a change
8
8
  // in ONE file that every surface picks up.
9
9
  //
10
- // There are intentionally no baked network IDs while the immutable stack is
11
- // republished. A read client must receive a complete verified configuration from
12
- // its caller; silently retaining the old ABI would be unsafe.
10
+ // Testnet values are derived from the same verified deployment record exported
11
+ // by the platform SDK. Mainnet remains deliberately unavailable until a complete
12
+ // deployment is bundled for it.
13
13
 
14
14
  import type { MisoDeployment } from "@misonetwork/sdk/deployments";
15
+ import { getMisoPlatformDeployment } from "../deployments.ts";
15
16
 
16
17
  export type Network = "testnet" | "mainnet";
17
18
 
@@ -82,17 +83,33 @@ export type MisoConfigOverrides = Partial<
82
83
  Pick<MisoConfig, "grpcUrl" | "graphqlUrl" | "walrusAggregatorUrl" | "apiBaseUrl" | "discoverSales">
83
84
  >;
84
85
 
85
- /**
86
- * Bundled read configuration is disabled until the admin-cli publish flow has
87
- * recorded every new immutable package and singleton object. This is fail-closed
88
- * by design: old testnet types cannot be mistaken for the current ABI.
89
- */
86
+ /** The config for `network`, derived from this SDK's verified deployment map. */
90
87
  export function misoConfig(network: Network, overrides: MisoConfigOverrides = {}): MisoConfig {
91
- void overrides;
92
- throw new Error(
93
- `@misofm/sdk/read: no bundled Miso platform deployment for network "${network}". ` +
94
- "Pass a complete verified MisoConfig to createMisoClient instead.",
95
- );
88
+ const platform = getMisoPlatformDeployment(network);
89
+ const config: MisoConfig = {
90
+ network,
91
+ deployment: platform.protocol,
92
+ protocol: {
93
+ pressing: platform.packages.pressing,
94
+ record: platform.packages.record,
95
+ releaseCoverArt: platform.packages.releaseCoverArt,
96
+ compositionCredits: platform.packages.compositionCredits,
97
+ recordingCredits: platform.packages.recordingCredits,
98
+ releaseCredits: platform.packages.releaseCredits,
99
+ credit: platform.packages.credit,
100
+ },
101
+ money: {
102
+ usdCoinType:
103
+ "0x77774cb7b8cb5622b4ef2658101bf5f1e965418297fe874b683df8f760b6e749::fakeusd::FakeUsd",
104
+ usdDecimals: 6,
105
+ },
106
+ grpcUrl: "https://fullnode.testnet.sui.io",
107
+ graphqlUrl: "https://graphql.testnet.sui.io/graphql",
108
+ walrusAggregatorUrl: "https://aggregator.walrus-testnet.walrus.space",
109
+ apiBaseUrl: "https://api.testnet.miso.fm",
110
+ discoverSales: [],
111
+ };
112
+ return { ...config, ...stripUndefined(overrides) };
96
113
  }
97
114
 
98
115
  /** `{ a: undefined }` must not clobber a real default when spread. */