-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Pano Skylakis <[email protected]> Co-authored-by: Mikhala <[email protected]> Co-authored-by: Zach Couchman <[email protected]> Co-authored-by: Zach Couchman <[email protected]> Co-authored-by: Mikhala <[email protected]> Co-authored-by: Sharon Sheah <[email protected]> Co-authored-by: Ermyas Abebe <[email protected]> Co-authored-by: Charlie McKenzie <[email protected]>
- Loading branch information
1 parent
a52a5ea
commit 10a79bb
Showing
7 changed files
with
307 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
packages/internal/bridge/bridge-sample-app/src/flowRateInfo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* eslint-disable no-console */ | ||
import 'dotenv/config'; | ||
import util from 'util'; | ||
|
||
import { ImmutableConfiguration, Environment } from '@imtbl/config'; | ||
|
||
import { | ||
TokenBridge, | ||
BridgeConfiguration, | ||
FlowRateInfoRequest, | ||
FlowRateInfoResponse, | ||
} from '@imtbl/bridge-sdk'; | ||
|
||
// @ts-ignore | ||
import { setupForBridge } from './lib/utils.ts'; | ||
|
||
async function getFlowRateInfo() { | ||
|
||
const params = await setupForBridge(); | ||
|
||
if (!process.env.FLOW_RATE_INFO_TOKEN) { | ||
throw new Error('FLOW_RATE_INFO_TOKEN not set'); | ||
} | ||
|
||
const bridgeConfig = new BridgeConfiguration({ | ||
baseConfig: new ImmutableConfiguration({ | ||
environment: Environment.SANDBOX, | ||
}), | ||
bridgeInstance: params.bridgeInstance, | ||
rootProvider: params.rootProvider, | ||
childProvider: params.childProvider, | ||
}); | ||
|
||
const tokenBridge = new TokenBridge(bridgeConfig); | ||
|
||
const flowRateInfoReq: FlowRateInfoRequest = { | ||
tokens: ['NATIVE', process.env.FLOW_RATE_INFO_TOKEN], | ||
} | ||
|
||
console.log('flowRateInfoReq', flowRateInfoReq) | ||
|
||
try { | ||
const flowRateInfoRes: FlowRateInfoResponse = await tokenBridge.getFlowRateInfo(flowRateInfoReq); | ||
console.log('flowRateInfoRes'); | ||
console.log(util.inspect(flowRateInfoRes, {showHidden: false, depth: null, colors: true})); | ||
|
||
} catch(err) { | ||
console.error('flowRateInfoErr', err); | ||
throw(err); | ||
} | ||
|
||
} | ||
|
||
(async () => { | ||
try { | ||
await getFlowRateInfo() | ||
console.log('Exiting successfully'); | ||
} catch(err) { | ||
console.error('Exiting with error', err) | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.