Skip to content

Commit

Permalink
Merge pull request #364 from multiversx/remove-old-wallet
Browse files Browse the repository at this point in the history
Remove old wallet package from dev-dependencies
  • Loading branch information
popenta authored Dec 19, 2023
2 parents b104ba8 + 75bacd6 commit 6d1037f
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 123 deletions.
79 changes: 7 additions & 72 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
},
"devDependencies": {
"@multiversx/sdk-network-providers": "2.2.0",
"@multiversx/sdk-wallet": "3.0.0",
"@multiversx/sdk-wallet-next": "npm:@multiversx/[email protected]",
"@multiversx/sdk-wallet": "4.2.0",
"@types/assert": "1.4.6",
"@types/chai": "4.2.11",
"@types/mocha": "9.1.0",
Expand Down
16 changes: 8 additions & 8 deletions src/relayedTransactionV1Builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe("test relayed v1 transaction builder", function () {
data: new TransactionPayload("getContractConfig"),
});

await bob.signer.sign(innerTx);
innerTx.applySignature(await bob.signer.sign(innerTx.serializeForSigning()));

const builder = new RelayedTransactionV1Builder();
const relayedTxV1 = builder
Expand All @@ -71,7 +71,7 @@ describe("test relayed v1 transaction builder", function () {
.setRelayerAddress(alice.address)
.build();

await alice.signer.sign(relayedTxV1);
relayedTxV1.applySignature(await alice.signer.sign(relayedTxV1.serializeForSigning()));

assert.equal(relayedTxV1.getNonce().valueOf(), 2627);
assert.equal(relayedTxV1.getData().toString(), "relayedTx@7b226e6f6e6365223a3139382c2273656e646572223a2267456e574f65576d6d413063306a6b71764d354241707a61644b46574e534f69417643575163776d4750673d222c227265636569766572223a22414141414141414141414141415141414141414141414141414141414141414141414141414141432f2f383d222c2276616c7565223a302c226761735072696365223a313030303030303030302c226761734c696d6974223a36303030303030302c2264617461223a225a3256305132397564484a68593352446232356d6157633d222c227369676e6174757265223a2239682b6e6742584f5536776674315464437368534d4b3454446a5a32794f74686336564c576e3478724d5a706248427738677a6c6659596d362b766b505258303764634a562b4745635462616a7049692b5a5a5942773d3d222c22636861696e4944223a2256413d3d222c2276657273696f6e223a317d");
Expand All @@ -97,7 +97,7 @@ describe("test relayed v1 transaction builder", function () {
chainID: networkConfig.ChainID
});

await carol.signer.sign(innerTx);
innerTx.applySignature(await carol.signer.sign(innerTx.serializeForSigning()));

const builder = new RelayedTransactionV1Builder();
const relayedTxV1 = builder
Expand All @@ -107,7 +107,7 @@ describe("test relayed v1 transaction builder", function () {
.setRelayerAddress(frank.address)
.build();

await frank.signer.sign(relayedTxV1);
relayedTxV1.applySignature(await frank.signer.sign(relayedTxV1.serializeForSigning()));

assert.equal(relayedTxV1.getNonce().valueOf(), 715);
assert.equal(relayedTxV1.getData().toString(), "relayedTx@7b226e6f6e6365223a3230382c2273656e646572223a227371455656633553486b6c45344a717864556e59573068397a536249533141586f3534786f32634969626f3d222c227265636569766572223a2241546c484c76396f686e63616d433877673970645168386b77704742356a6949496f3349484b594e6165453d222c2276616c7565223a313030303030303030303030303030303030302c226761735072696365223a313030303030303030302c226761734c696d6974223a35303030302c2264617461223a22222c227369676e6174757265223a22744d616d736b6f315a574b526663594e4b5673793463797879643335764b754844576a3548706172344167734c2b4a4e585642545a574c754467384867514254476d724a6b49443133637050614c55322f38626644513d3d222c22636861696e4944223a2256413d3d222c2276657273696f6e223a312c22736e64557365724e616d65223a22593246796232773d222c22726376557365724e616d65223a22595778705932553d227d");
Expand All @@ -134,7 +134,7 @@ describe("test relayed v1 transaction builder", function () {
options: TransactionOptions.withOptions({ guarded: true })
});

await bob.signer.sign(innerTx);
innerTx.applySignature(await bob.signer.sign(innerTx.serializeForSigning()));
innerTx.applyGuardianSignature(new Signature("c72e08622c86d9b6889fb9f33eed75c6a04a940daa012825464c6ccaad71640cfcf5c4d38b36fb0575345bbec90daeb2db7a423bfb5253cef0ddc5c87d1b5f04"));

const builder = new RelayedTransactionV1Builder();
Expand All @@ -145,7 +145,7 @@ describe("test relayed v1 transaction builder", function () {
.setRelayerAddress(alice.address)
.build();

await alice.signer.sign(relayedTxV1);
relayedTxV1.applySignature(await alice.signer.sign(relayedTxV1.serializeForSigning()));

assert.equal(relayedTxV1.getNonce().valueOf(), 2627);
assert.equal(relayedTxV1.getData().toString(), "relayedTx@7b226e6f6e6365223a3139382c2273656e646572223a2267456e574f65576d6d413063306a6b71764d354241707a61644b46574e534f69417643575163776d4750673d222c227265636569766572223a22414141414141414141414146414b565841323879704877692f79693741364c64504b704f68464d386958513d222c2276616c7565223a302c226761735072696365223a313030303030303030302c226761734c696d6974223a36303030303030302c2264617461223a225a3256305132397564484a68593352446232356d6157633d222c227369676e6174757265223a224b4b78324f33383655725135416b4f465258307578327933446a384853334b373038487174344668377161557669424550716c45614e746e6158706a6f2f333651476d4a456934784435457a6c6f4f677a634d4442773d3d222c22636861696e4944223a2256413d3d222c2276657273696f6e223a322c226f7074696f6e73223a322c22677561726469616e223a22486f714c61306e655733766843716f56696c70715372744c5673774939535337586d7a563868477450684d3d222c22677561726469616e5369676e6174757265223a227879344959697947326261496e376e7a507531317871424b6c4132714153676c526b7873797131785a417a3839635454697a6237425855305737374a44613679323370434f2f745355383777336358496652746642413d3d227d");
Expand All @@ -172,7 +172,7 @@ describe("test relayed v1 transaction builder", function () {
options: TransactionOptions.withOptions({ guarded: true })
});

await bob.signer.sign(innerTx);
innerTx.applySignature(await bob.signer.sign(innerTx.serializeForSigning()));
innerTx.applyGuardianSignature(new Signature("b12d08732c86d9b6889fb9f33eed65c6a04a960daa012825464c6ccaad71640cfcf5c4d38b36fb0575345bbec90daeb2db7a423bfb5253cef0ddc5c87d1b5f04"));

const builder = new RelayedTransactionV1Builder();
Expand All @@ -186,7 +186,7 @@ describe("test relayed v1 transaction builder", function () {
.setRelayedTransactionGuardian(frank.address)
.build();

await alice.signer.sign(relayedTxV1);
relayedTxV1.applySignature(await alice.signer.sign(relayedTxV1.serializeForSigning()));
relayedTxV1.applyGuardianSignature(new Signature("d32c08722c86d9b6889fb9f33eed65c6a04a970daa012825464c6ccaad71640cfcf5c4d38b36fb0575345bbec90daeb2db7a423bfb5253cef0ddc5c87d1b5f04"));

assert.equal(relayedTxV1.getNonce().valueOf(), 2627);
Expand Down
4 changes: 2 additions & 2 deletions src/relayedTransactionV2Builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe("test relayed v2 transaction builder", function () {
data: new TransactionPayload("getContractConfig"),
});

await bob.signer.sign(innerTx);
innerTx.applySignature(await bob.signer.sign(innerTx.serializeForSigning()));

const builder = new RelayedTransactionV2Builder();
const relayedTxV2 = builder
Expand All @@ -81,7 +81,7 @@ describe("test relayed v2 transaction builder", function () {
.build();

relayedTxV2.setSender(alice.address);
await alice.signer.sign(relayedTxV2);
relayedTxV2.applySignature(await alice.signer.sign(relayedTxV2.serializeForSigning()));

assert.equal(relayedTxV2.getNonce().valueOf(), 37);
assert.equal(
Expand Down
20 changes: 10 additions & 10 deletions src/smartcontracts/interaction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe("test smart contract interactor", function () {
// Execute, do not wait for execution
let transaction = interaction.withSender(alice.address).withNonce(0).buildTransaction();
transaction.setSender(alice.address);
await alice.signer.sign(transaction);
transaction.applySignature(await alice.signer.sign(transaction.serializeForSigning()));
await provider.sendTransaction(transaction);
assert.equal(transaction.getNonce().valueOf(), 0);
assert.equal(transaction.getData().toString(), "getUltimateAnswer");
Expand All @@ -195,7 +195,7 @@ describe("test smart contract interactor", function () {

transaction = interaction.withNonce(1).buildTransaction();
transaction.setSender(alice.address);
await alice.signer.sign(transaction);
transaction.applySignature(await alice.signer.sign(transaction.serializeForSigning()));
await provider.sendTransaction(transaction);
assert.equal(transaction.getNonce().valueOf(), 1);
assert.equal(
Expand All @@ -206,7 +206,7 @@ describe("test smart contract interactor", function () {
// Execute, and wait for execution
transaction = interaction.withNonce(2).buildTransaction();
transaction.setSender(alice.address);
await alice.signer.sign(transaction);
transaction.applySignature(await alice.signer.sign(transaction.serializeForSigning()));
provider.mockGetTransactionWithAnyHashAsNotarizedWithOneResult("@6f6b@2bs");
let { bundle } = await controller.execute(interaction, transaction);

Expand Down Expand Up @@ -238,24 +238,24 @@ describe("test smart contract interactor", function () {
assert.deepEqual(counterValue!.valueOf(), new BigNumber(7));

let incrementTransaction = incrementInteraction.withSender(alice.address).withNonce(14).buildTransaction();
await alice.signer.sign(incrementTransaction);
incrementTransaction.applySignature(await alice.signer.sign(incrementTransaction.serializeForSigning()));
provider.mockGetTransactionWithAnyHashAsNotarizedWithOneResult("@6f6b@08");
let { bundle: { firstValue: valueAfterIncrement } } = await controller.execute(incrementInteraction, incrementTransaction);
assert.deepEqual(valueAfterIncrement!.valueOf(), new BigNumber(8));

// Decrement three times (simulate three parallel broadcasts). Wait for execution of the latter (third transaction). Return fake "5".
// Decrement #1
let decrementTransaction = decrementInteraction.withSender(alice.address).withNonce(15).buildTransaction();
await alice.signer.sign(decrementTransaction);
decrementTransaction.applySignature(await alice.signer.sign(decrementTransaction.serializeForSigning()));
await provider.sendTransaction(decrementTransaction);
// Decrement #2
decrementTransaction = decrementInteraction.withNonce(16).buildTransaction();
await alice.signer.sign(decrementTransaction);
decrementTransaction.applySignature(await alice.signer.sign(decrementTransaction.serializeForSigning()));
await provider.sendTransaction(decrementTransaction);
// Decrement #3

decrementTransaction = decrementInteraction.withNonce(17).buildTransaction();
await alice.signer.sign(decrementTransaction);
decrementTransaction.applySignature(await alice.signer.sign(decrementTransaction.serializeForSigning()));
provider.mockGetTransactionWithAnyHashAsNotarizedWithOneResult("@6f6b@05");
let { bundle: { firstValue: valueAfterDecrement } } = await controller.execute(decrementInteraction, decrementTransaction);
assert.deepEqual(valueAfterDecrement!.valueOf(), new BigNumber(5));
Expand Down Expand Up @@ -295,7 +295,7 @@ describe("test smart contract interactor", function () {

// start()
let startTransaction = startInteraction.withSender(alice.address).withNonce(14).buildTransaction();
await alice.signer.sign(startTransaction);
startTransaction.applySignature(await alice.signer.sign(startTransaction.serializeForSigning()));
provider.mockGetTransactionWithAnyHashAsNotarizedWithOneResult("@6f6b");
let { bundle: { returnCode: startReturnCode, values: startReturnValues } } = await controller.execute(startInteraction, startTransaction);

Expand All @@ -305,7 +305,7 @@ describe("test smart contract interactor", function () {

// status() (this is a view function, but for the sake of the test, we'll execute it)
let statusTransaction = statusInteraction.withSender(alice.address).withNonce(15).buildTransaction();
await alice.signer.sign(statusTransaction);
statusTransaction.applySignature(await alice.signer.sign(statusTransaction.serializeForSigning()));
provider.mockGetTransactionWithAnyHashAsNotarizedWithOneResult("@6f6b@01");
let { bundle: { returnCode: statusReturnCode, values: statusReturnValues, firstValue: statusFirstValue } } = await controller.execute(statusInteraction, statusTransaction);

Expand All @@ -316,7 +316,7 @@ describe("test smart contract interactor", function () {

// lotteryInfo() (this is a view function, but for the sake of the test, we'll execute it)
let getLotteryInfoTransaction = getLotteryInfoInteraction.withSender(alice.address).withNonce(15).buildTransaction();
await alice.signer.sign(getLotteryInfoTransaction);
getLotteryInfoTransaction.applySignature(await alice.signer.sign(getLotteryInfoTransaction.serializeForSigning()));
provider.mockGetTransactionWithAnyHashAsNotarizedWithOneResult("@6f6b@0000000b6c75636b792d746f6b656e000000010100000000000000005fc2b9dbffffffff00000001640000000a140ec80fa7ee88000000");
let { bundle: { returnCode: infoReturnCode, values: infoReturnValues, firstValue: infoFirstValue } } = await controller.execute(getLotteryInfoInteraction, getLotteryInfoTransaction);

Expand Down
Loading

0 comments on commit 6d1037f

Please sign in to comment.