-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
31 changed files
with
247 additions
and
62 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 |
---|---|---|
|
@@ -14,6 +14,7 @@ lint: | |
cargo machete | ||
cargo test --all | ||
make test_go | ||
make build_wasm | ||
|
||
lint-check: | ||
cargo fmt -- --check | ||
|
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
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
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
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
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 { connect,disconnect } from "starknetkit"; | ||
import Contract from "starknet"; | ||
|
||
async function starknetDeposit() { | ||
await disconnect(); | ||
const starknet = await connect(); | ||
|
||
if (!starknet) { | ||
throw Error("User rejected wallet selection or silent connect found nothing") | ||
} | ||
|
||
// (optional) connect the wallet | ||
await starknet.enable(); | ||
if (starknet.isConnected === false) { | ||
console.log("not connected"); | ||
return; | ||
} | ||
console.log(starknet); | ||
|
||
let provider = starknet.provider; | ||
let token_address = "0x05dea2a666a1542d6b39bb6f6cd914c6c1383e47bd183141b1ded0f341aa733f"; | ||
const zklinkAddress = "0x0346dd9e1bd173fc59cda8f2b9bb5dc10d7ecb8ca838ed08847ff3acbef21484"; | ||
//1.approve | ||
const erc20_abi = await starknet.provider.getClassAt(token_address); | ||
const erc20_contract = new Contract(erc20_abi.abi, token_address, provider); | ||
erc20_contract.connect(starknet.account); | ||
const call_data_approve = await erc20_contract.populate("approve",[zklinkAddress,100000000]); | ||
const res_approve = await erc20_contract.approve(call_data_approve.calldata); | ||
console.log(res_approve.transaction_hash); | ||
await provider.waitForTransaction(res_approve.transaction_hash); | ||
//let bal = await erc20_contract.balanceOf(starknet.selectedAddress); | ||
//console.log(bal); | ||
|
||
|
||
//2.deposit | ||
const { abi } = await starknet.provider.getClassAt(zklinkAddress); | ||
const contract = new Contract(abi, zklinkAddress, provider); | ||
// Connect account with the contract | ||
contract.connect(starknet.account); | ||
const res = await contract.depositERC20(token_address,1,starknet.selectedAddress,0,false); | ||
console.log(res.transaction_hash); | ||
await provider.waitForTransaction(res.transaction_hash); | ||
|
||
} | ||
|
||
await starknetDeposit(); |
Oops, something went wrong.