@wishknish/knishio-client-js 0.5.2 → 0.6.1
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/README.md +207 -274
- package/dist/client.iife.js +533 -0
- package/package.json +37 -79
- package/src/.babelrc +0 -22
- package/src/Atom.js +171 -132
- package/src/AtomMeta.js +76 -50
- package/src/AuthToken.js +38 -47
- package/src/KnishIOClient.js +934 -987
- package/src/Meta.js +15 -17
- package/src/Molecule.js +423 -494
- package/src/PolicyMeta.js +32 -41
- package/src/TokenUnit.js +30 -32
- package/src/Wallet.js +275 -265
- package/src/exception/AtomIndexException.js +4 -8
- package/src/exception/AtomsMissingException.js +4 -6
- package/src/exception/AuthorizationRejectedException.js +4 -5
- package/src/exception/BalanceInsufficientException.js +4 -8
- package/src/exception/BaseException.js +6 -8
- package/src/exception/BatchIdException.js +5 -7
- package/src/exception/CodeException.js +4 -8
- package/src/{libraries/ApolloLink/HttpLink.js → exception/DecryptionKeyException.js} +12 -15
- package/src/exception/InvalidResponseException.js +4 -5
- package/src/exception/MetaMissingException.js +4 -6
- package/src/exception/MolecularHashMismatchException.js +4 -6
- package/src/exception/MolecularHashMissingException.js +4 -5
- package/src/exception/NegativeAmountException.js +4 -5
- package/src/exception/PolicyInvalidException.js +4 -4
- package/src/exception/SignatureMalformedException.js +4 -5
- package/src/exception/SignatureMismatchException.js +4 -5
- package/src/exception/StackableUnitAmountException.js +4 -5
- package/src/exception/StackableUnitDecimalsException.js +4 -5
- package/src/exception/TransferBalanceException.js +4 -5
- package/src/exception/TransferMalformedException.js +4 -5
- package/src/exception/TransferMismatchedException.js +4 -5
- package/src/exception/TransferRemainderException.js +4 -5
- package/src/exception/TransferToSelfException.js +4 -5
- package/src/exception/TransferUnbalancedException.js +4 -5
- package/src/exception/UnauthenticatedException.js +4 -5
- package/src/{libraries/ApolloLink/AuthLink.js → exception/WalletCredentialException.js} +12 -40
- package/src/exception/WalletShadowException.js +4 -5
- package/src/exception/WrongTokenTypeException.js +4 -5
- package/src/exception/index.js +26 -26
- package/src/index.js +8 -10
- package/src/instance/Rules/Callback.js +91 -93
- package/src/instance/Rules/Condition.js +21 -23
- package/src/instance/Rules/Meta.js +13 -14
- package/src/instance/Rules/Rule.js +39 -43
- package/src/instance/Rules/exception/RuleArgumentException.js +4 -4
- package/src/libraries/CheckMolecule.js +253 -232
- package/src/libraries/Decimal.js +13 -17
- package/src/libraries/Dot.js +74 -48
- package/src/libraries/Hex.js +49 -54
- package/src/libraries/array.js +50 -41
- package/src/libraries/crypto.js +20 -27
- package/src/libraries/strings.js +58 -91
- package/src/libraries/urql/UrqlClientWrapper.js +166 -0
- package/src/mutation/Mutation.js +44 -25
- package/src/mutation/MutationActiveSession.js +12 -12
- package/src/mutation/MutationClaimShadowWallet.js +15 -17
- package/src/mutation/MutationCreateIdentifier.js +11 -12
- package/src/mutation/MutationCreateMeta.js +11 -12
- package/src/mutation/MutationCreateRule.js +11 -12
- package/src/mutation/MutationCreateToken.js +18 -13
- package/src/mutation/MutationCreateWallet.js +9 -11
- package/src/mutation/MutationDepositBufferToken.js +7 -9
- package/src/mutation/MutationLinkIdentifier.js +12 -14
- package/src/mutation/MutationProposeMolecule.js +24 -25
- package/src/mutation/MutationRequestAuthorization.js +9 -10
- package/src/mutation/MutationRequestAuthorizationGuest.js +12 -15
- package/src/mutation/MutationRequestTokens.js +11 -14
- package/src/mutation/MutationTransferTokens.js +11 -14
- package/src/mutation/MutationWithdrawBufferToken.js +7 -10
- package/src/query/Query.js +62 -36
- package/src/query/QueryActiveSession.js +11 -13
- package/src/query/QueryAtom.js +75 -76
- package/src/query/QueryBalance.js +11 -12
- package/src/query/QueryBatch.js +17 -14
- package/src/query/QueryBatchHistory.js +16 -13
- package/src/query/QueryContinuId.js +13 -10
- package/src/query/QueryMetaType.js +45 -57
- package/src/query/QueryMetaTypeViaAtom.js +49 -57
- package/src/query/QueryPolicy.js +11 -12
- package/src/query/QueryToken.js +11 -13
- package/src/query/QueryUserActivity.js +11 -13
- package/src/query/QueryWalletBundle.js +15 -47
- package/src/query/QueryWalletList.js +15 -16
- package/src/response/Response.js +29 -34
- package/src/response/ResponseActiveSession.js +6 -6
- package/src/response/ResponseAtom.js +29 -30
- package/src/response/ResponseAuthorizationGuest.js +17 -18
- package/src/response/ResponseBalance.js +12 -13
- package/src/response/ResponseClaimShadowWallet.js +1 -1
- package/src/response/ResponseContinuId.js +21 -22
- package/src/response/ResponseCreateIdentifier.js +1 -1
- package/src/response/ResponseCreateMeta.js +1 -1
- package/src/response/ResponseCreateRule.js +1 -1
- package/src/response/ResponseCreateToken.js +1 -1
- package/src/response/ResponseCreateWallet.js +1 -1
- package/src/response/ResponseLinkIdentifier.js +9 -10
- package/src/response/ResponseMetaBatch.js +6 -8
- package/src/response/ResponseMetaType.js +19 -20
- package/src/response/ResponseMetaTypeViaAtom.js +19 -19
- package/src/response/ResponsePolicy.js +14 -15
- package/src/response/ResponseProposeMolecule.js +27 -30
- package/src/response/ResponseQueryActiveSession.js +20 -23
- package/src/response/ResponseQueryUserActivity.js +11 -12
- package/src/response/ResponseRequestAuthorization.js +11 -16
- package/src/response/ResponseRequestAuthorizationGuest.js +18 -21
- package/src/response/ResponseRequestTokens.js +1 -1
- package/src/response/ResponseTransferTokens.js +8 -9
- package/src/response/ResponseWalletBundle.js +16 -17
- package/src/response/ResponseWalletList.js +44 -47
- package/src/subscribe/ActiveSessionSubscribe.js +5 -6
- package/src/subscribe/ActiveWalletSubscribe.js +5 -6
- package/src/subscribe/CreateMoleculeSubscribe.js +5 -5
- package/src/subscribe/Subscribe.js +26 -26
- package/src/subscribe/WalletStatusSubscribe.js +5 -6
- package/src/versions/HashAtom.js +78 -0
- package/src/versions/Version4.js +34 -0
- package/src/versions/index.js +5 -0
- package/dist/client.umd.js +0 -453
- package/src/httpClient/ApolloClient.js +0 -245
- package/src/libraries/ApolloLink/CipherLink.js +0 -117
- package/src/libraries/ApolloLink/Client.js +0 -231
- package/src/libraries/ApolloLink/PusherLink.js +0 -234
- package/src/libraries/ApolloLink/handler.js +0 -106
- package/src/libraries/Base58.js +0 -71
- package/src/libraries/Base64.js +0 -40
- package/src/libraries/BaseX.js +0 -91
- package/src/libraries/Soda.js +0 -93
- package/src/query/QueryMetaInstance.js +0 -99
- package/src/test/Test.js +0 -670
- package/src/test/TestTokenUnit.js +0 -340
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
-
import ResponseCreateMeta from '../response/ResponseCreateMeta'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
+
import ResponseCreateMeta from '../response/ResponseCreateMeta'
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Query for creating new Meta attached to some MetaType
|
|
@@ -60,20 +60,20 @@ export default class MutationCreateMeta extends MutationProposeMolecule {
|
|
|
60
60
|
* @param {array|object} meta
|
|
61
61
|
* @param {object} policy
|
|
62
62
|
*/
|
|
63
|
-
fillMolecule (
|
|
63
|
+
fillMolecule ({
|
|
64
64
|
metaType,
|
|
65
65
|
metaId,
|
|
66
66
|
meta,
|
|
67
67
|
policy
|
|
68
|
-
}
|
|
69
|
-
this.$__molecule.initMeta(
|
|
68
|
+
}) {
|
|
69
|
+
this.$__molecule.initMeta({
|
|
70
70
|
meta,
|
|
71
71
|
metaType,
|
|
72
72
|
metaId,
|
|
73
73
|
policy
|
|
74
|
-
}
|
|
75
|
-
this.$__molecule.sign(
|
|
76
|
-
this.$__molecule.check()
|
|
74
|
+
})
|
|
75
|
+
this.$__molecule.sign({})
|
|
76
|
+
this.$__molecule.check()
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
@@ -82,11 +82,10 @@ export default class MutationCreateMeta extends MutationProposeMolecule {
|
|
|
82
82
|
* @param {object} json
|
|
83
83
|
* @return {ResponseCreateMeta}
|
|
84
84
|
*/
|
|
85
|
-
createResponse (
|
|
86
|
-
return new ResponseCreateMeta(
|
|
85
|
+
createResponse (json) {
|
|
86
|
+
return new ResponseCreateMeta({
|
|
87
87
|
query: this,
|
|
88
88
|
json
|
|
89
|
-
}
|
|
89
|
+
})
|
|
90
90
|
}
|
|
91
|
-
|
|
92
91
|
}
|
|
@@ -45,9 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
-
import ResponseCreateRule from '../response/ResponseCreateRule'
|
|
50
|
-
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
+
import ResponseCreateRule from '../response/ResponseCreateRule'
|
|
51
50
|
|
|
52
51
|
/**
|
|
53
52
|
* Query for creating new Meta attached to some MetaType
|
|
@@ -60,20 +59,20 @@ export default class MutationCreateRule extends MutationProposeMolecule {
|
|
|
60
59
|
* @param {object[]} rule
|
|
61
60
|
* @param {object} policy
|
|
62
61
|
*/
|
|
63
|
-
fillMolecule (
|
|
62
|
+
fillMolecule ({
|
|
64
63
|
metaType,
|
|
65
64
|
metaId,
|
|
66
65
|
rule,
|
|
67
66
|
policy
|
|
68
|
-
}
|
|
69
|
-
this.$__molecule.createRule(
|
|
67
|
+
}) {
|
|
68
|
+
this.$__molecule.createRule({
|
|
70
69
|
metaType,
|
|
71
70
|
metaId,
|
|
72
71
|
rule,
|
|
73
72
|
policy
|
|
74
|
-
}
|
|
75
|
-
this.$__molecule.sign(
|
|
76
|
-
this.$__molecule.check()
|
|
73
|
+
})
|
|
74
|
+
this.$__molecule.sign({})
|
|
75
|
+
this.$__molecule.check()
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
/**
|
|
@@ -82,10 +81,10 @@ export default class MutationCreateRule extends MutationProposeMolecule {
|
|
|
82
81
|
* @param {object} json
|
|
83
82
|
* @return {ResponseCreateRule}
|
|
84
83
|
*/
|
|
85
|
-
createResponse (
|
|
86
|
-
return new ResponseCreateRule(
|
|
84
|
+
createResponse (json) {
|
|
85
|
+
return new ResponseCreateRule({
|
|
87
86
|
query: this,
|
|
88
87
|
json
|
|
89
|
-
}
|
|
88
|
+
})
|
|
90
89
|
}
|
|
91
90
|
}
|
|
@@ -45,26 +45,32 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
-
import ResponseCreateToken from '../response/ResponseCreateToken'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
+
import ResponseCreateToken from '../response/ResponseCreateToken'
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Query for creating new Tokens
|
|
53
53
|
*/
|
|
54
54
|
export default class MutationCreateToken extends MutationProposeMolecule {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
/**
|
|
56
|
+
* @param {Wallet|null} recipientWallet
|
|
57
|
+
* @param {number|null} amount
|
|
58
|
+
* @param {object|null} meta
|
|
59
|
+
*/
|
|
60
|
+
fillMolecule ({
|
|
57
61
|
recipientWallet,
|
|
58
62
|
amount,
|
|
59
63
|
meta = null
|
|
60
|
-
}
|
|
61
|
-
this.$__molecule.initTokenCreation(
|
|
64
|
+
}) {
|
|
65
|
+
this.$__molecule.initTokenCreation({
|
|
62
66
|
recipientWallet,
|
|
63
67
|
amount,
|
|
64
68
|
meta: meta || {}
|
|
65
|
-
}
|
|
66
|
-
this.$__molecule.sign(
|
|
67
|
-
|
|
69
|
+
})
|
|
70
|
+
this.$__molecule.sign({
|
|
71
|
+
bundle: recipientWallet.bundle
|
|
72
|
+
})
|
|
73
|
+
this.$__molecule.check()
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
/**
|
|
@@ -73,11 +79,10 @@ export default class MutationCreateToken extends MutationProposeMolecule {
|
|
|
73
79
|
* @param {object} json
|
|
74
80
|
* @return {ResponseCreateToken}
|
|
75
81
|
*/
|
|
76
|
-
createResponse (
|
|
77
|
-
return new ResponseCreateToken(
|
|
82
|
+
createResponse (json) {
|
|
83
|
+
return new ResponseCreateToken({
|
|
78
84
|
query: this,
|
|
79
85
|
json
|
|
80
|
-
}
|
|
86
|
+
})
|
|
81
87
|
}
|
|
82
|
-
|
|
83
88
|
}
|
|
@@ -45,18 +45,17 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
-
import ResponseCreateWallet from '../response/ResponseCreateWallet'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
+
import ResponseCreateWallet from '../response/ResponseCreateWallet'
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Query for creating new Wallets
|
|
53
53
|
*/
|
|
54
54
|
export default class MutationCreateWallet extends MutationProposeMolecule {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.$__molecule.
|
|
58
|
-
this.$__molecule.
|
|
59
|
-
this.$__molecule.check();
|
|
55
|
+
fillMolecule (wallet) {
|
|
56
|
+
this.$__molecule.initWalletCreation(wallet)
|
|
57
|
+
this.$__molecule.sign({})
|
|
58
|
+
this.$__molecule.check()
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
/**
|
|
@@ -65,11 +64,10 @@ export default class MutationCreateWallet extends MutationProposeMolecule {
|
|
|
65
64
|
* @param {object} json
|
|
66
65
|
* @return {ResponseCreateWallet}
|
|
67
66
|
*/
|
|
68
|
-
createResponse (
|
|
69
|
-
return new ResponseCreateWallet(
|
|
67
|
+
createResponse (json) {
|
|
68
|
+
return new ResponseCreateWallet({
|
|
70
69
|
query: this,
|
|
71
70
|
json
|
|
72
|
-
}
|
|
71
|
+
})
|
|
73
72
|
}
|
|
74
|
-
|
|
75
73
|
}
|
|
@@ -45,29 +45,27 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
*
|
|
52
52
|
*/
|
|
53
53
|
export default class MutationDepositBufferToken extends MutationProposeMolecule {
|
|
54
|
-
|
|
55
54
|
/**
|
|
56
55
|
* Fills the Molecule with provided wallet and amount data
|
|
57
56
|
*
|
|
58
57
|
* @param amount
|
|
59
58
|
* @param tradeRates
|
|
60
59
|
*/
|
|
61
|
-
fillMolecule (
|
|
60
|
+
fillMolecule ({
|
|
62
61
|
amount,
|
|
63
62
|
tradeRates
|
|
64
|
-
}
|
|
65
|
-
this.$__molecule.initDepositBuffer(
|
|
63
|
+
}) {
|
|
64
|
+
this.$__molecule.initDepositBuffer({
|
|
66
65
|
amount,
|
|
67
66
|
tradeRates
|
|
68
|
-
}
|
|
69
|
-
this.$__molecule.sign(
|
|
70
|
-
this.$__molecule.check(
|
|
67
|
+
})
|
|
68
|
+
this.$__molecule.sign({})
|
|
69
|
+
this.$__molecule.check(this.$__molecule.sourceWallet)
|
|
71
70
|
}
|
|
72
|
-
|
|
73
71
|
}
|
|
@@ -45,22 +45,21 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Mutation from '../mutation/Mutation'
|
|
49
|
-
import ResponseLinkIdentifier from '../response/ResponseLinkIdentifier'
|
|
50
|
-
import { gql } from '@
|
|
48
|
+
import Mutation from '../mutation/Mutation'
|
|
49
|
+
import ResponseLinkIdentifier from '../response/ResponseLinkIdentifier'
|
|
50
|
+
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Query for linking an Identifier to a Wallet Bundle
|
|
54
54
|
*/
|
|
55
55
|
export default class MutationLinkIdentifier extends Mutation {
|
|
56
|
-
|
|
57
56
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @param apolloClient
|
|
57
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
58
|
+
* @param {KnishIOClient} knishIOClient
|
|
61
59
|
*/
|
|
62
|
-
constructor (
|
|
63
|
-
super(
|
|
60
|
+
constructor (graphQLClient, knishIOClient) {
|
|
61
|
+
super(graphQLClient, knishIOClient)
|
|
62
|
+
|
|
64
63
|
this.$__query = gql`mutation( $bundle: String!, $type: String!, $content: String! ) {
|
|
65
64
|
LinkIdentifier( bundle: $bundle, type: $type, content: $content ) {
|
|
66
65
|
type,
|
|
@@ -69,7 +68,7 @@ export default class MutationLinkIdentifier extends Mutation {
|
|
|
69
68
|
set,
|
|
70
69
|
message
|
|
71
70
|
}
|
|
72
|
-
}
|
|
71
|
+
}`
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
/**
|
|
@@ -78,11 +77,10 @@ export default class MutationLinkIdentifier extends Mutation {
|
|
|
78
77
|
* @param {object} json
|
|
79
78
|
* @return {ResponseLinkIdentifier}
|
|
80
79
|
*/
|
|
81
|
-
createResponse (
|
|
82
|
-
return new ResponseLinkIdentifier(
|
|
80
|
+
createResponse (json) {
|
|
81
|
+
return new ResponseLinkIdentifier({
|
|
83
82
|
query: this,
|
|
84
83
|
json
|
|
85
|
-
}
|
|
84
|
+
})
|
|
86
85
|
}
|
|
87
|
-
|
|
88
86
|
}
|
|
@@ -45,21 +45,21 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import ResponseProposeMolecule from '../response/ResponseProposeMolecule'
|
|
49
|
-
import Mutation from './Mutation'
|
|
50
|
-
import { gql } from '@
|
|
51
|
-
|
|
48
|
+
import ResponseProposeMolecule from '../response/ResponseProposeMolecule'
|
|
49
|
+
import Mutation from './Mutation'
|
|
50
|
+
import { gql } from '@urql/core'
|
|
52
51
|
|
|
53
52
|
export default class MutationProposeMolecule extends Mutation {
|
|
54
53
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @param {
|
|
54
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
55
|
+
* @param {KnishIOClient} knishIOClient
|
|
57
56
|
* @param molecule
|
|
58
57
|
*/
|
|
59
|
-
constructor (
|
|
60
|
-
super(
|
|
61
|
-
|
|
62
|
-
this.$
|
|
58
|
+
constructor (graphQLClient, knishIOClient, molecule) {
|
|
59
|
+
super(graphQLClient, knishIOClient)
|
|
60
|
+
|
|
61
|
+
this.$__molecule = molecule
|
|
62
|
+
this.$__remainderWallet = null
|
|
63
63
|
this.$__query = gql`mutation( $molecule: MoleculeInput! ) {
|
|
64
64
|
ProposeMolecule( molecule: $molecule ) {
|
|
65
65
|
molecularHash,
|
|
@@ -73,7 +73,7 @@ export default class MutationProposeMolecule extends Mutation {
|
|
|
73
73
|
processedAt,
|
|
74
74
|
broadcastedAt,
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}`
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
@@ -82,10 +82,10 @@ export default class MutationProposeMolecule extends Mutation {
|
|
|
82
82
|
* @param {object} variables
|
|
83
83
|
* @return {object}
|
|
84
84
|
*/
|
|
85
|
-
compiledVariables (
|
|
86
|
-
const _variables = super.compiledVariables(
|
|
85
|
+
compiledVariables (variables) {
|
|
86
|
+
const _variables = super.compiledVariables(variables)
|
|
87
87
|
|
|
88
|
-
return { ..._variables, ...{ molecule: this.molecule() } }
|
|
88
|
+
return { ..._variables, ...{ molecule: this.molecule() } }
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/**
|
|
@@ -94,11 +94,11 @@ export default class MutationProposeMolecule extends Mutation {
|
|
|
94
94
|
* @param {object} json
|
|
95
95
|
* @return {ResponseProposeMolecule}
|
|
96
96
|
*/
|
|
97
|
-
createResponse (
|
|
98
|
-
return new ResponseProposeMolecule(
|
|
97
|
+
createResponse (json) {
|
|
98
|
+
return new ResponseProposeMolecule({
|
|
99
99
|
query: this,
|
|
100
100
|
json
|
|
101
|
-
}
|
|
101
|
+
})
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/**
|
|
@@ -107,13 +107,13 @@ export default class MutationProposeMolecule extends Mutation {
|
|
|
107
107
|
* @param {object} variables
|
|
108
108
|
* @return {Promise}
|
|
109
109
|
*/
|
|
110
|
-
async execute (
|
|
111
|
-
variables = variables || {}
|
|
112
|
-
variables.molecule = this.molecule()
|
|
110
|
+
async execute ({ variables = null }) {
|
|
111
|
+
variables = variables || {}
|
|
112
|
+
variables.molecule = this.molecule()
|
|
113
113
|
|
|
114
|
-
return super.execute(
|
|
114
|
+
return super.execute({
|
|
115
115
|
variables
|
|
116
|
-
}
|
|
116
|
+
})
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/**
|
|
@@ -122,7 +122,7 @@ export default class MutationProposeMolecule extends Mutation {
|
|
|
122
122
|
* @return {null}
|
|
123
123
|
*/
|
|
124
124
|
remainderWallet () {
|
|
125
|
-
return this.$__remainderWallet
|
|
125
|
+
return this.$__remainderWallet
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
@@ -131,7 +131,6 @@ export default class MutationProposeMolecule extends Mutation {
|
|
|
131
131
|
* @return {Molecule}
|
|
132
132
|
*/
|
|
133
133
|
molecule () {
|
|
134
|
-
return this.$__molecule
|
|
134
|
+
return this.$__molecule
|
|
135
135
|
}
|
|
136
|
-
|
|
137
136
|
}
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
-
import ResponseRequestAuthorization from '../response/ResponseRequestAuthorization'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
+
import ResponseRequestAuthorization from '../response/ResponseRequestAuthorization'
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Query for requesting an authorization token from the node
|
|
@@ -56,10 +56,10 @@ export default class MutationRequestAuthorization extends MutationProposeMolecul
|
|
|
56
56
|
*
|
|
57
57
|
* @param {object} meta
|
|
58
58
|
*/
|
|
59
|
-
fillMolecule (
|
|
60
|
-
this.$__molecule.initAuthorization(
|
|
61
|
-
this.$__molecule.sign(
|
|
62
|
-
this.$__molecule.check()
|
|
59
|
+
fillMolecule ({ meta }) {
|
|
60
|
+
this.$__molecule.initAuthorization({ meta })
|
|
61
|
+
this.$__molecule.sign({})
|
|
62
|
+
this.$__molecule.check()
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -68,11 +68,10 @@ export default class MutationRequestAuthorization extends MutationProposeMolecul
|
|
|
68
68
|
* @param {object} json
|
|
69
69
|
* @return {ResponseRequestAuthorization}
|
|
70
70
|
*/
|
|
71
|
-
createResponse (
|
|
72
|
-
return new ResponseRequestAuthorization(
|
|
71
|
+
createResponse (json) {
|
|
72
|
+
return new ResponseRequestAuthorization({
|
|
73
73
|
query: this,
|
|
74
74
|
json
|
|
75
|
-
}
|
|
75
|
+
})
|
|
76
76
|
}
|
|
77
|
-
|
|
78
77
|
}
|
|
@@ -45,40 +45,37 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
|
|
48
|
+
import Mutation from '../mutation/Mutation'
|
|
49
|
+
import ResponseRequestAuthorizationGuest from '../response/ResponseRequestAuthorizationGuest'
|
|
50
|
+
import { gql } from '@urql/core'
|
|
52
51
|
|
|
53
52
|
export default class MutationRequestAuthorizationGuest extends Mutation {
|
|
54
53
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @param apolloClient
|
|
54
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
55
|
+
* @param {KnishIOClient} knishIOClient
|
|
58
56
|
*/
|
|
59
|
-
constructor (
|
|
60
|
-
super(
|
|
57
|
+
constructor (graphQLClient, knishIOClient) {
|
|
58
|
+
super(graphQLClient, knishIOClient)
|
|
59
|
+
|
|
61
60
|
this.$__query = gql`mutation( $cellSlug: String, $pubkey: String, $encrypt: Boolean ) {
|
|
62
61
|
AccessToken( cellSlug: $cellSlug, pubkey: $pubkey, encrypt: $encrypt ) {
|
|
63
62
|
token,
|
|
64
63
|
pubkey,
|
|
65
64
|
expiresAt
|
|
66
65
|
}
|
|
67
|
-
}
|
|
66
|
+
}`
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
|
|
71
69
|
/**
|
|
72
70
|
* Returns a Response object
|
|
73
71
|
*
|
|
74
72
|
* @param {object} json
|
|
75
73
|
* @return {ResponseRequestAuthorizationGuest}
|
|
76
74
|
*/
|
|
77
|
-
createResponse (
|
|
78
|
-
return new ResponseRequestAuthorizationGuest(
|
|
75
|
+
createResponse (json) {
|
|
76
|
+
return new ResponseRequestAuthorizationGuest({
|
|
79
77
|
query: this,
|
|
80
78
|
json
|
|
81
|
-
}
|
|
79
|
+
})
|
|
82
80
|
}
|
|
83
|
-
|
|
84
81
|
}
|
|
@@ -45,9 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
-
import ResponseRequestTokens from '../response/ResponseRequestTokens'
|
|
50
|
-
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
+
import ResponseRequestTokens from '../response/ResponseRequestTokens'
|
|
51
50
|
|
|
52
51
|
export default class MutationRequestTokens extends MutationProposeMolecule {
|
|
53
52
|
/**
|
|
@@ -60,25 +59,24 @@ export default class MutationRequestTokens extends MutationProposeMolecule {
|
|
|
60
59
|
* @param {object} meta
|
|
61
60
|
* @param {string|null} batchId
|
|
62
61
|
*/
|
|
63
|
-
fillMolecule (
|
|
62
|
+
fillMolecule ({
|
|
64
63
|
token,
|
|
65
64
|
amount,
|
|
66
65
|
metaType,
|
|
67
66
|
metaId,
|
|
68
67
|
meta = null,
|
|
69
68
|
batchId = null
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
this.$__molecule.initTokenRequest( {
|
|
69
|
+
}) {
|
|
70
|
+
this.$__molecule.initTokenRequest({
|
|
73
71
|
token,
|
|
74
72
|
amount,
|
|
75
73
|
metaType,
|
|
76
74
|
metaId,
|
|
77
75
|
meta: meta || {},
|
|
78
76
|
batchId
|
|
79
|
-
}
|
|
80
|
-
this.$__molecule.sign(
|
|
81
|
-
this.$__molecule.check()
|
|
77
|
+
})
|
|
78
|
+
this.$__molecule.sign({})
|
|
79
|
+
this.$__molecule.check()
|
|
82
80
|
}
|
|
83
81
|
|
|
84
82
|
/**
|
|
@@ -87,11 +85,10 @@ export default class MutationRequestTokens extends MutationProposeMolecule {
|
|
|
87
85
|
* @param {object} json
|
|
88
86
|
* @return {ResponseRequestTokens}
|
|
89
87
|
*/
|
|
90
|
-
createResponse (
|
|
91
|
-
return new ResponseRequestTokens(
|
|
88
|
+
createResponse (json) {
|
|
89
|
+
return new ResponseRequestTokens({
|
|
92
90
|
query: this,
|
|
93
91
|
json
|
|
94
|
-
}
|
|
92
|
+
})
|
|
95
93
|
}
|
|
96
|
-
|
|
97
94
|
}
|
|
@@ -45,31 +45,29 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
-
import ResponseTransferTokens from '../response/ResponseTransferTokens'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
+
import ResponseTransferTokens from '../response/ResponseTransferTokens'
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Query for moving tokens between wallets
|
|
53
53
|
*/
|
|
54
54
|
export default class MutationTransferTokens extends MutationProposeMolecule {
|
|
55
|
-
|
|
56
55
|
/**
|
|
57
56
|
* Fills the Molecule with provided wallet and amount data
|
|
58
57
|
*
|
|
59
58
|
* @param recipientWallet
|
|
60
59
|
* @param amount
|
|
61
60
|
*/
|
|
62
|
-
fillMolecule (
|
|
61
|
+
fillMolecule ({
|
|
63
62
|
recipientWallet,
|
|
64
63
|
amount
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
this.$__molecule.initValue( {
|
|
64
|
+
}) {
|
|
65
|
+
this.$__molecule.initValue({
|
|
68
66
|
recipientWallet,
|
|
69
67
|
amount
|
|
70
|
-
}
|
|
71
|
-
this.$__molecule.sign(
|
|
72
|
-
this.$__molecule.check(
|
|
68
|
+
})
|
|
69
|
+
this.$__molecule.sign({})
|
|
70
|
+
this.$__molecule.check(this.$__molecule.sourceWallet)
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
/**
|
|
@@ -78,11 +76,10 @@ export default class MutationTransferTokens extends MutationProposeMolecule {
|
|
|
78
76
|
* @param {object} json
|
|
79
77
|
* @return {ResponseTransferTokens}
|
|
80
78
|
*/
|
|
81
|
-
createResponse (
|
|
82
|
-
return new ResponseTransferTokens(
|
|
79
|
+
createResponse (json) {
|
|
80
|
+
return new ResponseTransferTokens({
|
|
83
81
|
query: this,
|
|
84
82
|
json
|
|
85
|
-
}
|
|
83
|
+
})
|
|
86
84
|
}
|
|
87
|
-
|
|
88
85
|
}
|
|
@@ -45,29 +45,26 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
*
|
|
52
52
|
*/
|
|
53
53
|
export default class MutationWithdrawBufferToken extends MutationProposeMolecule {
|
|
54
|
-
|
|
55
54
|
/**
|
|
56
55
|
*
|
|
57
56
|
* @param recipients
|
|
58
57
|
* @param signingWallet
|
|
59
58
|
*/
|
|
60
|
-
fillMolecule (
|
|
59
|
+
fillMolecule ({
|
|
61
60
|
recipients,
|
|
62
61
|
signingWallet
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
this.$__molecule.initWithdrawBuffer( {
|
|
62
|
+
}) {
|
|
63
|
+
this.$__molecule.initWithdrawBuffer({
|
|
66
64
|
recipients,
|
|
67
65
|
signingWallet
|
|
68
|
-
}
|
|
69
|
-
this.$__molecule.sign(
|
|
70
|
-
this.$__molecule.check(
|
|
66
|
+
})
|
|
67
|
+
this.$__molecule.sign({})
|
|
68
|
+
this.$__molecule.check(this.$__molecule.sourceWallet)
|
|
71
69
|
}
|
|
72
|
-
|
|
73
70
|
}
|