Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 committed Nov 20, 2024
1 parent 15c5e82 commit 05ef9dd
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/sdks-playground/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ function App() {
}
};

const handleLnV3Register = async () => {};

return (
<>
<div>
Expand All @@ -204,6 +206,7 @@ function App() {
<p className="read-the-docs">Click on the Vite and React logos to learn more</p>

<button onClick={handleTransfer}>Transfer</button>
<button onClick={handleLnV3Register}>LnV3 Register</button>
</>
);
}
Expand Down
18 changes: 18 additions & 0 deletions packages/sdk-bridge/src/lnbridge-v2-default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export class LnBridgeV2Default extends LnBridgeV2 {
return this.sourcePublicClient.waitForTransactionReceipt({ hash, confirmations: DEFAULT_CONFIRMATIONS });
}

/**
* Deposit margin
* @param margin - Amount in target token
* @returns TransactionReceipt
*/
async depositMargin(margin: bigint) {
assert(this.walletClient, "Wallet client is required");
const signer = (await this.walletClient.getAddresses())[0];
Expand All @@ -62,6 +67,12 @@ export class LnBridgeV2Default extends LnBridgeV2 {
return this.targetPublicClient.waitForTransactionReceipt({ hash, confirmations: DEFAULT_CONFIRMATIONS });
}

/**
* Update fee and rate
* @param baseFee - Base fee in source token
* @param feeRate - Fee rate in percentage (0-100)
* @returns TransactionReceipt
*/
async updateFeeAndRate(baseFee: bigint, feeRate: number) {
assert(this.walletClient, "Wallet client is required");
const signer = (await this.walletClient.getAddresses())[0];
Expand All @@ -77,6 +88,13 @@ export class LnBridgeV2Default extends LnBridgeV2 {
return this.sourcePublicClient.waitForTransactionReceipt({ hash, confirmations: DEFAULT_CONFIRMATIONS });
}

/**
* Withdraw margin
* @param recipientOrParams - Recipient address or params
* @param amount - Amount in source token
* @param fee - Fee in source native token
* @returns TransactionReceipt
*/
async withdrawMargin(recipientOrParams: Address | Hash, amount: bigint, fee: bigint) {
assert(this.walletClient, "Wallet client is required");
const signer = (await this.walletClient.getAddresses())[0];
Expand Down
7 changes: 7 additions & 0 deletions packages/sdk-bridge/src/lnbridge-v2-opposite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ export class LnBridgeV2Opposite extends LnBridgeV2 {
return this.sourcePublicClient.waitForTransactionReceipt({ hash, confirmations: DEFAULT_CONFIRMATIONS });
}

/**
* Update fee rate and margin
* @param baseFee - Base fee in source token
* @param feeRate - Fee rate in percentage (0-100)
* @param margin - Margin in source token
* @returns TransactionReceipt
*/
async updateFeeRateMargin(baseFee: bigint, feeRate: number, margin: bigint) {
assert(this.walletClient, "Wallet client is required");
const signer = (await this.walletClient.getAddresses())[0];
Expand Down
17 changes: 17 additions & 0 deletions packages/sdk-bridge/src/lnbridge-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ export class LnBridgeV3 extends LnBridge {
return { value, token: this.sourceToken };
}

/**
* Register LnProvider
* @param baseFee - Base fee in source token
* @param feeRate - Fee rate in percentage (0-100)
* @param transferLimit - Transfer limit in source token
* @returns TransactionReceipt
*/
async register(baseFee: bigint, feeRate: number, transferLimit: bigint) {
assert(this.walletClient, "Wallet client is required");
const signer = (await this.walletClient.getAddresses())[0];
Expand All @@ -77,6 +84,11 @@ export class LnBridgeV3 extends LnBridge {
return this.sourcePublicClient.waitForTransactionReceipt({ hash, confirmations: DEFAULT_CONFIRMATIONS });
}

/**
* Deposit penalty reserve
* @param amount - Amount in source token
* @returns TransactionReceipt
*/
async depositPenaltyReserve(amount: bigint) {
assert(this.walletClient, "Wallet client is required");
const signer = (await this.walletClient.getAddresses())[0];
Expand All @@ -93,6 +105,11 @@ export class LnBridgeV3 extends LnBridge {
return this.sourcePublicClient.waitForTransactionReceipt({ hash, confirmations: DEFAULT_CONFIRMATIONS });
}

/**
* Withdraw penalty reserve
* @param amount - Amount in source token
* @returns TransactionReceipt
*/
async withdrawPenaltyReserve(amount: bigint) {
assert(this.walletClient, "Wallet client is required");
const signer = (await this.walletClient.getAddresses())[0];
Expand Down

0 comments on commit 05ef9dd

Please sign in to comment.