Skip to content

Commit d46cefd

Browse files
committed
fix(fast-usdc): fix url encoding
1 parent 52033cf commit d46cefd

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

packages/fast-usdc/src/cli/cli.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,19 @@ export const initProgram = (
6969
'--eth-seed <seed>',
7070
'Seed phrase for Ethereum account. CAUTION: Stored unencrypted in file system',
7171
)
72-
.option('--agoric-rpc [url]', 'Agoric RPC endpoint', '127.0.0.1:1317')
73-
.option('--noble-api [url]', 'Noble API endpoint', '127.0.0.1:1318')
72+
.option(
73+
'--agoric-rpc [url]',
74+
'Agoric RPC endpoint',
75+
'http://127.0.0.1:1317',
76+
)
77+
.option('--noble-api [url]', 'Noble API endpoint', 'http://127.0.0.1:1318')
7478
.option(
7579
'--noble-to-agoric-channel [channel]',
7680
'Channel ID on Noble for Agoric',
7781
'channel-21',
7882
)
79-
.option('--noble-rpc [url]', 'Noble RPC endpoint', '127.0.0.1:26657')
80-
.option('--eth-rpc [url]', 'Ethereum RPC Endpoint', '127.0.0.1:8545')
83+
.option('--noble-rpc [url]', 'Noble RPC endpoint', 'http://127.0.0.1:26657')
84+
.option('--eth-rpc [url]', 'Ethereum RPC Endpoint', 'http://127.0.0.1:8545')
8185
.option(
8286
'--token-messenger-address [address]',
8387
'Address of TokenMessenger contract',

packages/fast-usdc/src/util/noble.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const queryForwardingAccount = async (
9191
* https://github.com/noble-assets/forwarding/blob/9d7657a/proto/noble/forwarding/v1/query.proto
9292
* v2.0.0 10 Nov 2024
9393
*/
94-
const query = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${agoricAddr}`;
94+
const query = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${encodeURIComponent(agoricAddr)}/`;
9595
out.log(`querying forward address details from noble api: ${query}`);
9696
let forwardingAddressRes;
9797
await null;

packages/fast-usdc/test/cli/cli.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ test('calls config init with default args', t => {
145145
t.is(args.shift().path, `${homeDir}config.json`);
146146
t.deepEqual(args, [
147147
{
148-
agoricRpc: '127.0.0.1:1317',
149-
ethRpc: '127.0.0.1:8545',
148+
agoricRpc: 'http://127.0.0.1:1317',
149+
ethRpc: 'http://127.0.0.1:8545',
150150
ethSeed: 'bar',
151-
nobleRpc: '127.0.0.1:26657',
151+
nobleRpc: 'http://127.0.0.1:26657',
152152
nobleSeed: 'foo',
153-
nobleApi: '127.0.0.1:1318',
153+
nobleApi: 'http://127.0.0.1:1318',
154154
nobleToAgoricChannel: 'channel-21',
155155
tokenMessengerAddress: '0xbd3fa81b58ba92a82136038b25adec7066af3155',
156156
tokenContractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',

packages/fast-usdc/test/cli/snapshots/cli.test.ts.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ Generated by [AVA](https://avajs.dev).
7676
CAUTION: Stored unencrypted in file␊
7777
system␊
7878
--agoric-rpc [url] Agoric RPC endpoint (default:␊
79-
"127.0.0.1:1317")␊
79+
"http://127.0.0.1:1317")␊
8080
--noble-api [url] Noble API endpoint (default:␊
81-
"127.0.0.1:1318")␊
81+
"http://127.0.0.1:1318")␊
8282
--noble-to-agoric-channel [channel] Channel ID on Noble for Agoric (default:␊
8383
"channel-21")␊
8484
--noble-rpc [url] Noble RPC endpoint (default:␊
85-
"127.0.0.1:26657")␊
85+
"http://127.0.0.1:26657")␊
8686
--eth-rpc [url] Ethereum RPC Endpoint (default:␊
87-
"127.0.0.1:8545")␊
87+
"http://127.0.0.1:8545")␊
8888
--token-messenger-address [address] Address of TokenMessenger contract␊
8989
(default:␊
9090
"0xbd3fa81b58ba92a82136038b25adec7066af3155")␊
Binary file not shown.

packages/fast-usdc/test/cli/transfer.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ test('Transfer registers the noble forwarding account if it does not exist', asy
7171
});
7272
const amount = '150';
7373
const destination = 'dydx1234';
74-
const nobleFwdAccountQuery = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${agoricSettlementAccount}?EUD=${destination}`;
74+
const nobleFwdAccountQuery = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${agoricSettlementAccount}${encodeURIComponent('?EUD=')}${destination}/`;
7575
const fetchMock = makeFetchMock({
7676
[nobleFwdAccountQuery]: {
7777
address: 'noble14lwerrcfzkzrv626w49pkzgna4dtga8c5x479h',
@@ -122,7 +122,7 @@ test('Transfer signs and broadcasts the depositForBurn message on Ethereum', asy
122122
});
123123
const amount = '150';
124124
const destination = 'dydx1234';
125-
const nobleFwdAccountQuery = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${agoricSettlementAccount}?EUD=${destination}`;
125+
const nobleFwdAccountQuery = `${nobleApi}/noble/forwarding/v1/address/${nobleToAgoricChannel}/${agoricSettlementAccount}${encodeURIComponent('?EUD=')}${destination}/`;
126126
const fetchMock = makeFetchMock({
127127
[nobleFwdAccountQuery]: {
128128
address: 'noble14lwerrcfzkzrv626w49pkzgna4dtga8c5x479h',

0 commit comments

Comments
 (0)