Skip to content

Commit

Permalink
fix(fast-usdc): fix url encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Nov 14, 2024
1 parent be67cf1 commit 98d08f3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
12 changes: 8 additions & 4 deletions packages/fast-usdc/src/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,19 @@ export const initProgram = (
'--eth-seed <seed>',
'Seed phrase for Ethereum account. CAUTION: Stored unencrypted in file system',
)
.option('--agoric-rpc [url]', 'Agoric RPC endpoint', '127.0.0.1:1317')
.option('--noble-api [url]', 'Noble API endpoint', '127.0.0.1:1318')
.option(
'--agoric-rpc [url]',
'Agoric RPC endpoint',
'http://127.0.0.1:1317',
)
.option('--noble-api [url]', 'Noble API endpoint', 'http://127.0.0.1:1318')
.option(
'--noble-to-agoric-channel [channel]',
'Channel ID on Noble for Agoric',
'channel-21',
)
.option('--noble-rpc [url]', 'Noble RPC endpoint', '127.0.0.1:26657')
.option('--eth-rpc [url]', 'Ethereum RPC Endpoint', '127.0.0.1:8545')
.option('--noble-rpc [url]', 'Noble RPC endpoint', 'http://127.0.0.1:26657')
.option('--eth-rpc [url]', 'Ethereum RPC Endpoint', 'http://127.0.0.1:8545')
.option(
'--token-messenger-address [address]',
'Address of TokenMessenger contract',
Expand Down
2 changes: 1 addition & 1 deletion packages/fast-usdc/src/util/noble.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const queryForwardingAccount = async (
* https://github.com/noble-assets/forwarding/blob/9d7657a/proto/noble/forwarding/v1/query.proto
* v2.0.0 10 Nov 2024
*/
const query = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${agoricAddr}`;
const query = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${encodeURIComponent(agoricAddr)}/`;
out.log(`querying forward address details from noble api: ${query}`);
let forwardingAddressRes;
await null;
Expand Down
8 changes: 4 additions & 4 deletions packages/fast-usdc/test/cli/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ test('calls config init with default args', t => {
t.is(args.shift().path, `${homeDir}config.json`);
t.deepEqual(args, [
{
agoricRpc: '127.0.0.1:1317',
ethRpc: '127.0.0.1:8545',
agoricRpc: 'http://127.0.0.1:1317',
ethRpc: 'http://127.0.0.1:8545',
ethSeed: 'bar',
nobleRpc: '127.0.0.1:26657',
nobleRpc: 'http://127.0.0.1:26657',
nobleSeed: 'foo',
nobleApi: '127.0.0.1:1318',
nobleApi: 'http://127.0.0.1:1318',
nobleToAgoricChannel: 'channel-21',
tokenMessengerAddress: '0xbd3fa81b58ba92a82136038b25adec7066af3155',
tokenContractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
Expand Down
8 changes: 4 additions & 4 deletions packages/fast-usdc/test/cli/snapshots/cli.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ Generated by [AVA](https://avajs.dev).
CAUTION: Stored unencrypted in file␊
system␊
--agoric-rpc [url] Agoric RPC endpoint (default:␊
"127.0.0.1:1317")␊
"http://127.0.0.1:1317")␊
--noble-api [url] Noble API endpoint (default:␊
"127.0.0.1:1318")␊
"http://127.0.0.1:1318")␊
--noble-to-agoric-channel [channel] Channel ID on Noble for Agoric (default:␊
"channel-21")␊
--noble-rpc [url] Noble RPC endpoint (default:␊
"127.0.0.1:26657")␊
"http://127.0.0.1:26657")␊
--eth-rpc [url] Ethereum RPC Endpoint (default:␊
"127.0.0.1:8545")␊
"http://127.0.0.1:8545")␊
--token-messenger-address [address] Address of TokenMessenger contract␊
(default:␊
"0xbd3fa81b58ba92a82136038b25adec7066af3155")␊
Expand Down
Binary file modified packages/fast-usdc/test/cli/snapshots/cli.test.ts.snap
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/fast-usdc/test/cli/transfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test('Transfer registers the noble forwarding account if it does not exist', asy
});
const amount = '150';
const destination = 'dydx1234';
const nobleFwdAccountQuery = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${agoricSettlementAccount}?EUD=${destination}`;
const nobleFwdAccountQuery = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${agoricSettlementAccount}${encodeURIComponent('?EUD=')}${destination}/`;
const fetchMock = makeFetchMock({
[nobleFwdAccountQuery]: {
address: 'noble14lwerrcfzkzrv626w49pkzgna4dtga8c5x479h',
Expand Down Expand Up @@ -122,7 +122,7 @@ test('Transfer signs and broadcasts the depositForBurn message on Ethereum', asy
});
const amount = '150';
const destination = 'dydx1234';
const nobleFwdAccountQuery = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${agoricSettlementAccount}?EUD=${destination}`;
const nobleFwdAccountQuery = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${agoricSettlementAccount}${encodeURIComponent('?EUD=')}${destination}/`;
const fetchMock = makeFetchMock({
[nobleFwdAccountQuery]: {
address: 'noble14lwerrcfzkzrv626w49pkzgna4dtga8c5x479h',
Expand Down

0 comments on commit 98d08f3

Please sign in to comment.