Skip to content

Releases: warp-contracts/warp

v1.4.32

04 Mar 19:45
Compare
Choose a tag to compare

What's Changed

  • fix: [BUG] - readStateBatch returns null for contract with no interac… by @ppedziwiatr in #498

Full Changelog: v1.4.31...v1.4.32

v1.4.31

21 Dec 17:36
Compare
Choose a tag to compare

What's Changed

  • Switching to a new gw endpoint for faster interaction loading. gateway/v3/interactions-sort-key.
  • Paging for interactions loading changes: Instead of using offset for paging when fetching interactions
    each next call uses previous last sk as a new fromSK.
  • Previous endpoint is planned to be disabled soon gateway/v2/interactions-sort-key

#493

Full Changelog: v1.4.30...v1.4.31

Typings for web version

15 Dec 12:20
Compare
Choose a tag to compare

This release introduces typings for web package version.

Support for AbortSignal and batch processing

14 Dec 15:05
Compare
Choose a tag to compare

This release adds 2 new features:

1. Support for AbortSignal:

The methods: readState, readStateFor, viewState have now an optional parameter signal: AbortSignal https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal).
The main usecase is an ability to stop the contract evaluation in case it takes too much time:

const signal = AbortSignal.timeout(2000);
const contract = warp.contract("Daj-MNSnH55TDfxqC7v4eq0lKzVIwh98srUaWqyuZtY");
const result = await contract.readStateBatch(null, null, signal);

If the AbortSignal is triggered - the SDK will throw AbortError.

You can also use AbortController to have a full control over when the processing will be aborted, e.g in UI.:

const controller = new AbortController();
const signal = controller.signal;

const abortBtn = document.querySelector(".abort");

abortBtn.addEventListener("click", () => {
  controller.abort();
});

const contract = warp.contract("Daj-MNSnH55TDfxqC7v4eq0lKzVIwh98srUaWqyuZtY");
const result = await contract.readStateBatch(null, null, signal);

2. Support for batch processing:

A new method has been added to the Contract interface:

readStateBatch(pagesPerBatch: number, signal: AbortSignal): Promise<SortKeyCacheResult<EvalStateResult<State>>>

This method is helpfull for evaluating contracts with a large amount of interactions. Instead of loading all of the contract's interactions first and then evaluting them (which might consume a LOT of memory) - the SDK (when this new method is used) first loads the amount of interactions pages specified in the pagesPerBatch parameter, evaluates them, loads next batch of interactions, etc...

The parameter pagesPerBatch defines how many pages of interactions the implementation of the InteractionsLoader will load.
E.g.:

  1. if the WarpGatewayInteractionsLoader is being used (the default in case of forMainnet Warp instance) - each page contains at most 5000 interactions.
    So for the pagesPerBatch = 1, the SDK will load 5000 interactions, evaluate them, store the result in cache, load another 5000 interactions, etc.
    For the pagesPerBatch = 3, the SDK will load 15000 interactions, evaluate them, load next 15000 interactions, etc.

  2. if the ArweaveGatewayInteractionsLoader is being used - each page contains at most 100 interactions. So for the pagesPerBatch = 1, the SDK will load 100 interactions, evaluate them, store the result in cache, load another 100 interactions, etc.
    For pagesPerBatch = 5 - it will load 500 interactions, evaluate them, load another 500 interactions, etc..

Interaction input in data field

14 Dec 11:20
Compare
Choose a tag to compare

According to the SmartWeave protocol, input of the interaction can be stored in its tags, more specifically - in the Input tag. However, we are then limited by the transaction tag’s size limit - 4kb for the transaction (including all the default tags that Warp applies). Due to this problem, a new way of storing input - in the data field of the transaction - was introduceed in Warp. It does not require any changes from the user perspective. Warp SDK checks the input size and decide wether it should be placed in the tag or - if it exceeds the limit - in the data field of the transaction. Interaction is then sent to the Warp Sequencer and indexed as usual - so it is available in all of the Warp tools as it’s been before. Particularly - contract state of the contract is evaluated regardless of the input type.

A new tag - Input-Format has been added to the interaction. It is set to either tag or data depending on the way of storing input.

As of now, limit for the interaction data item is set to 20kb. New feature works only for the bundled data items (so no way of sending big inputs in Arweave L1 interactions).

What's Changed

Full Changelog: v1.4.26...v1.4.27

v1.4.26

30 Nov 20:43
Compare
Choose a tag to compare

What's Changed

  • fix(execution context): when loading interactions for arweave gateway… by @atticusofsparta in #486
  • fix(ArweaveGatewayInteractionsLoader): avoid processing duplicate int… by @dtfiedler in #484

New Contributors

Full Changelog: v1.4.25...v1.4.26

v1.4.25

17 Nov 16:31
Compare
Choose a tag to compare

What's Changed

  • fix: check contract source whitelist before loading interactions by @Tadeuchi in #480

Full Changelog: v1.4.24...v1.4.25

v1.4.24

17 Nov 15:53
Compare
Choose a tag to compare

Allows to add custom tags to createSource method, e.g.:

await warp.createSource({ src: jsContractSrc }, new ArweaveSigner(wallet), tags: [new Tag('Type','Custom-Tag')]);

Requires warp-contracts-plugin-deploy@1.0.12

What's Changed

  • feat: register contracts based on Arweave gql metadata by @asiaziola in #479
  • feat: add option to pass custom tags to createSource method by @asiaziola in #481

Full Changelog: v1.4.22...v1.4.24

v1.4.23

14 Nov 10:10
Compare
Choose a tag to compare

This release enables registration of contracts which were deployed using providers others than Irys (e.g. Turbo/arbundles).

const { contractTxId } = await warp.register(txId, 'arweave');

When registering a contract, one needs to pass contract id and set arweave as a provider. Contract metadata is then queried from Arweave GQL and indexed in the gateway database. Gateway also verifies whether contract contains contract specific tags (e.g. Contract-Src, Init-State, App-Name and App-Version).

register method is dedicated to atomic assets so contract init state should be set in a tag and not in the data field of the contract, additionally - contract should contain Content-Type tag.

This change requires warp-contracts-plugin-deploy version >= 1.0.11.

Contracts deployed using Irys are still accepted (node1 or node2 should be passed as the second parameter depending on the Irys node to which contract has been deployed).

Full Changelog: v1.4.22...v1.4.23

v1.4.22

25 Oct 14:29
Compare
Choose a tag to compare

Adding the ability to safely load data from arweave http api.
SmartWeave.safeArweaveGet(query: string)

Example in contract - https://github.com/warp-contracts/warp/blob/main/src/__tests__/integration/data/token-evolve.js#L44
Test - https://github.com/warp-contracts/warp/blob/main/src/__tests__/integration/basic/pst.test.ts#L213

NOTE 'Safe' means in this case that any error from the api will cause the contract to throw a 'NetworkCommunicationException' - the SDK then immedietally stops contractthe execution - to prevent any non-determinism that may be a result of a temporary issues with an external API.

What's Changed

Full Changelog: v1.4.21...v1.4.22