Skip to content

Commit

Permalink
chore: update tests in ts wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow committed Mar 29, 2024
1 parent 3e55135 commit 76bcd35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 34 deletions.
5 changes: 1 addition & 4 deletions wrappers/fedimint-ts/FedimintClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ import type {
DiscoverVersionRequest,
DiscoverVersionResponse,
JoinRequest,
LnInvoiceExternalPubkeyRequest,
LnInvoiceExternalPubkeyResponse,
LnInvoiceExternalPubkeyTweakedRequest,
LnInvoiceExternalPubkeyTweakedResponse,
LnClaimPubkeyReceiveRequest,
LnClaimPubkeyReceiveTweakedRequest,
LnAwaitInvoiceRequest,
Gateway,
Expand Down Expand Up @@ -468,7 +465,7 @@ class FedimintClient {
* @param tweaks - The tweaks of the pubkey to claim
* @param federationId - The ID of the federation to claim the contracts in. Contracts are on specific federations so this is required.
*/
claimPubkeyTweakReceive: async (
claimPubkeyTweakReceives: async (
privateKey: string,
tweaks: number[],
federationId: string
Expand Down
41 changes: 11 additions & 30 deletions wrappers/fedimint-ts/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ async function main() {
// LIGHTNING METHODS
// `/v2/ln/list-gateways`
logMethod("/v2/ln/list-gateways");
data = await fedimintClient.ln.listGateways();
data = await fedimintClient.lightning.listGateways();
logInputAndOutput({}, data);
// `/v2/ln/invoice`
logMethod("/v2/ln/invoice");
let { operationId, invoice } = await fedimintClient.ln.createInvoice(
let { operationId, invoice } = await fedimintClient.lightning.createInvoice(
10000,
"test"
);
Expand All @@ -108,36 +108,15 @@ async function main() {
);
// `/v2/ln/pay`
logMethod("/v2/ln/pay");
let payResponse = await fedimintClient.ln.pay(invoice);
let payResponse = await fedimintClient.lightning.pay(invoice);
logInputAndOutput({ paymentInfo: invoice }, payResponse);
// `/v2/ln/await-invoice`
logMethod("/v2/ln/await-invoice");
data = await fedimintClient.ln.awaitInvoice(operationId);
data = await fedimintClient.lightning.awaitInvoice(operationId);
logInputAndOutput({ operationId }, data);
// `/v1/ln/invoice-external-pubkey`
logMethod("/v1/ln/invoice-external-pubkey");
data = await fedimintClient.ln.createInvoiceForPubkey(
keyPair.publicKey,
1000,
"test"
);
logInputAndOutput(
{
externalPubkey: keyPair.publicKey,
amountMsat: 10000,
description: "test",
},
data
);
// pay the invoice
payResponse = await fedimintClient.ln.pay(data.invoice);
// `/v1/ln/claim-external-pubkey`
logMethod("/v1/ln/claim-external-pubkey");
data = await fedimintClient.ln.claimPubkeyReceive(keyPair.privateKey);
logInputAndOutput({ privateKey: keyPair.privateKey }, data);
// `/v1/ln/invoice-external-pubkey-tweaked`
logMethod("/v1/ln/invoice-external-pubkey-tweaked");
data = await fedimintClient.ln.createInvoiceForPubkeyTweak(
data = await fedimintClient.lightning.createInvoiceForPubkeyTweak(
keyPair.publicKey,
1,
1000,
Expand All @@ -153,12 +132,14 @@ async function main() {
data
);
// pay the invoice
payResponse = await fedimintClient.ln.pay(data.invoice);
payResponse = await fedimintClient.lightning.pay(data.invoice);
// `/v1/ln/claim-external-pubkey-tweaked`
logMethod("/v1/ln/claim-external-pubkey-tweaked");
data = await fedimintClient.ln.claimPubkeyReceiveTweaked(keyPair.privateKey, [
1,
]);
data = await fedimintClient.lightning.claimPubkeyTweakReceives(
keyPair.privateKey,
[1],
fedimintClient.getActiveFederationId()
);
logInputAndOutput({ privateKey: keyPair.privateKey, tweaks: [1] }, data);

// MINT METHODS
Expand Down

0 comments on commit 76bcd35

Please sign in to comment.