@meddleware/nft-gate-client 0.0.1 → 0.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meddleware/nft-gate-client",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "description": "Client-side helpers for the access_gate NFT access primitive: ownership queries, purchase/consume PTB builders, challenge signing, and access-proof assembly.",
6
6
  "author": "MeddleWare <meddleware@proton.me>",
package/src/proof.ts CHANGED
@@ -9,14 +9,11 @@ export function personalMessageForNonce(nonce: string): Uint8Array {
9
9
  }
10
10
 
11
11
  function toBase64(s: string): string {
12
- // Works in browsers and modern Node (globalThis.btoa is available on Node >= 16).
13
- if (typeof btoa === 'function') return btoa(s)
14
- return Buffer.from(s, 'utf-8').toString('base64')
12
+ return btoa(s)
15
13
  }
16
14
 
17
15
  function fromBase64(s: string): string {
18
- if (typeof atob === 'function') return atob(s)
19
- return Buffer.from(s, 'base64').toString('utf-8')
16
+ return atob(s)
20
17
  }
21
18
 
22
19
  /** Encode a proof as the compact Bearer token carried in the relay auth header. */
package/src/ptb.ts CHANGED
@@ -11,7 +11,7 @@ export function buildPurchaseTx(cfg: AccessGateConfig, priceMist: bigint | numbe
11
11
  const [payment] = tx.splitCoins(tx.gas, [tx.pure.u64(priceMist)])
12
12
  tx.moveCall({
13
13
  target: `${cfg.packageId}::access_gate::purchase`,
14
- arguments: [tx.object(cfg.gateId), payment],
14
+ arguments: [tx.object(cfg.gateId), tx.object(cfg.platformConfigId), payment],
15
15
  })
16
16
  return tx
17
17
  }
@@ -48,6 +48,9 @@ export function buildCreateGateTx(
48
48
  defaultUses: bigint | number
49
49
  soulbound: boolean
50
50
  autoBurnAtZero: boolean
51
+ nftName: string
52
+ nftImageUrl: string
53
+ nftDescription: string
51
54
  },
52
55
  ): Transaction {
53
56
  const tx = new Transaction()
@@ -59,6 +62,9 @@ export function buildCreateGateTx(
59
62
  tx.pure.u64(opts.defaultUses),
60
63
  tx.pure.bool(opts.soulbound),
61
64
  tx.pure.bool(opts.autoBurnAtZero),
65
+ tx.pure.string(opts.nftName),
66
+ tx.pure.string(opts.nftImageUrl),
67
+ tx.pure.string(opts.nftDescription),
62
68
  ],
63
69
  })
64
70
  return tx
package/src/types.ts CHANGED
@@ -11,6 +11,8 @@ export interface AccessGateConfig {
11
11
  packageId: string
12
12
  /** The shared `Gate` object ID. */
13
13
  gateId: string
14
+ /** The shared `PlatformConfig` object ID. Required for `buildPurchaseTx`. */
15
+ platformConfigId: string
14
16
  /**
15
17
  * Fully-qualified NFT type string to filter ownership by, e.g.
16
18
  * `<pkg>::access_gate::AccessNFT` or `<pkg>::access_gate::SoulboundAccessNFT`.