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

chore: update aepp-sdk #271

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions .github/workflows/dev-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VITE_NODE_ENV=staging
VITE_BOT_SERVICE_URL=https://develop-state-channel-demo-backend.dev.aepps.com
VITE_BOT_SERVICE_URL=https://develop-state-channel-demo-backend.dev.service.aepps.com
VITE_CLIENT_PORT=8000
VITE_NODE_URL=https://testnet.aeternity.io
VITE_COMPILER_URL=https://compiler.aepps.com
VITE_COMPILER_URL=https://v7.compiler.aepps.com/
VITE_WS_URL=wss://testnet.aeternity.io/channel
VITE_FAUCET_PUBLIC_ADDRESS=ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688
VITE_NETWORK_ID=ae_uat
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prd-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VITE_NODE_ENV=staging
VITE_BOT_SERVICE_URL=https://state-channel-demo-backend.prd.aepps.com
VITE_BOT_SERVICE_URL=https://state-channel-demo-backend.prd.service.aepps.com
VITE_CLIENT_PORT=8000
VITE_NODE_URL=https://testnet.aeternity.io
VITE_COMPILER_URL=https://compiler.aepps.com
VITE_COMPILER_URL=https://v7.compiler.aepps.com/
VITE_WS_URL=wss://testnet.aeternity.io/channel
VITE_FAUCET_PUBLIC_ADDRESS=ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688
VITE_NETWORK_ID=ae_uat
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stg-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VITE_NODE_ENV=staging
VITE_BOT_SERVICE_URL=https://pr-${{ env.PR_NUMBER }}-state-channel-demo-backend.stg.aepps.com
VITE_BOT_SERVICE_URL=https://pr-${{ env.PR_NUMBER }}-state-channel-demo-backend.stg.service.aepps.com
VITE_CLIENT_PORT=8000
VITE_NODE_URL=https://testnet.aeternity.io
VITE_COMPILER_URL=https://compiler.aepps.com
VITE_COMPILER_URL=https://v7.compiler.aepps.com/
VITE_WS_URL=wss://testnet.aeternity.io/channel
VITE_FAUCET_PUBLIC_ADDRESS=ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688
VITE_NETWORK_ID=ae_uat
Expand Down
22 changes: 11 additions & 11 deletions TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ At each application we need at first to initialize an sdk instance. It is advise
### Client side (Similar to Server side)
```js
const aeSdk = new AeSdk({
compilerUrl: <COMPILER_URL>,
onCompiler: new CompilerHttp(<COMPILER_URL>),
nodes: [
{
name: 'aeNode',
Expand All @@ -50,7 +50,7 @@ In the server application it is proposed to reside in a file that handles the ge
### Client side (Similar to Server side)
```js
const keypair = generateKeyPair();
await aeSdk.addAccount(new MemoryAccount({ keypair }, {
await aeSdk.addAccount(new MemoryAccount(secretKey, {
select: true,
}));
```
Expand Down Expand Up @@ -264,7 +264,7 @@ const CONTRACT_CONFIGURATION = {
vmVersion: 5,
abiVersion: 3,
};
const contract = await sdk.getContractInstance({
const contract = await sdk.initializeContract({
aci: contractAci,
bytecode: contractBytecode,
onAccount,
Expand All @@ -273,8 +273,8 @@ await contract.compile();
await initiatorChannel.createContract(
{
...CONTRACT_CONFIGURATION,
code: contract.bytecode,
callData: contract.calldata.encode(CONTRACT_NAME, Methods.init, [
code: contract.$options.bytecode,
callData: contract._calldata.encode(CONTRACT_NAME, Methods.init, [
...Object.values(config),
]) as Encoded.ContractBytearray,
},
Expand All @@ -295,7 +295,7 @@ async callContract(method, params, amount) {
const result = await channel.callContract(
{
amount: amount ?? '<STAKE_AMOUNT>',
callData: this.contract.calldata.encode(
callData: this.contract._calldata.encode(
'<CONTRACT_NAME>',
method,
params
Expand Down Expand Up @@ -378,7 +378,7 @@ This code can reside inside the `bot.service.js` file for the server
})

const channelState = await channel.state();
const lastSignedTx = channelState.signedTx;
const lastSignedTx = buildTx(channelState.signedTx);

const closeSoloTx = await aeSdk.buildTx(Tag.ChannelCloseSoloTx, {
channelId,
Expand Down Expand Up @@ -424,7 +424,7 @@ async function buildContract(
contractCreationChannelRound: number,
owner: Encoded.AccountAddress
) {
const contract = await aeSdk.getContractInstance({
const contract = await aeSdk.initializeContract({
aci: contractAci,
bytecode: contractBytecode,
});
Expand Down Expand Up @@ -456,7 +456,7 @@ export async function handleLastCallUpdate() {
return null;
}

const decodedEvents = channel.decodeEvents(
const decodedEvents = channel.$decodeEvents(
result.log,
);
/**
Expand All @@ -478,7 +478,7 @@ export async function handleLastCallUpdate() {


// here you can use a switch statement and make your next move based on events
const callDataToBeSent = contract.calldata.encode(
const callDataToBeSent = contract._calldata.encode(
CONTRACT_NAME,
'<METHOD_NAME>',
[...'<METHOD_ARGUMENTS>']
Expand Down Expand Up @@ -508,7 +508,7 @@ In order to check if a channel is still open, we can make a get request to nod
## [`validateOpponentCall`](https://github.com/aeternity/state-channel-demo/blob/develop/client/src/js/game-channel/game-channel.js#L500)
```js
validateOpponentCall(update) {
const decodedValue = this.contract.calldata
const decodedValue = this.contract._calldata
.decode('<CONTRACT_NAME>', '<EXPECTE_CONTRACT_METHOD>', update.call_data);
if (decodedValue !== 'EXPECTED_VALUE') {
throw new Error(`Invalid method`);
Expand Down
2 changes: 1 addition & 1 deletion client/.env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ VITE_NODE_ENV=staging
VITE_BOT_SERVICE_URL=http://localhost:3000
VITE_CLIENT_PORT=8000
VITE_NODE_URL=https://testnet.prd.aepps.com
VITE_COMPILER_URL= https://compiler.aepps.com
VITE_COMPILER_URL= https://v7.compiler.aepps.com/
VITE_WS_URL=wss://testnet.prd.aepps.com/channel
VITE_FAUCET_PUBLIC_ADDRESS = ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688
VITE_NETWORK_ID = ae_uat
Expand Down
Loading
Loading