@alephium/web3 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/alephium-web3.min.js +1 -1
  2. package/dist/alephium-web3.min.js.map +1 -1
  3. package/dist/src/api/node-provider.d.ts +2 -0
  4. package/dist/src/api/node-provider.js +12 -6
  5. package/dist/src/api/utils.d.ts +1 -1
  6. package/dist/src/block/block.d.ts +28 -0
  7. package/dist/src/block/block.js +131 -0
  8. package/dist/src/block/index.d.ts +1 -0
  9. package/dist/src/block/index.js +22 -0
  10. package/dist/src/codec/contract-output-codec.js +4 -4
  11. package/dist/src/codec/lockup-script-codec.js +2 -2
  12. package/dist/src/codec/method-codec.d.ts +3 -1
  13. package/dist/src/codec/method-codec.js +27 -2
  14. package/dist/src/codec/script-codec.d.ts +11 -6
  15. package/dist/src/codec/script-codec.js +13 -2
  16. package/dist/src/codec/transaction-codec.js +2 -2
  17. package/dist/src/codec/unlock-script-codec.d.ts +2 -2
  18. package/dist/src/codec/unsigned-tx-codec.d.ts +2 -2
  19. package/dist/src/contract/contract.d.ts +19 -10
  20. package/dist/src/contract/contract.js +103 -56
  21. package/dist/src/contract/events.d.ts +1 -2
  22. package/dist/src/contract/events.js +28 -14
  23. package/dist/src/index.d.ts +1 -0
  24. package/dist/src/index.js +1 -0
  25. package/dist/src/signer/tx-builder.js +4 -4
  26. package/dist/src/transaction/status.js +28 -4
  27. package/dist/src/utils/address.js +29 -16
  28. package/dist/src/utils/exchange.js +25 -15
  29. package/dist/src/utils/number.d.ts +1 -1
  30. package/dist/src/utils/sign.js +6 -6
  31. package/dist/src/utils/subscription.d.ts +4 -4
  32. package/dist/src/utils/subscription.js +1 -1
  33. package/package.json +3 -3
  34. package/src/api/node-provider.ts +8 -1
  35. package/src/api/utils.ts +1 -1
  36. package/src/block/block.ts +139 -0
  37. package/src/block/index.ts +19 -0
  38. package/src/codec/contract-output-codec.ts +1 -1
  39. package/src/codec/lockup-script-codec.ts +3 -3
  40. package/src/codec/method-codec.ts +41 -3
  41. package/src/codec/script-codec.ts +23 -5
  42. package/src/codec/transaction-codec.ts +1 -1
  43. package/src/codec/unlock-script-codec.ts +2 -2
  44. package/src/codec/unsigned-tx-codec.ts +2 -2
  45. package/src/contract/contract.ts +139 -78
  46. package/src/contract/events.ts +6 -18
  47. package/src/index.ts +1 -0
  48. package/src/signer/tx-builder.ts +2 -2
  49. package/src/transaction/status.ts +4 -4
  50. package/src/utils/address.ts +15 -2
  51. package/src/utils/exchange.ts +32 -10
  52. package/src/utils/number.ts +1 -1
  53. package/src/utils/sign.ts +1 -1
  54. package/src/utils/subscription.ts +4 -4
  55. package/std/fungible_token_interface.ral +1 -0
  56. package/std/nft_collection_interface.ral +1 -0
  57. package/std/nft_collection_with_royalty_interface.ral +1 -0
  58. package/std/nft_interface.ral +1 -0
@@ -18,8 +18,8 @@ along with the library. If not, see <http://www.gnu.org/licenses/>.
18
18
 
19
19
  import EventEmitter from 'eventemitter3'
20
20
 
21
- type MessageCallback<Message> = (message: Message) => Promise<void>
22
- type ErrorCallback<Message> = (error: any, subscription: Subscription<Message>) => Promise<void>
21
+ type MessageCallback<Message> = (message: Message) => Promise<void> | void
22
+ type ErrorCallback<Message> = (error: any, subscription: Subscription<Message>) => Promise<void> | void
23
23
 
24
24
  export interface SubscribeOptions<Message> {
25
25
  pollingInterval: number
@@ -45,7 +45,7 @@ export abstract class Subscription<Message> {
45
45
  this.eventEmitter = new EventEmitter()
46
46
  }
47
47
 
48
- startPolling(): void {
48
+ subscribe(): void {
49
49
  this.eventEmitter.on('tick', async () => {
50
50
  await this.polling()
51
51
 
@@ -68,5 +68,5 @@ export abstract class Subscription<Message> {
68
68
  return this.cancelled
69
69
  }
70
70
 
71
- abstract polling(): Promise<void>
71
+ protected abstract polling(): Promise<void>
72
72
  }
@@ -1,4 +1,5 @@
1
1
  @std(id = #0001)
2
+ @using(methodSelector = false)
2
3
  Interface IFungibleToken {
3
4
  pub fn getSymbol() -> ByteVec
4
5
 
@@ -1,6 +1,7 @@
1
1
  import "std/nft_interface"
2
2
 
3
3
  @std(id = #0002)
4
+ @using(methodSelector = false)
4
5
  Interface INFTCollection {
5
6
  // Collection Uri points to a json file containing metadata for the NFT collection.
6
7
  //
@@ -1,6 +1,7 @@
1
1
  import "std/nft_collection_interface"
2
2
 
3
3
  @std(id = #000201)
4
+ @using(methodSelector = false)
4
5
  Interface INFTCollectionWithRoyalty extends INFTCollection {
5
6
  pub fn royaltyAmount(tokenId: ByteVec, salePrice: U256) -> (U256)
6
7
 
@@ -1,4 +1,5 @@
1
1
  @std(id = #0003)
2
+ @using(methodSelector = false)
2
3
  Interface INFT {
3
4
  // Token Uri points to a json file containing metadata for the NFT.
4
5
  //