Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the code to 0.13.0 version #114

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .changeset/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions .changeset/config.json

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/version_pull_request.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Version pull request

on:
push:
branches:
- main
- master
workflow_dispatch:

concurrency:
Expand Down
18 changes: 0 additions & 18 deletions commitlint.config.ts

This file was deleted.

2 changes: 1 addition & 1 deletion examples/asyncCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const anotherAddress = WalletV1.calculateWalletAddress({
const hash = await wallet.sendMessage({
to: anotherAddress,
value: 10_000_000n,
gas: 100_000n,
feeCredit: 100_000n,
});

await waitTillCompleted(client, 1, hash);
Expand Down
2 changes: 1 addition & 1 deletion examples/bounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const hash = await wallet.sendMessage({
to: anotherWallet.getAddressHex(),
value: 10_000_000n,
bounceTo: bounceAddress,
gas: 100_000n * 10n,
feeCredit: 100_000n * 10n,
data: encodeFunctionData({
abi: WalletV1.abi,
functionName: "syncCall",
Expand Down
2 changes: 1 addition & 1 deletion examples/deployInternalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const { address, hash } = await wallet.deployContract({
abi: abi,
args: [bytesToHex(pubkey), walletAddress],
value: 10000000n,
gas: 1000000n * 10n,
feeCredit: 1000000n * 10n,
salt: 400n,
shardId: 1,
});
Expand Down
8 changes: 6 additions & 2 deletions examples/deployWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import {
PublicClient,
WalletV1,
bytesToHex,
convertEthToWei,
generateRandomPrivateKey,
waitTillCompleted,
} from "../src";

const client = new PublicClient({
Expand All @@ -30,12 +32,14 @@ const wallet = new WalletV1({
client,
signer,
});
const walletAddress = await wallet.getAddressHex();
const walletAddress = wallet.getAddressHex();

// biome-ignore lint/nursery/noConsole: <explanation>
console.log("walletAddress", walletAddress);

await faucet.withdrawToWithRetry(walletAddress, 100000n);
const faucetHash = await faucet.withdrawTo(walletAddress, convertEthToWei(0.1));

await waitTillCompleted(client, 1, bytesToHex(faucetHash));
await wallet.selfDeploy(true);

const code = await client.getCode(walletAddress, "latest");
Expand Down
6 changes: 5 additions & 1 deletion examples/externalContractDeployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import {
PublicClient,
WalletV1,
bytesToHex,
convertEthToWei,
externalDeploymentMessage,
generateRandomPrivateKey,
waitTillCompleted,
} from "../src";

const client = new PublicClient({
Expand Down Expand Up @@ -39,7 +41,9 @@ const addr = bytesToHex(deploymentMessage.to);
// biome-ignore lint/nursery/noConsole: <explanation>
console.log("walletAddress", addr);

await faucet.withdrawToWithRetry(addr, 100000n);
const faucetHash = await faucet.withdrawTo(addr, convertEthToWei(0.1));

await waitTillCompleted(client, 1, bytesToHex(faucetHash));

await deploymentMessage.send(client);

Expand Down
5 changes: 4 additions & 1 deletion examples/syncCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
bytesToHex,
convertEthToWei,
generateRandomPrivateKey,
waitTillCompleted,
} from "../src";

const client = new PublicClient({
Expand Down Expand Up @@ -36,7 +37,9 @@ const walletAddress = await wallet.getAddressHex();
// biome-ignore lint/nursery/noConsole: <explanation>
console.log("walletAddress", walletAddress);

await faucet.withdrawToWithRetry(walletAddress, convertEthToWei(0.1));
const faucetHash = await faucet.withdrawTo(walletAddress, convertEthToWei(0.1));

await waitTillCompleted(client, 1, bytesToHex(faucetHash));
await wallet.selfDeploy(true);

// biome-ignore lint/nursery/noConsole: <explanation>
Expand Down
34 changes: 24 additions & 10 deletions examples/tokenMint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import {
Faucet,
HttpTransport,
LocalECDSAKeySigner,
MINTER_ABI,
MINTER_ADDRESS,
PublicClient,
WalletV1,
bytesToHex,
convertEthToWei,
generateRandomPrivateKey,
hexToBigInt,
waitTillCompleted,
Expand Down Expand Up @@ -36,7 +35,9 @@ const wallet = new WalletV1({
signer,
});
const walletAddress = await wallet.getAddressHex();
await faucet.withdrawToWithRetry(walletAddress, 1_000_000_000_000n);
const faucetHash = await faucet.withdrawTo(walletAddress, convertEthToWei(0.1));

await waitTillCompleted(client, 1, bytesToHex(faucetHash));

await wallet.selfDeploy(true);
// biome-ignore lint/nursery/noConsole: <explanation>
Expand All @@ -45,18 +46,31 @@ console.log("Wallet deployed successfully");
console.log("walletAddress", walletAddress);

const hashMessage = await wallet.sendMessage({
to: MINTER_ADDRESS,
gas: 1_000_000n * 10n,
value: 100_000_000n,
to: walletAddress,
feeCredit: 1_000_000n * 10n,
value: 0n,
data: encodeFunctionData({
abi: MINTER_ABI,
functionName: "create",
args: [100_000_000n, walletAddress, "MY_TOKEN", walletAddress],
abi: WalletV1.abi,
functionName: "setCurrencyName",
args: ["MY_TOKEN"],
}),
});

await waitTillCompleted(client, 1, hashMessage);

const hashMessage2 = await wallet.sendMessage({
to: walletAddress,
feeCredit: 1_000_000n * 10n,
value: 0n,
data: encodeFunctionData({
abi: WalletV1.abi,
functionName: "mintCurrency",
args: [100_000_000n],
}),
});

await waitTillCompleted(client, 1, hashMessage2);

const n = hexToBigInt(walletAddress);

const tokens = await client.getCurrencies(walletAddress, "latest");
Expand All @@ -72,7 +86,7 @@ const anotherAddress = WalletV1.calculateWalletAddress({
const sendHash = await wallet.sendMessage({
to: anotherAddress,
value: 10_000_000n,
gas: 100_000n * 10n,
feeCredit: 100_000n * 10n,
tokens: [
{
id: n,
Expand Down
Loading
Loading