-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #409 from 00labs/account-management-sync-develop
Account management sync develop
- Loading branch information
Showing
23 changed files
with
1,703 additions
and
1,356 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.json", | ||
"useWorkspaces": true, | ||
"version": "0.0.62" | ||
"version": "0.0.65" | ||
} |
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,37 @@ | ||
import { BigNumber, Wallet, ethers } from 'ethers' | ||
import { ChainEnum, POOL_NAME, POOL_TYPE } from '@huma-finance/shared' | ||
import { HumaReceivableHandler, HumaContext } from '@huma-finance/sdk' | ||
require('dotenv').config() | ||
|
||
async function main() { | ||
const TEST_PRIVATE_KEY = process.env.TEST_PRIVATE_KEY | ||
const provider = new ethers.providers.JsonRpcProvider( | ||
`https://rpc-amoy.polygon.technology`, | ||
{ | ||
name: 'Amoy', | ||
chainId: ChainEnum.Amoy, | ||
}, | ||
) | ||
const wallet = new Wallet(TEST_PRIVATE_KEY, provider) | ||
|
||
const humaContext = new HumaContext({ | ||
signer: wallet, | ||
provider, | ||
chainId: ChainEnum.Amoy, | ||
poolName: POOL_NAME.ArfCreditPoolV2, | ||
poolType: POOL_TYPE.ReceivableBackedCreditLine, | ||
}) | ||
const receivableHandler = new HumaReceivableHandler({ | ||
humaContext, | ||
}) | ||
|
||
// Mint a receivable with metadata uploaded to ARWeave | ||
const tx = await receivableHandler.declarePaymentByTokenId( | ||
BigNumber.from(10), // receivableAmount | ||
BigNumber.from(1), // token ID | ||
) | ||
const txResponse = await tx.wait() | ||
console.log(`Success. Tx hash: ${txResponse.transactionHash}`) | ||
} | ||
|
||
main() |
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,46 @@ | ||
import { Connection, Keypair, sendAndConfirmTransaction } from '@solana/web3.js' | ||
import { | ||
AnchorProvider, | ||
BN, | ||
setProvider, | ||
Wallet, | ||
web3, | ||
} from '@coral-xyz/anchor' | ||
import { POOL_NAME, SolanaChainEnum } from '@huma-finance/shared' | ||
import { HumaSolanaContext, HumaSolanaProgramHelper } from '@huma-finance/sdk' | ||
|
||
require('dotenv').config() | ||
|
||
async function main() { | ||
const TEST_PRIVATE_KEY = process.env.TEST_PRIVATE_KEY | ||
const connection = new Connection( | ||
'https://api.devnet.solana.com', | ||
'confirmed', | ||
) | ||
|
||
const keypair = web3.Keypair.fromSecretKey( | ||
Buffer.from(JSON.parse(TEST_PRIVATE_KEY)), | ||
) | ||
const wallet = new Wallet(keypair) | ||
setProvider(new AnchorProvider(connection, wallet)) | ||
|
||
const solanaHumaContext = new HumaSolanaContext({ | ||
publicKey: wallet.publicKey, | ||
connection: connection, | ||
chainId: SolanaChainEnum.SolanaDevnet, | ||
poolName: POOL_NAME.ArfCreditPool3Months, | ||
}) | ||
|
||
const humaSolanaProgramHelper = new HumaSolanaProgramHelper({ | ||
solanaContext: solanaHumaContext, | ||
}) | ||
|
||
const tx = await humaSolanaProgramHelper.buildWithdrawYieldsTransaction() | ||
|
||
console.log(tx) | ||
|
||
const txResult = await sendAndConfirmTransaction(connection, tx, [keypair]) | ||
console.log(txResult) | ||
} | ||
|
||
main() |
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
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
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
Oops, something went wrong.