-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ticket: BTC-1776
- Loading branch information
Showing
4 changed files
with
80 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { strict as assert } from 'assert'; | ||
import { TestBitGo } from '@bitgo/sdk-test'; | ||
import { BitGo } from '../../../src'; | ||
import { Wallet } from '@bitgo/sdk-core'; | ||
|
||
describe('LightningV2 Wallet:', function () { | ||
const bitgo = TestBitGo.decorate(BitGo, { env: 'test' }); | ||
bitgo.initializeTestVars(); | ||
|
||
it('should allow lightningV2 wallets to be created for supported coins', function () { | ||
const lnbtcWallet = new Wallet(bitgo, bitgo.coin('lnbtc'), { | ||
id: '123', | ||
coin: 'lnbtc', | ||
}); | ||
|
||
const tlntcWallet = new Wallet(bitgo, bitgo.coin('tlnbtc'), { | ||
id: '123', | ||
coin: 'tlntc', | ||
}); | ||
|
||
assert(lnbtcWallet.lightningV2(), 'lnbtc wallet should support lightningV2'); | ||
assert(tlntcWallet.lightningV2(), 'tlnbtc wallet should support lightningV2'); | ||
}); | ||
|
||
it('should throw error when creating lightningV2 wallet for unsupported coins', function () { | ||
const btcWallet = new Wallet(bitgo, bitgo.coin('btc'), { | ||
id: '123', | ||
coin: 'btc', | ||
}); | ||
|
||
assert.throws(() => { | ||
btcWallet.lightningV2(); | ||
}, /Lightning not supported for btc/); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { IWallet } from './iWallet'; | ||
|
||
export interface ILightningWallet { | ||
/** | ||
* Creates a lightning invoice | ||
* @param params Invoice parameters (to be defined) | ||
*/ | ||
createInvoice(params: unknown): Promise<unknown>; | ||
|
||
/** | ||
* Pay a lightning invoice | ||
* @param params Payment parameters (to be defined) | ||
*/ | ||
payInvoice(params: unknown): Promise<unknown>; | ||
} | ||
|
||
export class SelfCustodialLightningWallet implements ILightningWallet { | ||
public wallet: IWallet; | ||
|
||
constructor(wallet: IWallet) { | ||
this.wallet = wallet; | ||
} | ||
|
||
async createInvoice(params: unknown): Promise<unknown> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
async payInvoice(params: unknown): Promise<unknown> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
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