Skip to content

Commit

Permalink
chore: update aepp-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkaintas committed Jul 11, 2024
1 parent 059fdd0 commit 301d02f
Show file tree
Hide file tree
Showing 36 changed files with 6,851 additions and 2,267 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
VITE_BOT_SERVICE_URL=https://develop-state-channel-demo-backend.dev.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
2 changes: 1 addition & 1 deletion .github/workflows/prd-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
VITE_BOT_SERVICE_URL=https://state-channel-demo-backend.prd.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
2 changes: 1 addition & 1 deletion .github/workflows/stg-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
VITE_BOT_SERVICE_URL=https://pr-${{ env.PR_NUMBER }}-state-channel-demo-backend.stg.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

0 comments on commit 301d02f

Please sign in to comment.