Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
chadoh committed Sep 25, 2024
1 parent 17ab168 commit 5b79cce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 37 deletions.
21 changes: 5 additions & 16 deletions src/contract/assembled_transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,22 +757,11 @@ export class AssembledTransaction<T> {
entry.credentials().address().signature().switch().name ===
"scvVoid"),
)
.map((entry) => {
const addr = entry.credentials().address().address();
const addrType = addr.switch().name;
switch(addrType) {
case 'scAddressTypeAccount':
return StrKey.encodeEd25519PublicKey(
addr.accountId().ed25519(),
);
case 'scAddressTypeContract':
return Address.contract(
addr.contractId()
).toString()
default:
throw new Error(`Unknown address type: ${addrType}`);
}
})
.map((entry) =>
Address.fromScAddress(
entry.credentials().address().address(),
).toString(),
),
),
];
};
Expand Down
25 changes: 4 additions & 21 deletions test/e2e/src/test-non-invoker-signing-by-contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,6 @@ const {
} = require("./util");
const { Asset, Operation, Horizon, TransactionBuilder } = require("../../..");

// A bug was reported for a SAC contract on testnet with contract ID
// CA4SAAVG73IW6JQK4F45NAR7IAT7DI5MQPRSYSQWEWX4RKUNLL77MNOF. This is the spec
// for that contract.
// const spec = new contract.Spec([ "AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAAAQAAAAAAAAASQWxyZWFkeUluaXRpYWxpemVkAAAAAAAB",
// "AAAAAAAAAAAAAAAEaW5pdAAAAAIAAAAAAAAABWFkbWluAAAAAAAAEwAAAAAAAAAFdG9rZW4AAAAAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
// "AAAAAAAAAAAAAAAFYWRtaW4AAAAAAAAAAAAAAQAAABM=",
// "AAAAAAAAAAAAAAAJc2V0X2FkbWluAAAAAAAAAQAAAAAAAAAHYWRkcmVzcwAAAAATAAAAAA==",
// "AAAAAAAAAAAAAAAIdHJhbnNmZXIAAAADAAAAAAAAAARmcm9tAAAAEwAAAAAAAAACdG8AAAAAABMAAAAAAAAABmFtb3VudAAAAAAACwAAAAA=",
// "AAAAAAAAAAAAAAAEbWludAAAAAIAAAAAAAAAAnRvAAAAAAATAAAAAAAAAAZhbW91bnQAAAAAAAsAAAAA",
// "AAAAAgAAAAAAAAAAAAAAB0RhdGFLZXkAAAAAAgAAAAAAAAAAAAAABUFkbWluAAAAAAAAAAAAAAAAAAAFVG9rZW4AAAA=" ]);

// xdr from bug report https://github.com/stellar/js-stellar-sdk/issues/1030
// const txXdr = "AAAAAgAAAADhY+75HJcYjxA07MhDzZk/DwQzVITe9slCwDgcEGcc+AACfJ8AEJEBAAAAAwAAAAEAAAAAAAAAAAAAAABmv+l8AAAAAAAAAAEAAAAAAAAAGAAAAAAAAAABOSACpv7RbyYK4XnWgj9AJ/GjrIPjLEoWJa/Iqo1a//YAAAAEbWludAAAAAIAAAASAAAAAAAAAADhY+75HJcYjxA07MhDzZk/DwQzVITe9slCwDgcEGcc+AAAAAoAAAAAAAAAAAAAAAAAAABkAAAAAQAAAAEAAAABEGJ2U3ldj9dca1n1NK0i2XkfL/5zXZsxAOIxUmn9RWknYhAjSWxRgQAAAAAAAAABAAAAAAAAAAE5IAKm/tFvJgrhedaCP0An8aOsg+MsShYlr8iqjVr/9gAAAARtaW50AAAAAgAAABIAAAAAAAAAAOFj7vkclxiPEDTsyEPNmT8PBDNUhN72yULAOBwQZxz4AAAACgAAAAAAAAAAAAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAEAAAAAAAAAAAagL+zRaDmKTHWcB67aFNUZNLVg6ojcyrbO1u3Sg/KcAAAAAYAAAABOSACpv7RbyYK4XnWgj9AJ/GjrIPjLEoWJa/Iqo1a//YAAAAUAAAAAQAAAAYAAAABwfs5RVshthImbX+wmqWS0t1AjL4y5EjMMtSk/oEy11AAAAAUAAAAAQAAAAeheXOfVamUQyN7XuqlXPfXnmxx6tJxnGFVIA2YxmGnMwAAAAIAAAABAAAAAOFj7vkclxiPEDTsyEPNmT8PBDNUhN72yULAOBwQZxz4AAAAAlRFU1Q0AAAAAAAAAAAAAAAagL+zRaDmKTHWcB67aFNUZNLVg6ojcyrbO1u3Sg/KcAAAAAYAAAABEGJ2U3ldj9dca1n1NK0i2XkfL/5zXZsxAOIxUmn9RWkAAAAVJ2IQI0lsUYEAAAAAABUmowAADXgAAADEAAAAAAACfDsAAAAA";

// const contractId = "CA4SAAVG73IW6JQK4F45NAR7IAT7DI5MQPRSYSQWEWX4RKUNLL77MNOF";
// const networkPassphrase = "Test SDF Network ; September 2015";
// const rpcUrl = "https://soroban-testnet.stellar.org";

before(async function () {
const { contractId: doesSigning, keypair } = await clientFor("doesSigning");
const { client: needsSignature } = await clientFor("needsSignature", {
Expand All @@ -47,8 +29,9 @@ describe("needsNonInvokerSigningBy", function () {
});

describe("sign", function () {
it("doesn't throw error for nonInvokerSigningBy contract", async function () {
const tx = await this.context.tx.sign({ force: true });
expect(tx).to.not.be.false;
it("doesn't throw error when nonInvokerSigningBy returns a contract", async function () {
expect(
async () => await this.context.tx.sign({ force: true }),
).to.not.throw();
});
});

0 comments on commit 5b79cce

Please sign in to comment.