stellar / js-stellar-base

The lowest-level stellar helper library. It consists of classes to read, write, hash, and sign Stellar xdr
https://stellar.github.io/js-stellar-base/
Apache License 2.0
106 stars 138 forks source link

Support constructors in contract creation via `Operation.createCustomContract` #770

Closed Shaptic closed 2 days ago

Shaptic commented 3 weeks ago

Upgrade the createCustomContract abstraction to accept a new, optional parameter:

class Operation {
  // ...
  createCustomContract(
    address: Address,
    wasmHash: Buffer | Uint8Array,
+   constructorArgs?: xdr.ScVal[],
    salt?: Buffer | Uint8Array,
...

and upgrade the internals to use the CreateContractV2 host function.

This closes #768.

github-actions[bot] commented 3 weeks ago

Size Change: +2.31 kB (+0.07%)

Total Size: 3.26 MB

Filename Size Change
dist/stellar-base.js 2.39 MB +1.9 kB (+0.08%)
dist/stellar-base.min.js 867 kB +408 B (+0.05%)

compressed-size-action

chadoh commented 2 weeks ago

Why ctorArgs instead of just args or constructorArgs?

Shaptic commented 2 weeks ago

@chadoh will you accept "laziness" as an answer? :laughing: fixed!