Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/ts-compat/src/app-signing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Address, Hex, concatHex, encodeAbiParameters, keccak256 } from 'viem';

import { RPCAppStateIntent } from './types';
import { RPCAppStateIntent } from './types.js';

const WALLET_QUORUM_PREFIX = '0xa1' as Hex;
const SESSION_KEY_QUORUM_PREFIX = '0xa2' as Hex;
Expand Down
6 changes: 3 additions & 3 deletions sdk/ts-compat/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* auth_request / auth_verify flow over WebSocket.
*/

import { NitroliteRPC } from './rpc';
import { RPCMethod, EIP712AuthTypes } from './types';
import type { MessageSigner, MessageSignerPayload } from './types';
import { NitroliteRPC } from './rpc.js';
import { RPCMethod, EIP712AuthTypes } from './types.js';
import type { MessageSigner, MessageSignerPayload } from './types.js';

export interface AuthRequestParams {
address: string;
Expand Down
10 changes: 5 additions & 5 deletions sdk/ts-compat/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
ChannelSessionKeyStateV1,
} from '@yellow-org/sdk';
import type * as core from '@yellow-org/sdk';
import Decimal from 'decimal.js';
import { Decimal } from 'decimal.js';
import { Address, Hex, WalletClient, createPublicClient, http, formatUnits, parseUnits } from 'viem';

import type {
Expand All @@ -36,17 +36,17 @@ import type {
GetAppDefinitionResponseParams,
CreateAppSessionRequestParams,
CloseAppSessionRequestParams,
} from './types';
import { RPCAppStateIntent } from './types';
} from './types.js';
import { RPCAppStateIntent } from './types.js';

import { buildClientOptions, type CompatClientConfig } from './config';
import { buildClientOptions, type CompatClientConfig } from './config.js';
import {
AllowanceError,
InsufficientFundsError,
NotInitializedError,
OngoingStateTransitionError,
UserRejectedError,
} from './errors';
} from './errors.js';

// ---------------------------------------------------------------------------
// WalletClient-based signers for browser (MetaMask) environments
Expand Down
4 changes: 2 additions & 2 deletions sdk/ts-compat/src/events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { NitroliteClient } from './client';
import type { LedgerChannel, LedgerBalance, ClearNodeAsset } from './types';
import type { NitroliteClient } from './client.js';
import type { LedgerChannel, LedgerBalance, ClearNodeAsset } from './types.js';

export interface EventPollerCallbacks {
onChannelUpdate?: (channels: LedgerChannel[]) => void;
Expand Down
20 changes: 10 additions & 10 deletions sdk/ts-compat/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
// =============================================================================

// --- Client facade ---
export { NitroliteClient, type NitroliteClientConfig } from './client';
export { NitroliteClient, type NitroliteClientConfig } from './client.js';

// --- Signers ---
export { WalletStateSigner, createECDSAMessageSigner } from './signers';
export { WalletStateSigner, createECDSAMessageSigner } from './signers.js';

// --- Auth helpers ---
export {
Expand All @@ -18,7 +18,7 @@ export {
createAuthVerifyMessageWithJWT,
createEIP712AuthMessageSigner,
type AuthRequestParams,
} from './auth';
} from './auth.js';

// --- App session signing helpers ---
export {
Expand All @@ -30,7 +30,7 @@ export {
type CreateAppSessionHashParams,
type SubmitAppStateHashAllocation,
type SubmitAppStateHashParams,
} from './app-signing';
} from './app-signing.js';

// --- RPC helpers ---
export {
Expand Down Expand Up @@ -61,7 +61,7 @@ export {
createPingMessage,
convertRPCToClientChannel,
convertRPCToClientState,
} from './rpc';
} from './rpc.js';

// --- Types ---
export {
Expand Down Expand Up @@ -104,7 +104,7 @@ export {
type AuthChallengeResponse,
type TransferNotificationResponseParams,
type LedgerAccountType,
} from './types';
} from './types.js';

// --- Clearnode response types (used by consuming apps' stores) ---
export type {
Expand All @@ -114,7 +114,7 @@ export type {
LedgerEntry,
AppSession,
ClearNodeAsset,
} from './types';
} from './types.js';

// --- Errors ---
export {
Expand All @@ -125,13 +125,13 @@ export {
NotInitializedError,
OngoingStateTransitionError,
getUserFacingMessage,
} from './errors';
} from './errors.js';

// --- Events ---
export { EventPoller, type EventPollerCallbacks } from './events';
export { EventPoller, type EventPollerCallbacks } from './events.js';

// --- Config ---
export { buildClientOptions, blockchainRPCsFromEnv, type CompatClientConfig } from './config';
export { buildClientOptions, blockchainRPCsFromEnv, type CompatClientConfig } from './config.js';

// NOTE: SDK classes (Client, ChannelDefaultSigner, etc.) are intentionally NOT
// re-exported here. Barrel re-exports from '@yellow-org/sdk' trigger eager
Expand Down
2 changes: 1 addition & 1 deletion sdk/ts-compat/src/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* lightweight placeholders while parse* helpers normalize response shapes.
*/

import type { MessageSigner, RPCResponse, NitroliteRPCMessage } from './types';
import type { MessageSigner, RPCResponse, NitroliteRPCMessage } from './types.js';

// ---------------------------------------------------------------------------
// parseAnyRPCResponse -- pass-through
Expand Down
2 changes: 1 addition & 1 deletion sdk/ts-compat/src/signers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Hex } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import type { MessageSigner, MessageSignerPayload } from './types';
import type { MessageSigner, MessageSignerPayload } from './types.js';

/**
* v0.5.3-compatible WalletStateSigner.
Expand Down
4 changes: 2 additions & 2 deletions sdk/ts-compat/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es2020",
"module": "ESNext",
"module": "Node16",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
Expand All @@ -11,7 +11,7 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"moduleResolution": "bundler",
"moduleResolution": "Node16",
"isolatedModules": true,
"types": ["node"]
},
Expand Down
4 changes: 2 additions & 2 deletions sdk/ts/src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* This module contains types and functions for managing application sessions
*/

export * from './types';
export * from './packing';
export * from './types.js';
export * from './packing.js';
4 changes: 2 additions & 2 deletions sdk/ts/src/app/packing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
AppStateUpdateV1,
AppSessionKeyStateV1,
AppSessionVersionV1,
} from './types';
import { AppV1 } from '../rpc/types';
} from './types.js';
import { AppV1 } from '../rpc/types.js';

/**
* PackCreateAppSessionRequestV1 packs the Definition and SessionData for signing using ABI encoding.
Expand Down
2 changes: 1 addition & 1 deletion sdk/ts/src/app/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address } from 'viem';
import Decimal from 'decimal.js';
import { Decimal } from 'decimal.js';

// ============================================================================
// Enums
Expand Down
2 changes: 1 addition & 1 deletion sdk/ts/src/asset_store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { Address } from 'viem';
import * as core from './core/types';
import * as core from './core/types.js';

/**
* ClientAssetStore implements asset caching by fetching data from the Nitrolite API.
Expand Down
14 changes: 7 additions & 7 deletions sdk/ts/src/blockchain/evm/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
*/

import { Address, Hex, hexToBytes, zeroAddress } from 'viem';
import Decimal from 'decimal.js';
import * as core from '../../core/types';
import { decimalToBigInt } from '../../core/utils';
import { AssetStore, EVMClient, WalletSigner } from './interface';
import { ChannelHubAbi } from './channel_hub_abi';
import { Decimal } from 'decimal.js';
import * as core from '../../core/types.js';
import { decimalToBigInt } from '../../core/utils.js';
import { AssetStore, EVMClient, WalletSigner } from './interface.js';
import { ChannelHubAbi } from './channel_hub_abi.js';
import {
coreDefToContractDef,
coreStateToContractState,
contractStateToCoreState,
} from './utils';
import { newERC20 } from './erc20';
} from './utils.js';
import { newERC20 } from './erc20.js';

/**
* ClientOptions for configuring the blockchain client
Expand Down
4 changes: 2 additions & 2 deletions sdk/ts/src/blockchain/evm/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/

import { Address } from 'viem';
import { Erc20Abi } from './erc20_abi';
import { EVMClient, WalletSigner } from './interface';
import { Erc20Abi } from './erc20_abi.js';
import { EVMClient, WalletSigner } from './interface.js';

/**
* ERC20 contract wrapper for token interactions
Expand Down
16 changes: 8 additions & 8 deletions sdk/ts/src/blockchain/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* EVM blockchain implementation exports
*/

export * from './interface';
export * from './types';
export * from './utils';
export * from './erc20';
export * from './channel_hub_abi';
export * from './client';
export * from './app_registry_abi';
export * from './locking_client';
export * from './interface.js';
export * from './types.js';
export * from './utils.js';
export * from './erc20.js';
export * from './channel_hub_abi.js';
export * from './client.js';
export * from './app_registry_abi.js';
export * from './locking_client.js';
10 changes: 5 additions & 5 deletions sdk/ts/src/blockchain/evm/locking_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
*/

import { Address } from 'viem';
import Decimal from 'decimal.js';
import { decimalToBigInt } from '../../core/utils';
import { EVMClient, WalletSigner } from './interface';
import { AppRegistryAbi } from './app_registry_abi';
import { Erc20Abi } from './erc20_abi';
import { Decimal } from 'decimal.js';
import { decimalToBigInt } from '../../core/utils.js';
import { EVMClient, WalletSigner } from './interface.js';
import { AppRegistryAbi } from './app_registry_abi.js';
import { Erc20Abi } from './erc20_abi.js';

/**
* LockingClient provides methods to interact with the Locking (NonSlashableAppRegistry) contract.
Expand Down
8 changes: 4 additions & 4 deletions sdk/ts/src/blockchain/evm/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*/

import { Address, Hex, hexToBytes } from 'viem';
import Decimal from 'decimal.js';
import * as core from '../../core/types';
import { decimalToBigInt, generateChannelMetadata, getStateTransitionHash } from '../../core/utils';
import { ChannelDefinition, Ledger, State } from './types';
import { Decimal } from 'decimal.js';
import * as core from '../../core/types.js';
import { decimalToBigInt, generateChannelMetadata, getStateTransitionHash } from '../../core/utils.js';
import { ChannelDefinition, Ledger, State } from './types.js';

/**
* hexToBytes32 converts a hex string to a 32-byte array
Expand Down
2 changes: 1 addition & 1 deletion sdk/ts/src/blockchain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
* Blockchain implementations
*/

export * as evm from './evm';
export * as evm from './evm/index.js';
30 changes: 15 additions & 15 deletions sdk/ts/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
*/

import { Address, Hex, createPublicClient, createWalletClient, http, custom, verifyMessage } from 'viem';
import Decimal from 'decimal.js';
import * as core from './core';
import * as app from './app';
import * as API from './rpc/api';
import { StateV1, ChannelDefinitionV1, ChannelSessionKeyStateV1, AppV1, AppInfoV1 } from './rpc/types';
import { RPCClient } from './rpc/client';
import { WebsocketDialer } from './rpc/dialer';
import { ClientAssetStore } from './asset_store';
import { Config, DefaultConfig, Option } from './config';
import { Decimal } from 'decimal.js';
import * as core from './core/index.js';
import * as app from './app/index.js';
import * as API from './rpc/api.js';
import { StateV1, ChannelDefinitionV1, ChannelSessionKeyStateV1, AppV1, AppInfoV1 } from './rpc/types.js';
import { RPCClient } from './rpc/client.js';
import { WebsocketDialer } from './rpc/dialer.js';
import { ClientAssetStore } from './asset_store.js';
import { Config, DefaultConfig, Option } from './config.js';
import {
generateNonce,
transformNodeConfig,
Expand All @@ -30,12 +30,12 @@ import {
transformAppSessionInfo,
transformAppDefinitionFromRPC,
transformActionAllowance,
} from './utils';
import * as blockchain from './blockchain';
import { nextState, applyChannelCreation, applyAcknowledgementTransition, applyHomeDepositTransition, applyHomeWithdrawalTransition, applyTransferSendTransition, applyFinalizeTransition, applyCommitTransition } from './core/state';
import { newVoidState } from './core/types';
import { packState, packChallengeState } from './core/state_packer';
import { StateSigner, TransactionSigner } from './signers';
} from './utils.js';
import * as blockchain from './blockchain/index.js';
import { nextState, applyChannelCreation, applyAcknowledgementTransition, applyHomeDepositTransition, applyHomeWithdrawalTransition, applyTransferSendTransition, applyFinalizeTransition, applyCommitTransition } from './core/state.js';
import { newVoidState } from './core/types.js';
import { packState, packChallengeState } from './core/state_packer.js';
import { StateSigner, TransactionSigner } from './signers.js';

/**
* Default challenge period for channels (1 day in seconds)
Expand Down
12 changes: 6 additions & 6 deletions sdk/ts/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
// and on-chain encoding.

// Export all types
export * from './types';
export * from './types.js';

// Export all interfaces
export * from './interface';
export * from './interface.js';

// Export all event types
export * from './event';
export * from './event.js';

// Export all utility functions
export * from './utils';
export * from './utils.js';

// Export all state methods and transitions
export * from './state';
export * from './state.js';

// Export state packer
export * from './state_packer';
export * from './state_packer.js';
6 changes: 3 additions & 3 deletions sdk/ts/src/core/interface.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Address, Hex } from 'viem';
import Decimal from 'decimal.js';
import { Decimal } from 'decimal.js';
import {
State,
ChannelDefinition,
HomeChannelDataResponse,
EscrowDepositDataResponse,
EscrowWithdrawalDataResponse,
} from './types';
} from './types.js';
import {
HomeChannelCreatedEvent,
HomeChannelMigratedEvent,
Expand All @@ -19,7 +19,7 @@ import {
EscrowWithdrawalInitiatedEvent,
EscrowWithdrawalChallengedEvent,
EscrowWithdrawalFinalizedEvent,
} from './event';
} from './event.js';

// ============================================================================
// Listener Interface
Expand Down
Loading
Loading