Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jribbink committed Nov 27, 2024
1 parent 547a649 commit 6aa7318
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/sdk/src/transport/get-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {invariant} from "@onflow/util-invariant"

/**
* Get the SDK transport object, either from the provided override or from the global config.
* @param overrides
* @returns
* @param overrides - Override default configuration with custom transport or send function.
* @returns The SDK transport object.
*/
export async function getTransport(override: {
send?: SdkTransport.SendFn
Expand All @@ -24,11 +24,8 @@ export async function getTransport(override: {
override.transport || override.send || defaultTransport
)

if (isTransportObject(transportOrSend)) {
// This is a transport object, return it directly
return transportOrSend
} else {
// This is a legacy send function, wrap it in a transport object
// Backwards compatibility with legacy send function
if (!isTransportObject(transportOrSend)) {
return {
send: transportOrSend,
subscribe: () => {
Expand All @@ -38,6 +35,8 @@ export async function getTransport(override: {
},
}
}

return transportOrSend
}

function isTransportObject(
Expand Down

0 comments on commit 6aa7318

Please sign in to comment.