@concordium/browser-wallet-api-helpers 3.0.1 → 3.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/CHANGELOG.md ADDED
@@ -0,0 +1,128 @@
1
+ # Changelog
2
+
3
+ ### Unreleased
4
+
5
+ ### 3.1.0
6
+
7
+ - Updated handler `sendTransaction` with new payload type `TokenUpdatePayload`
8
+
9
+ ## 3.0.1
10
+
11
+ ### Fixed
12
+
13
+ - Extend type `SmartContractParameters` with `bigint` allowing large numbers in smart contract parameters.
14
+
15
+ ## 3.0.0
16
+
17
+ ### Breaking changes
18
+
19
+ - Removed `getGrpcClient`. As an alternative, `grpcTransport` can be used with `ConcordiumGRPCClient` from `@concordium/web-sdk`.
20
+ - Make dependency to `@concordium/web-sdk` a peer dependency (^7.0).
21
+ This will require consuming apps to add an explicit dependency to the library with its own version constraints.
22
+
23
+ ### Added
24
+
25
+ - `grpcTransport` getter for getting a gprc transport layer for constructing a GRPC client which uses the node settings from the wallet.
26
+
27
+ ## 2.8.0
28
+
29
+ ### Fixed
30
+
31
+ - `requestAccounts` no longer appears to be able to return undefined.
32
+
33
+ ## 2.7.0
34
+
35
+ ### Changed
36
+
37
+ - Bumped version of @concordium/web-sdk to 6.3.0.
38
+
39
+ ## 2.6.0
40
+
41
+ ### Added
42
+
43
+ - `requestAccounts` entrypoint to connect to a list of accounts.
44
+ - `addWeb3IdCredential` entrypoint to add verifiable credentials.
45
+ - `requestVerifiablePresentation`entrypoint to prove statements about identities and verifiable credentials.
46
+
47
+ ## 2.5.1
48
+
49
+ ### Changed
50
+
51
+ - Made it possible to define the `type` of `SchemaWithContext` as a string along with the existing `SchemaType` enum.
52
+
53
+ ## 2.5.0
54
+
55
+ ### Added
56
+
57
+ - Added `getGrpcClient` entrypoint to access grpc-web client.
58
+ - Added `getSelectedChain` entrypoint to get the genesis hash of the chain selected in the wallet.
59
+
60
+ ### Deprecated
61
+
62
+ - `getJsonRpcClient` in favor of the new `getGrpcClient`.
63
+
64
+ ## 2.4.0
65
+
66
+ ### Added
67
+
68
+ - signMessage is now able to receive a SignMessageObject as the message in addition to a utf8 string.
69
+
70
+ ## 2.3.0
71
+
72
+ ### Added
73
+
74
+ - Added section for `requestIdProof` to README.
75
+
76
+ ### Fixed
77
+
78
+ - Type for smart contract parameters in sendTransaction.
79
+
80
+ ## 2.2.0
81
+
82
+ ### Added
83
+
84
+ - SendTransaction for smart contract transactions can receive schemas that are for the specific parameter. If the raw schema is given directly, it is assumed to be the schema of the module, like previously.
85
+
86
+ ## 2.1.0
87
+
88
+ ### Added
89
+
90
+ - Entrypoint to request zero knowledge proof for a list of statements.
91
+
92
+ ## 2.0.0
93
+
94
+ ### Added
95
+
96
+ - Entrypoint to suggest CIS-2 tokens to be added to the connected account's view.
97
+
98
+ ### (Breaking) Changed
99
+
100
+ - Updated web-sdk to version 3, which changes field names in some transaction payloads for sendTransaction entrypoint.
101
+
102
+ ## 1.0.0
103
+
104
+ ### Changed
105
+
106
+ - Fixed broken link + typos in README
107
+ - Removed parameters from smart contract types' payloads, due the wallet ignoring it in favor of separate arguments.
108
+
109
+ ## 0.2.0
110
+
111
+ ### Added
112
+
113
+ - Expose a JSON-RPC client, using the wallet's current JSON-RPC server.
114
+ - `getMostRecentlySelectedAccount` method. This method allows dApps to get the most prioritized account without using `connect`. In a future release it will be updated to actually return the most recently selected account.
115
+
116
+ ### (Breaking) Changed
117
+
118
+ - Updated API of sendTransaction and signMessage to require the account address.
119
+ - Updated API to include an 'accountDisconnected' event.
120
+
121
+ ## 0.1.1
122
+
123
+ - sendTransaction can now take a 5th argument, which is the schema's version. This will allow V1 contract parameters to be serialized.
124
+
125
+ ## 0.1.0
126
+
127
+ - Initialized from the old browser-wallet-api-types package.
128
+ - Added method for detecting the injected Concordium browser wallet API.
package/README.md CHANGED
@@ -294,3 +294,7 @@ const client = new ConcordiumGRPCClient(provider.grpcTransport);
294
294
  // The client can then be used to acccess the GRPC v2 API of the node used in the wallet.
295
295
  const accountInfo = await client.getAccountInfo(accountAddress);
296
296
  ```
297
+
298
+ ## Creating a release
299
+
300
+ - Push a tag `api-helpers/<version>`, where `<version>` is replaced with the version from [`package.json`](./package.json).
@@ -1,2 +1,2 @@
1
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.concordiumHelpers=o():e.concordiumHelpers=o()}(self,(()=>(()=>{"use strict";var e={611:(e,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.detectConcordiumProvider=async function(e=5e3){return new Promise(((o,n)=>{if(window.concordium)o(window.concordium);else{const t=setTimeout((()=>{window.concordium?o(window.concordium):n()}),e);window.addEventListener("concordium#initialized",(()=>{window.concordium&&(clearTimeout(t),o(window.concordium))}),{once:!0})}}))}},685:(e,o,n)=>{Object.defineProperty(o,"__esModule",{value:!0});var t={detectConcordiumProvider:!0};Object.defineProperty(o,"detectConcordiumProvider",{enumerable:!0,get:function(){return i.detectConcordiumProvider}});var r=n(740);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(t,e)||e in o&&o[e]===r[e]||Object.defineProperty(o,e,{enumerable:!0,get:function(){return r[e]}}))}));var c=n(996);Object.keys(c).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(t,e)||e in o&&o[e]===c[e]||Object.defineProperty(o,e,{enumerable:!0,get:function(){return c[e]}}))}));var i=n(611)},996:(e,o)=>{Object.defineProperty(o,"__esModule",{value:!0})},740:(e,o)=>{var n,t;Object.defineProperty(o,"__esModule",{value:!0}),o.SchemaType=o.EventType=void 0,o.EventType=n,function(e){e.AccountChanged="accountChanged",e.AccountDisconnected="accountDisconnected",e.ChainChanged="chainChanged"}(n||(o.EventType=n={})),o.SchemaType=t,function(e){e.Module="module",e.Parameter="parameter"}(t||(o.SchemaType=t={}))}},o={};return function n(t){var r=o[t];if(void 0!==r)return r.exports;var c=o[t]={exports:{}};return e[t](c,c.exports,n),c.exports}(685)})()));
1
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.concordiumHelpers=o():e.concordiumHelpers=o()}(self,()=>(()=>{"use strict";var e={488:(e,o,n)=>{Object.defineProperty(o,"__esModule",{value:!0});var t={detectConcordiumProvider:!0};Object.defineProperty(o,"detectConcordiumProvider",{enumerable:!0,get:function(){return i.detectConcordiumProvider}});var r=n(702);Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(t,e)||e in o&&o[e]===r[e]||Object.defineProperty(o,e,{enumerable:!0,get:function(){return r[e]}}))});var c=n(786);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(t,e)||e in o&&o[e]===c[e]||Object.defineProperty(o,e,{enumerable:!0,get:function(){return c[e]}}))});var i=n(972)},702:(e,o)=>{var n,t;Object.defineProperty(o,"__esModule",{value:!0}),o.SchemaType=o.EventType=void 0,o.EventType=n,function(e){e.AccountChanged="accountChanged",e.AccountDisconnected="accountDisconnected",e.ChainChanged="chainChanged"}(n||(o.EventType=n={})),o.SchemaType=t,function(e){e.Module="module",e.Parameter="parameter"}(t||(o.SchemaType=t={}))},786:(e,o)=>{Object.defineProperty(o,"__esModule",{value:!0})},972:(e,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.detectConcordiumProvider=async function(e=5e3){return new Promise((o,n)=>{if(window.concordium)o(window.concordium);else{const t=setTimeout(()=>{window.concordium?o(window.concordium):n()},e);window.addEventListener("concordium#initialized",()=>{window.concordium&&(clearTimeout(t),o(window.concordium))},{once:!0})}})}}},o={};return function n(t){var r=o[t];if(void 0!==r)return r.exports;var c=o[t]={exports:{}};return e[t](c,c.exports,n),c.exports}(488)})());
2
2
  //# sourceMappingURL=concordiumHelpers.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"concordiumHelpers.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAA2B,kBAAID,IAE/BD,EAAwB,kBAAIC,IAR9B,CASGK,MAAM,I,kHCHFC,eAAwCC,EAAU,KACrD,OAAO,IAAIC,SAAQ,CAACC,EAASC,KACzB,GAAIC,OAAOC,WACPH,EAAQE,OAAOC,gBAEd,CACD,MAAMC,EAAIC,YAAW,KACbH,OAAOC,WACPH,EAAQE,OAAOC,YAGfF,MAELH,GACHI,OAAOI,iBAAiB,0BAA0B,KAC1CJ,OAAOC,aACPI,aAAaH,GACbJ,EAAQE,OAAOC,eAEpB,CAAEK,MAAM,U,yNCzBvB,8NACA,8NACA,c,0ECCO,IAAIC,EAMAC,E,+FALX,SAAWD,GACPA,EAAS,eAAqB,iBAC9BA,EAAS,oBAA0B,sBACnCA,EAAS,aAAmB,eAHhC,CAIGA,IAAc,EAAAA,UAAAA,EAAY,K,eAE7B,SAAWC,GACPA,EAAU,OAAa,SACvBA,EAAU,UAAgB,YAF9B,CAGGA,IAAe,EAAAA,WAAAA,EAAa,OCZ3BC,EAA2B,G,OAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAatB,QAGrB,IAAIC,EAASkB,EAAyBE,GAAY,CAGjDrB,QAAS,IAOV,OAHAwB,EAAoBH,GAAUpB,EAAQA,EAAOD,QAASoB,GAG/CnB,EAAOD,QClBWoB,CAAoB,M","sources":["webpack:///webpack/universalModuleDefinition","webpack:///./lib/detector.js","webpack:///./lib/index.js","webpack:///./lib/wallet-api-types.js","webpack:///webpack/bootstrap","webpack:///webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"concordiumHelpers\"] = factory();\n\telse\n\t\troot[\"concordiumHelpers\"] = factory();\n})(self, () => {\nreturn ","/**\n * Detect the Concordium browser wallet API by waiting for it to have been successfully injected\n * into the window so that it is ready for use.\n * @param timeout determines how long to wait before rejecting if the Concordium provider is not available, in milliseconds.\n * @returns a promise containing the Concordium Wallet provider API.\n */\nexport async function detectConcordiumProvider(timeout = 5000) {\n return new Promise((resolve, reject) => {\n if (window.concordium) {\n resolve(window.concordium);\n }\n else {\n const t = setTimeout(() => {\n if (window.concordium) {\n resolve(window.concordium);\n }\n else {\n reject();\n }\n }, timeout);\n window.addEventListener('concordium#initialized', () => {\n if (window.concordium) {\n clearTimeout(t);\n resolve(window.concordium);\n }\n }, { once: true });\n }\n });\n}\n","export * from './wallet-api-types';\nexport * from './util';\nexport { detectConcordiumProvider } from './detector';\n","/**\n * An enumeration of the events that can be emitted by the WalletApi.\n */\nexport var EventType;\n(function (EventType) {\n EventType[\"AccountChanged\"] = \"accountChanged\";\n EventType[\"AccountDisconnected\"] = \"accountDisconnected\";\n EventType[\"ChainChanged\"] = \"chainChanged\";\n})(EventType || (EventType = {}));\nexport var SchemaType;\n(function (SchemaType) {\n SchemaType[\"Module\"] = \"module\";\n SchemaType[\"Parameter\"] = \"parameter\";\n})(SchemaType || (SchemaType = {}));\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(685);\n"],"names":["root","factory","exports","module","define","amd","self","async","timeout","Promise","resolve","reject","window","concordium","t","setTimeout","addEventListener","clearTimeout","once","EventType","SchemaType","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"concordiumHelpers.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAA2B,kBAAID,IAE/BD,EAAwB,kBAAIC,GAC7B,CATD,CASGK,KAAM,I,mPCTT,4NACA,4NACA,Y,cCCO,IAAIC,EAMAC,E,+FALX,SAAWD,GACPA,EAAS,eAAqB,iBAC9BA,EAAS,oBAA0B,sBACnCA,EAAS,aAAmB,cAHhC,EAIGA,IAAc,EAAAA,UAAAA,EAAY,CAAC,I,eAE9B,SAAWC,GACPA,EAAU,OAAa,SACvBA,EAAU,UAAgB,WAF9B,EAGGA,IAAe,EAAAA,WAAAA,EAAa,CAAC,G,wJCPzBC,eAAwCC,EAAU,KACrD,OAAO,IAAIC,QAAQ,CAACC,EAASC,KACzB,GAAIC,OAAOC,WACPH,EAAQE,OAAOC,gBAEd,CACD,MAAMC,EAAIC,WAAW,KACbH,OAAOC,WACPH,EAAQE,OAAOC,YAGfF,KAELH,GACHI,OAAOI,iBAAiB,yBAA0B,KAC1CJ,OAAOC,aACPI,aAAaH,GACbJ,EAAQE,OAAOC,cAEpB,CAAEK,MAAM,GACd,GAER,C,GC3BGC,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAatB,QAGrB,IAAIC,EAASkB,EAAyBE,GAAY,CAGjDrB,QAAS,CAAC,GAOX,OAHAwB,EAAoBH,GAAUpB,EAAQA,EAAOD,QAASoB,GAG/CnB,EAAOD,OACf,CCnB0BoB,CAAoB,I","sources":["webpack:///webpack/universalModuleDefinition","webpack:///./lib/index.js","webpack:///./lib/wallet-api-types.js","webpack:///./lib/detector.js","webpack:///webpack/bootstrap","webpack:///webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"concordiumHelpers\"] = factory();\n\telse\n\t\troot[\"concordiumHelpers\"] = factory();\n})(self, () => {\nreturn ","export * from './wallet-api-types';\nexport * from './util';\nexport { detectConcordiumProvider } from './detector';\n","/**\n * An enumeration of the events that can be emitted by the WalletApi.\n */\nexport var EventType;\n(function (EventType) {\n EventType[\"AccountChanged\"] = \"accountChanged\";\n EventType[\"AccountDisconnected\"] = \"accountDisconnected\";\n EventType[\"ChainChanged\"] = \"chainChanged\";\n})(EventType || (EventType = {}));\nexport var SchemaType;\n(function (SchemaType) {\n SchemaType[\"Module\"] = \"module\";\n SchemaType[\"Parameter\"] = \"parameter\";\n})(SchemaType || (SchemaType = {}));\n","/**\n * Detect the Concordium browser wallet API by waiting for it to have been successfully injected\n * into the window so that it is ready for use.\n * @param timeout determines how long to wait before rejecting if the Concordium provider is not available, in milliseconds.\n * @returns a promise containing the Concordium Wallet provider API.\n */\nexport async function detectConcordiumProvider(timeout = 5000) {\n return new Promise((resolve, reject) => {\n if (window.concordium) {\n resolve(window.concordium);\n }\n else {\n const t = setTimeout(() => {\n if (window.concordium) {\n resolve(window.concordium);\n }\n else {\n reject();\n }\n }, timeout);\n window.addEventListener('concordium#initialized', () => {\n if (window.concordium) {\n clearTimeout(t);\n resolve(window.concordium);\n }\n }, { once: true });\n }\n });\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(488);\n"],"names":["root","factory","exports","module","define","amd","self","EventType","SchemaType","async","timeout","Promise","resolve","reject","window","concordium","t","setTimeout","addEventListener","clearTimeout","once","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
@@ -1,4 +1,4 @@
1
- import type { AccountTransactionPayload, AccountTransactionSignature, AccountTransactionType, InitContractPayload, SchemaVersion, UpdateContractPayload, IdStatement, IdProofOutput, CredentialStatements, VerifiablePresentation, CredentialSubject, HexString, AccountAddress, Base58String, Base64String, ContractAddress, UpdateCredentialsPayload, RegisterDataPayload, SimpleTransferPayload, SimpleTransferWithMemoPayload, DeployModulePayload, ConfigureBakerPayload, ConfigureDelegationPayload } from '@concordium/web-sdk';
1
+ import type { AccountAddress, AccountTransactionInput, AccountTransactionSignature, AccountTransactionType, Base58String, Base64String, ConfigureBakerPayload, ConfigureDelegationPayload, ContractAddress, ContractName, CredentialStatements, CredentialSubject, DeployModulePayload, EntrypointName, HexString, IdProofOutput, IdStatement, InitContractInput, RegisterDataPayload, SchemaVersion, SimpleTransferPayload, SimpleTransferWithMemoPayload, TokenUpdatePayload, UpdateContractInput, UpdateCredentialsInput, VerifiablePresentation, Transaction } from '@concordium/web-sdk';
2
2
  import type { RpcTransport } from '@protobuf-ts/runtime-rpc';
3
3
  import { LaxNumberEnumValue, LaxStringEnumValue } from './util';
4
4
  export interface MetadataUrl {
@@ -29,9 +29,10 @@ export interface CredentialProof {
29
29
  type: 'Ed25519Signature2020';
30
30
  verificationMethod: string;
31
31
  }
32
- export type SendTransactionUpdateContractPayload = Omit<UpdateContractPayload, 'message'>;
33
- export type SendTransactionInitContractPayload = Omit<InitContractPayload, 'param'>;
34
- export type SendTransactionPayload = Exclude<AccountTransactionPayload, UpdateContractPayload | InitContractPayload> | SendTransactionUpdateContractPayload | SendTransactionInitContractPayload;
32
+ export type SendTransactionUpdateContractPayload = Omit<UpdateContractInput, 'message'>;
33
+ export type SendTransactionInitContractPayload = Omit<InitContractInput, 'param'>;
34
+ export type SendTransactionPayload = Exclude<AccountTransactionInput, UpdateContractInput | InitContractInput> | SendTransactionUpdateContractPayload | SendTransactionInitContractPayload;
35
+ export type SignableTransaction = Transaction.Signable;
35
36
  export type SmartContractParameters = {
36
37
  [key: string]: SmartContractParameters;
37
38
  } | SmartContractParameters[] | number | bigint | string | boolean;
@@ -97,7 +98,7 @@ interface MainWalletApi {
97
98
  * @param type the type of transaction that is to be signed and sent.
98
99
  * @param payload the payload of the transaction to be signed and sent. Note that for smart contract transactions, the payload should not contain the parameters, those should instead be provided in the subsequent argument instead.
99
100
  */
100
- sendTransaction(accountAddress: AccountAddressSource, type: LaxNumberEnumValue<AccountTransactionType.UpdateCredentials>, payload: UpdateCredentialsPayload): Promise<string>;
101
+ sendTransaction(accountAddress: AccountAddressSource, type: LaxNumberEnumValue<AccountTransactionType.UpdateCredentials>, payload: UpdateCredentialsInput): Promise<string>;
101
102
  /**
102
103
  * Sends a transaction to the Concordium Wallet and awaits the users action. Note that a header is not sent, and will be constructed by the wallet itself.
103
104
  * Note that if the user rejects signing the transaction, this will throw an error.
@@ -122,6 +123,14 @@ interface MainWalletApi {
122
123
  * @param payload the payload of the transaction to be signed and sent. Note that for smart contract transactions, the payload should not contain the parameters, those should instead be provided in the subsequent argument instead.
123
124
  */
124
125
  sendTransaction(accountAddress: AccountAddressSource, type: LaxNumberEnumValue<AccountTransactionType.TransferWithMemo>, payload: SimpleTransferWithMemoPayload): Promise<string>;
126
+ /**
127
+ * Sends a transaction to the Concordium Wallet and awaits the users action. Note that a header is not sent, and will be constructed by the wallet itself.
128
+ * Note that if the user rejects signing the transaction, this will throw an error.
129
+ * @param accountAddress the address of the account that should sign the transaction
130
+ * @param type the type of transaction that is to be signed and sent.
131
+ * @param payload the payload of the transaction to be signed and sent. Note that for smart contract transactions, the payload should not contain the parameters, those should instead be provided in the subsequent argument instead.
132
+ */
133
+ sendTransaction(accountAddress: AccountAddressSource, type: LaxNumberEnumValue<AccountTransactionType.TokenUpdate>, payload: TokenUpdatePayload): Promise<string>;
125
134
  /**
126
135
  * Sends a transaction to the Concordium Wallet and awaits the users action. Note that a header is not sent, and will be constructed by the wallet itself.
127
136
  * Note that if the user rejects signing the transaction, this will throw an error.
@@ -146,6 +155,14 @@ interface MainWalletApi {
146
155
  * @param payload the payload of the transaction to be signed and sent. Note that for smart contract transactions, the payload should not contain the parameters, those should instead be provided in the subsequent argument instead.
147
156
  */
148
157
  sendTransaction(accountAddress: AccountAddressSource, type: LaxNumberEnumValue<AccountTransactionType.ConfigureDelegation>, payload: ConfigureDelegationPayload): Promise<string>;
158
+ /**
159
+ * Sends a transaction signed by sponsor to the Concordium Wallet and awaits the users action.
160
+ * Note that a header is sent, and constructed by the sponsor.
161
+ * Note that if the user rejects signing the transaction, this will throw an error.
162
+ * @param accountAddress the address of the account that should sign the transaction
163
+ * @param transaction the sponsored transaction with header to be signed and sent.
164
+ */
165
+ sendSponsoredTransaction(accountAddress: AccountAddressSource, transaction: SignableTransaction): Promise<string>;
149
166
  /**
150
167
  * Sends a message to the Concordium Wallet and awaits the users action. If the user signs the message, this will resolve to the signature.
151
168
  * Note that if the user rejects signing the message, this will throw an error.
@@ -153,6 +170,20 @@ interface MainWalletApi {
153
170
  * @param message message to be signed. Note that the wallet will prepend some bytes to ensure the message cannot be a transaction. The message should either be a utf8 string or { @link SignMessageObject }.
154
171
  */
155
172
  signMessage(accountAddress: AccountAddressSource, message: string | SignMessageObject): Promise<AccountTransactionSignature>;
173
+ /**
174
+ * Sends a message of the CIS3 contract standard, to the Concordium Wallet and awaits the users action. If the user signs the message, this will resolve to the signature.
175
+ *
176
+ * @param contractAddress the {@link ContractAddress} of the contract
177
+ * @param contractName the {@link ContractName} of the contract
178
+ * @param entrypointName the {@link EntrypointName} of the contract
179
+ * @param nonce the nonce (CIS3 standard) that was part of the message that was signed
180
+ * @param expiryTimeSignature RFC 3339 format (e.g. 2030-08-08T05:15:00Z)
181
+ * @param accountAddress the address of the account that should sign the message
182
+ * @param payloadMessage payload message to be signed, complete CIS3 message will be created from provided parameters. Note that the wallet will prepend some bytes to ensure the message cannot be a transaction. The message should be { @link SignMessageObject }.
183
+ *
184
+ * @throws if the user rejects signing the message.
185
+ */
186
+ signCIS3Message(contractAddress: ContractAddress.Type, contractName: ContractName.Type, entrypointName: EntrypointName.Type, nonce: bigint | number, expiryTimeSignature: string, accountAddress: AccountAddressSource, payloadMessage: SignMessageObject): Promise<AccountTransactionSignature>;
156
187
  /**
157
188
  * Requests a connection to the Concordium wallet, prompting the user to either accept or reject the request.
158
189
  * If a connection has already been accepted for the url once the returned promise will resolve without prompting the user.
package/package.json CHANGED
@@ -1,49 +1,50 @@
1
1
  {
2
- "name": "@concordium/browser-wallet-api-helpers",
3
- "version": "3.0.1",
4
- "license": "Apache-2.0",
5
- "packageManager": "yarn@3.2.0",
6
- "main": "lib/index.js",
7
- "browser": "lib/concordiumHelpers.min.js",
8
- "types": "lib/index.d.ts",
9
- "cdn": "lib/concordiumHelpers.min.js",
10
- "exports": {
11
- ".": {
12
- "browser": "./lib/index.js",
13
- "import": "./lib/index.js",
14
- "types": "./lib/index.d.ts",
15
- "default": "./lib/index.js"
16
- }
17
- },
18
- "files": [
19
- "/lib/**/*"
20
- ],
21
- "repository": {
22
- "type": "git",
23
- "url": "https://github.com/Concordium/concordium-browser-wallet"
24
- },
25
- "author": {
26
- "name": "Concordium Software",
27
- "email": "support@concordium.software",
28
- "url": "https://concordium.com"
29
- },
30
- "dependencies": {
31
- "@protobuf-ts/runtime-rpc": "^2.9.1"
32
- },
33
- "devDependencies": {
34
- "@babel/core": "^7.17.10",
35
- "@babel/plugin-transform-modules-commonjs": "^7.12.1",
36
- "@babel/plugin-transform-runtime": "^7.12.1",
37
- "@babel/preset-env": "^7.12.1",
38
- "typescript": "^5.2.2",
39
- "webpack": "^5.72.0",
40
- "webpack-cli": "^4.9.2"
41
- },
42
- "peerDependencies": {
43
- "@concordium/web-sdk": "^7.0"
44
- },
45
- "scripts": {
46
- "build": "tsc && webpack",
47
- "build:api-helpers": "yarn build"
2
+ "name": "@concordium/browser-wallet-api-helpers",
3
+ "version": "3.1.0",
4
+ "license": "Apache-2.0",
5
+ "packageManager": "yarn@3.2.0",
6
+ "main": "lib/index.js",
7
+ "browser": "lib/concordiumHelpers.min.js",
8
+ "types": "lib/index.d.ts",
9
+ "cdn": "lib/concordiumHelpers.min.js",
10
+ "exports": {
11
+ ".": {
12
+ "browser": "./lib/index.js",
13
+ "import": "./lib/index.js",
14
+ "types": "./lib/index.d.ts",
15
+ "default": "./lib/index.js"
48
16
  }
49
- }
17
+ },
18
+ "files": [
19
+ "/lib/**/*"
20
+ ],
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/Concordium/concordium-browser-wallet"
24
+ },
25
+ "author": {
26
+ "name": "Concordium Software",
27
+ "email": "support@concordium.software",
28
+ "url": "https://concordium.com"
29
+ },
30
+ "dependencies": {
31
+ "@protobuf-ts/runtime-rpc": "^2.9.1"
32
+ },
33
+ "devDependencies": {
34
+ "@babel/core": "^7.17.10",
35
+ "@babel/plugin-transform-modules-commonjs": "^7.12.1",
36
+ "@babel/plugin-transform-runtime": "^7.12.1",
37
+ "@babel/preset-env": "^7.12.1",
38
+ "typescript": "^5.2.2",
39
+ "webpack": "^5.99.7",
40
+ "webpack-cli": "^4.9.2"
41
+ },
42
+ "peerDependencies": {
43
+ "@concordium/web-sdk": "^12.0.0",
44
+ "@protobuf-ts/runtime-rpc": "^2.9.1"
45
+ },
46
+ "scripts": {
47
+ "build": "tsc && webpack",
48
+ "build:api-helpers": "yarn build"
49
+ }
50
+ }