Skip to content
Merged
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
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ NETWORK=canton:localnet
WALLET_PROVIDER_ID=wallet-service
WALLET_PROVIDER_VERSION=0.1.0
WALLET_PROVIDER_URL=http://localhost:3010
WALLET_PROVIDER_USER_URL=http://localhost:3010

# Splice LocalNet app-user participant, as reachable from the host.
CANTON_JSON_API_URL=http://localhost:2975
Expand Down
7 changes: 3 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export interface WalletServiceConfig {
id: string
version: string
url?: string
userUrl?: string
}
canton: CantonEndpoints & CantonCredentials
splice: SpliceEndpoints
Expand Down Expand Up @@ -186,8 +185,9 @@ export const loadConfig = (): WalletServiceConfig => {
(name) => name.startsWith(OAUTH_PREFIX) && optional(name) !== undefined,
)
const { canton, splice } = wantsOAuth ? resolveOAuth(preset) : resolveStatic()
const port = optionalNumber('WALLET_SERVICE_PORT', 3010)
return {
port: optionalNumber('WALLET_SERVICE_PORT', 3010),
port,
corsOrigins: (
optional('WALLET_SERVICE_CORS_ORIGINS') ??
optional('WALLET_SERVICE_CORS_ORIGIN') ??
Expand All @@ -200,8 +200,7 @@ export const loadConfig = (): WalletServiceConfig => {
provider: {
id: optional('WALLET_PROVIDER_ID') ?? 'wallet-service',
version: optional('WALLET_PROVIDER_VERSION') ?? '0.1.0',
url: optional('WALLET_PROVIDER_URL') ?? 'http://localhost:3010',
userUrl: optional('WALLET_PROVIDER_USER_URL') ?? 'http://localhost:3010',
url: optional('WALLET_PROVIDER_URL') ?? `http://localhost:${port}`,
},
canton,
splice,
Expand Down
2 changes: 0 additions & 2 deletions src/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ export const buildProvider = (p: WalletServiceConfig['provider']): Provider => (
version: p.version,
providerType: 'remote',
...(p.url === undefined ? {} : { url: p.url }),
...(p.userUrl === undefined ? {} : { userUrl: p.userUrl }),
})

const firstParty = (params: { partyId?: string; actAs?: string[] }): string => {
Expand Down Expand Up @@ -616,7 +615,6 @@ export const createRpc = (config: WalletServiceConfig, deps: RpcDependencies = {
reason: 'No wallet session/account implementation yet.',
isNetworkConnected: networkStatus.connected,
...(networkStatus.reason === undefined ? {} : { networkReason: networkStatus.reason }),
...(config.provider.userUrl === undefined ? {} : { userUrl: config.provider.userUrl }),
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ export type Provider = {
version?: string
providerType?: 'browser' | 'desktop' | 'mobile' | 'remote'
url?: string
userUrl?: string
}

export type ConnectResult = {
isConnected: boolean
reason?: string
isNetworkConnected: boolean
networkReason?: string
userUrl?: string
}

export type Session = {
Expand Down
1 change: 0 additions & 1 deletion test/rpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const baseConfig = () => ({
id: 'wallet-service',
version: '0.1.0',
url: 'http://localhost:3010',
userUrl: 'http://localhost:3010',
},
// Credentials are a union, so there is no credential-less config to build: every
// config loadConfig can produce carries either a static token or OAuth.
Expand Down