koilib 8.0.0 → 8.1.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.
package/dist/koinos.js CHANGED
@@ -23844,6 +23844,56 @@ class Provider {
23844
23844
  contract_id: contractId,
23845
23845
  });
23846
23846
  }
23847
+ /**
23848
+ * Function to get the address of a system contract
23849
+ * @param name - contract name
23850
+ *
23851
+ * @example
23852
+ * * ```ts
23853
+ * const provider = new Provider("https://api.koinos.io");
23854
+ * const result = await provider.invokeGetContractAddress("koin");
23855
+ * console.log(result);
23856
+ *
23857
+ * // { value: { address: '15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL' } }
23858
+ * ```
23859
+ */
23860
+ async invokeGetContractAddress(name) {
23861
+ const serializer = new Serializer_1.Serializer({
23862
+ nested: {
23863
+ get_address_arguments: {
23864
+ fields: {
23865
+ name: {
23866
+ type: "string",
23867
+ id: 1,
23868
+ },
23869
+ },
23870
+ },
23871
+ get_address_result: {
23872
+ fields: {
23873
+ value: {
23874
+ type: "address_record",
23875
+ id: 1,
23876
+ },
23877
+ },
23878
+ },
23879
+ address_record: {
23880
+ fields: {
23881
+ address: {
23882
+ type: "bytes",
23883
+ id: 1,
23884
+ options: {
23885
+ "(koinos.btype)": "ADDRESS",
23886
+ },
23887
+ },
23888
+ },
23889
+ },
23890
+ },
23891
+ }, {
23892
+ argumentsTypeName: "get_address_arguments",
23893
+ returnTypeName: "get_address_result",
23894
+ });
23895
+ return this.invokeSystemCall(serializer, "get_contract_address", { name });
23896
+ }
23847
23897
  }
23848
23898
  exports.Provider = Provider;
23849
23899
  exports["default"] = Provider;
@@ -24808,14 +24858,17 @@ class Transaction {
24808
24858
  * signer.provider = provider;
24809
24859
  * const tx = new Transaction({ signer });
24810
24860
  *
24811
- * // method 1
24861
+ * // Method 1 (using 2 arguments)
24862
+ * // note that with 2 arguments it is not necessary to
24863
+ * // set "onlyOperation: true". For the rest of the
24864
+ * // methods it's necessary to do that.
24812
24865
  * await tx.pushOperation(koin.transfer, {
24813
24866
  * from: "1NRYHBYr9qxYQAeVqfdSvyjJemRQ4qD3Mt",
24814
24867
  * to: "13UdKjYuzfBYbB6bGLQkUN9DJRFPCmG1mU",
24815
24868
  * value: "1000",
24816
24869
  * });
24817
24870
  *
24818
- * // method 2
24871
+ * // Method 2
24819
24872
  * await tx.pushOperation(
24820
24873
  * koin.transfer({
24821
24874
  * from: "1NRYHBYr9qxYQAeVqfdSvyjJemRQ4qD3Mt",
@@ -24826,7 +24879,7 @@ class Transaction {
24826
24879
  * })
24827
24880
  * );
24828
24881
  *
24829
- * // method 3
24882
+ * // Method 3
24830
24883
  * await tx.pushOperation(
24831
24884
  * await koin.transfer({
24832
24885
  * from: "1NRYHBYr9qxYQAeVqfdSvyjJemRQ4qD3Mt",
@@ -24837,7 +24890,7 @@ class Transaction {
24837
24890
  * })
24838
24891
  * );
24839
24892
  *
24840
- * // method 4
24893
+ * // Method 4
24841
24894
  * const { operation } = await koin.transfer({
24842
24895
  * from: "1NRYHBYr9qxYQAeVqfdSvyjJemRQ4qD3Mt",
24843
24896
  * to: "13UdKjYuzfBYbB6bGLQkUN9DJRFPCmG1mU",