@nibgate/sdk 0.2.11 → 0.2.13

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": "@nibgate/sdk",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "Framework-agnostic browser and server package for creator-owned gated content, unlock events, and receipts.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -1,4 +1,3 @@
1
- import { BatchEvmScheme } from './schemes/batch-scheme.js';
2
1
  import { stringifyJson } from './json.js';
3
2
 
4
3
  function encodeBase64(value) {
@@ -18,6 +17,14 @@ export async function createCircleGatewayBrowserAdapter(options = {}) {
18
17
  throw new Error('Circle Gateway browser adapter requires an EVM signer with address and signTypedData.');
19
18
  }
20
19
 
20
+ let BatchEvmScheme;
21
+ try {
22
+ const circle = await import('@circle-fin/x402-batching/client');
23
+ BatchEvmScheme = circle.BatchEvmScheme;
24
+ } catch {
25
+ const local = await import('./schemes/batch-scheme.js');
26
+ BatchEvmScheme = local.BatchEvmScheme;
27
+ }
21
28
  const scheme = options.clientModule?.BatchEvmScheme
22
29
  ? new options.clientModule.BatchEvmScheme(signer)
23
30
  : new BatchEvmScheme(signer);
package/src/index.d.ts CHANGED
@@ -453,3 +453,6 @@ export declare function mountRatingUI(resource: NibgateResource | string, option
453
453
 
454
454
  export declare function createTransferCheckout(resource: NibgateResource | string, options: NibgateTransferCheckoutOptions): NibgateTransferCheckout;
455
455
  export declare function payWithTransfer(resource: NibgateResource | string, options: NibgateTransferCheckoutOptions & NibgateAccessCheckOptions): Promise<NibgateAccessCheckResult>;
456
+ export declare function renderDefaultUnlockUI(container: HTMLElement | string, resource: NibgateResource, options?: NibgateEvmGatewayUnlockOptions): NibgateEvmGatewayUnlockController & { element: HTMLElement; destroy: () => void };
457
+ export declare function renderDefaultRatingUI(container: HTMLElement | string, resource: NibgateResource, options?: Record<string, unknown>): { element: HTMLElement; destroy: () => void };
458
+ export declare function renderDefaultGatewayWalletUI(container: HTMLElement | string, options?: Record<string, unknown>): { element: HTMLElement; destroy: () => void; switchTab: (tab: string) => void };
@@ -5,7 +5,7 @@ export { createPaymentChallenge } from './challenge.js';
5
5
  export { createManifest, manifestResponse } from './manifest.js';
6
6
  export { createUnlockToken, verifyUnlockToken } from './proof.js';
7
7
  export { emitHubEvent } from './hub.js';
8
- export { payWithGateway, createGatewayBuyer, getGatewayBalances, depositToGateway, withdrawFromGateway } from './gateway.js';
8
+ export { payWithGateway, createGatewayBuyer, getGatewayBalances, depositToGateway, withdrawFromGateway, runCircleGatewayRequirement } from './gateway.js';
9
9
  export { createNibgateServer, protect, verifyPayment } from './access.js';
10
10
  export { circleGatewayOptions, createCircleGatewayServer } from './presets.js';
11
11
  export { normalizeServerResource as normalizeResource, normalizeAccessPolicy, normalizeUnlockPolicy, validateResourceMetadata, UNLOCK_MODES } from '../core/resource.js';