@coinflowlabs/react 1.2.0 → 2.0.0-sandbox-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/README.md +6 -0
- package/build/cjs/CoinflowIFrame.d.ts +4 -2
- package/build/cjs/CoinflowIFrame.js +8 -18
- package/build/cjs/CoinflowIFrame.js.map +1 -1
- package/build/cjs/CoinflowPurchase.d.ts +30 -3
- package/build/cjs/CoinflowPurchase.js +36 -8
- package/build/cjs/CoinflowPurchase.js.map +1 -1
- package/build/cjs/CoinflowPurchaseHistory.js +7 -7
- package/build/cjs/CoinflowPurchaseHistory.js.map +1 -1
- package/build/cjs/CoinflowUtils.d.ts +7 -15
- package/build/cjs/CoinflowUtils.js +12 -7
- package/build/cjs/CoinflowUtils.js.map +1 -1
- package/build/cjs/CoinflowWithdraw.d.ts +7 -3
- package/build/cjs/CoinflowWithdraw.js +12 -11
- package/build/cjs/CoinflowWithdraw.js.map +1 -1
- package/build/cjs/CoinflowWithdrawHistory.js +10 -10
- package/build/cjs/CoinflowWithdrawHistory.js.map +1 -1
- package/build/cjs/CommonCoinflowProps.d.ts +5 -1
- package/build/cjs/CommonCoinflowProps.js +1 -1
- package/build/cjs/EthIFrameMessageHandlers.d.ts +3 -1
- package/build/cjs/EthIFrameMessageHandlers.js +16 -17
- package/build/cjs/EthIFrameMessageHandlers.js.map +1 -1
- package/build/cjs/NearIFrameMessageHandlers.js +1 -22
- package/build/cjs/NearIFrameMessageHandlers.js.map +1 -1
- package/build/cjs/SolanaIFrameMessageHandlers.d.ts +2 -2
- package/build/cjs/SolanaIFrameMessageHandlers.js +56 -73
- package/build/cjs/SolanaIFrameMessageHandlers.js.map +1 -1
- package/build/cjs/index.js +1 -1
- package/build/cjs/useIframeWallet.d.ts +1 -1
- package/build/cjs/useIframeWallet.js +24 -21
- package/build/cjs/useIframeWallet.js.map +1 -1
- package/build/esm/CoinflowIFrame.d.ts +4 -2
- package/build/esm/CoinflowIFrame.js +6 -16
- package/build/esm/CoinflowIFrame.js.map +1 -1
- package/build/esm/CoinflowPurchase.d.ts +30 -3
- package/build/esm/CoinflowPurchase.js +31 -4
- package/build/esm/CoinflowPurchase.js.map +1 -1
- package/build/esm/CoinflowPurchaseHistory.js +3 -3
- package/build/esm/CoinflowUtils.d.ts +7 -15
- package/build/esm/CoinflowUtils.js +11 -6
- package/build/esm/CoinflowUtils.js.map +1 -1
- package/build/esm/CoinflowWithdraw.d.ts +7 -3
- package/build/esm/CoinflowWithdraw.js +7 -6
- package/build/esm/CoinflowWithdraw.js.map +1 -1
- package/build/esm/CoinflowWithdrawHistory.js +4 -4
- package/build/esm/CommonCoinflowProps.d.ts +5 -1
- package/build/esm/EthIFrameMessageHandlers.d.ts +3 -1
- package/build/esm/EthIFrameMessageHandlers.js +15 -16
- package/build/esm/EthIFrameMessageHandlers.js.map +1 -1
- package/build/esm/NearIFrameMessageHandlers.js +0 -21
- package/build/esm/NearIFrameMessageHandlers.js.map +1 -1
- package/build/esm/SolanaIFrameMessageHandlers.d.ts +2 -2
- package/build/esm/SolanaIFrameMessageHandlers.js +54 -71
- package/build/esm/SolanaIFrameMessageHandlers.js.map +1 -1
- package/build/esm/useIframeWallet.d.ts +1 -1
- package/build/esm/useIframeWallet.js +23 -20
- package/build/esm/useIframeWallet.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +10 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CoinflowBlockchain, CoinflowEnvs, EthWallet, NearWallet, SolanaWalletContextState } from './CoinflowUtils';
|
|
2
|
-
import { Connection } from '@solana/web3.js';
|
|
2
|
+
import type { Connection } from '@solana/web3.js';
|
|
3
3
|
export interface CommonCoinflowProps {
|
|
4
4
|
merchantId: string;
|
|
5
5
|
env?: CoinflowEnvs;
|
|
@@ -19,3 +19,7 @@ export interface CoinflowEthHistoryProps extends CommonCoinflowProps {
|
|
|
19
19
|
wallet: EthWallet;
|
|
20
20
|
blockchain: 'eth';
|
|
21
21
|
}
|
|
22
|
+
export interface CoinflowPolygonHistoryProps extends CommonCoinflowProps {
|
|
23
|
+
wallet: EthWallet;
|
|
24
|
+
blockchain: 'polygon';
|
|
25
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { IFrameMessageHandlers } from './SolanaIFrameMessageHandlers';
|
|
2
2
|
import { EthWallet } from './CoinflowUtils';
|
|
3
|
+
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
3
4
|
export declare function useEthIFrameMessageHandlers({ wallet, }: {
|
|
4
|
-
wallet: EthWallet
|
|
5
|
+
wallet: PartialBy<EthWallet, 'signMessage'>;
|
|
5
6
|
}): IFrameMessageHandlers;
|
|
7
|
+
export {};
|
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useEthIFrameMessageHandlers = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = require("react");
|
|
6
6
|
function useEthIFrameMessageHandlers(_a) {
|
|
7
7
|
var _this = this;
|
|
8
8
|
var wallet = _a.wallet;
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var handleSendTransaction = (0, react_1.useCallback)(function (_a) {
|
|
10
|
+
var data = _a.data;
|
|
11
11
|
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
12
|
-
var
|
|
12
|
+
var transaction, hash;
|
|
13
13
|
return tslib_1.__generator(this, function (_b) {
|
|
14
14
|
switch (_b.label) {
|
|
15
|
-
case 0:
|
|
15
|
+
case 0:
|
|
16
|
+
transaction = JSON.parse(Buffer.from(data, 'base64').toString());
|
|
17
|
+
return [4 /*yield*/, wallet.sendTransaction(transaction)];
|
|
16
18
|
case 1:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
throw new Error('Wallet did not sign');
|
|
20
|
-
return [2 /*return*/, signedMessage];
|
|
19
|
+
hash = (_b.sent()).hash;
|
|
20
|
+
return [2 /*return*/, hash];
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
}, [wallet]);
|
|
25
|
-
var
|
|
25
|
+
var handleSignMessage = (0, react_1.useCallback)(function (_a) {
|
|
26
26
|
var data = _a.data;
|
|
27
27
|
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
28
|
-
var transaction, hash;
|
|
29
28
|
return tslib_1.__generator(this, function (_b) {
|
|
30
29
|
switch (_b.label) {
|
|
31
30
|
case 0:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
console.log('handleSignMessage');
|
|
32
|
+
if (!wallet.signMessage)
|
|
33
|
+
throw new Error('Wallet does not support message signing!');
|
|
34
|
+
return [4 /*yield*/, wallet.signMessage(data)];
|
|
35
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
38
|
});
|
|
40
39
|
}, [wallet]);
|
|
41
40
|
return {
|
|
42
41
|
handleSendTransaction: handleSendTransaction,
|
|
43
|
-
handleSignMessage: handleSignMessage
|
|
42
|
+
handleSignMessage: handleSignMessage,
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
45
|
exports.useEthIFrameMessageHandlers = useEthIFrameMessageHandlers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthIFrameMessageHandlers.js","sourceRoot":"","sources":["../../src/EthIFrameMessageHandlers.ts"],"names":[],"mappings":";;;;AAAA,+BAAkC;
|
|
1
|
+
{"version":3,"file":"EthIFrameMessageHandlers.js","sourceRoot":"","sources":["../../src/EthIFrameMessageHandlers.ts"],"names":[],"mappings":";;;;AAAA,+BAAkC;AAMlC,SAAgB,2BAA2B,CAAC,EAI3C;IAJD,iBA6BC;QA5BC,MAAM,YAAA;IAIN,IAAM,qBAAqB,GAAG,IAAA,mBAAW,EACvC,UAAO,EAAkB;YAAjB,IAAI,UAAA;;;;;;wBACJ,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;wBACxD,qBAAM,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,EAAA;;wBAAjD,IAAI,GAAI,CAAA,SAAyC,CAAA,KAA7C;wBACX,sBAAO,IAAI,EAAC;;;;KACb,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,IAAM,iBAAiB,GAAG,IAAA,mBAAW,EACnC,UAAO,EAAkB;YAAjB,IAAI,UAAA;;;;;wBACV,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;wBACjC,IAAI,CAAC,MAAM,CAAC,WAAW;4BACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;wBAEvD,qBAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAA;4BAArC,sBAAO,SAA8B,EAAC;;;;KACvC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO;QACL,qBAAqB,uBAAA;QACrB,iBAAiB,mBAAA;KAClB,CAAC;AACJ,CAAC;AA7BD,kEA6BC"}
|
|
@@ -1,31 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useNearIFrameMessageHandlers = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = require("react");
|
|
6
6
|
function useNearIFrameMessageHandlers(_a) {
|
|
7
7
|
var _this = this;
|
|
8
8
|
var wallet = _a.wallet;
|
|
9
|
-
var handleSignMessage = (0, react_1.useCallback)(function (_a) {
|
|
10
|
-
var data = _a.data;
|
|
11
|
-
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
12
|
-
var message, owner;
|
|
13
|
-
return tslib_1.__generator(this, function (_b) {
|
|
14
|
-
switch (_b.label) {
|
|
15
|
-
case 0:
|
|
16
|
-
message = data;
|
|
17
|
-
return [4 /*yield*/, wallet.verifyOwner({
|
|
18
|
-
message: message
|
|
19
|
-
})];
|
|
20
|
-
case 1:
|
|
21
|
-
owner = _b.sent();
|
|
22
|
-
if (!owner)
|
|
23
|
-
throw new Error('Wallet did not sign');
|
|
24
|
-
return [2 /*return*/, JSON.stringify(owner)];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
}, [wallet]);
|
|
29
9
|
var handleSendTransaction = (0, react_1.useCallback)(function (_a) {
|
|
30
10
|
var data = _a.data;
|
|
31
11
|
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
@@ -47,7 +27,6 @@ function useNearIFrameMessageHandlers(_a) {
|
|
|
47
27
|
}, [wallet]);
|
|
48
28
|
return {
|
|
49
29
|
handleSendTransaction: handleSendTransaction,
|
|
50
|
-
handleSignMessage: handleSignMessage
|
|
51
30
|
};
|
|
52
31
|
}
|
|
53
32
|
exports.useNearIFrameMessageHandlers = useNearIFrameMessageHandlers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NearIFrameMessageHandlers.js","sourceRoot":"","sources":["../../src/NearIFrameMessageHandlers.ts"],"names":[],"mappings":";;;;AAAA,+BAAkC;AAIlC,SAAgB,4BAA4B,CAAC,EAI5C;IAJD,
|
|
1
|
+
{"version":3,"file":"NearIFrameMessageHandlers.js","sourceRoot":"","sources":["../../src/NearIFrameMessageHandlers.ts"],"names":[],"mappings":";;;;AAAA,+BAAkC;AAIlC,SAAgB,4BAA4B,CAAC,EAI5C;IAJD,iBAmBC;QAlBC,MAAM,YAAA;IAIN,IAAM,qBAAqB,GAAG,IAAA,mBAAW,EACvC,UAAO,EAAkB;YAAjB,IAAI,UAAA;;;;;;wBACJ,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;wBACzC,qBAAM,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAA;;wBAA9D,gBAAgB,GAAG,SAA2C;wBACpE,IAAI,CAAC,gBAAgB;4BAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;wBAC/C,iBAAiB,GAAI,gBAAgB,YAApB,CAAqB;wBAC1D,sBAAO,iBAAiB,CAAC,IAAI,EAAC;;;;KAC/B,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO;QACL,qBAAqB,uBAAA;KACtB,CAAC;AACJ,CAAC;AAnBD,oEAmBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Connection, Signer } from '@solana/web3.js';
|
|
1
|
+
import type { Connection, Signer } from '@solana/web3.js';
|
|
2
2
|
import { SolanaWalletContextState } from './CoinflowUtils';
|
|
3
3
|
export type WalletCall = {
|
|
4
4
|
method: string;
|
|
@@ -11,8 +11,8 @@ export type SolanaIFrameWalletProps = {
|
|
|
11
11
|
debugTx?: boolean;
|
|
12
12
|
};
|
|
13
13
|
export type IFrameMessageHandlers = {
|
|
14
|
+
handleSignMessage?: ({ data }: WalletCall) => Promise<string>;
|
|
14
15
|
handleSignTransaction?: ({ data }: WalletCall) => Promise<string>;
|
|
15
16
|
handleSendTransaction: ({ data }: WalletCall) => Promise<string>;
|
|
16
|
-
handleSignMessage: ({ data }: WalletCall) => Promise<string>;
|
|
17
17
|
};
|
|
18
18
|
export declare function useSolanaIFrameMessageHandlers({ wallet, connection, partialSigners, debugTx, }: SolanaIFrameWalletProps): IFrameMessageHandlers;
|
|
@@ -1,93 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSolanaIFrameMessageHandlers = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = require("react");
|
|
6
6
|
var bs58_1 = tslib_1.__importDefault(require("bs58"));
|
|
7
|
-
var
|
|
7
|
+
var web3 = tslib_1.__importStar(require("@solana/web3.js"));
|
|
8
8
|
function useSolanaIFrameMessageHandlers(_a) {
|
|
9
9
|
var _this = this;
|
|
10
10
|
var wallet = _a.wallet, connection = _a.connection, partialSigners = _a.partialSigners, _b = _a.debugTx, debugTx = _b === void 0 ? false : _b;
|
|
11
|
-
var handleSignMessage = (0, react_1.useCallback)(function (_a) {
|
|
12
|
-
var data = _a.data;
|
|
13
|
-
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
14
|
-
var signature;
|
|
15
|
-
return tslib_1.__generator(this, function (_b) {
|
|
16
|
-
switch (_b.label) {
|
|
17
|
-
case 0:
|
|
18
|
-
if (!wallet.signMessage)
|
|
19
|
-
throw new Error('Wallet does not support message signing');
|
|
20
|
-
return [4 /*yield*/, wallet.signMessage(bs58_1["default"].decode(data))];
|
|
21
|
-
case 1:
|
|
22
|
-
signature = _b.sent();
|
|
23
|
-
return [2 /*return*/, bs58_1["default"].encode(signature)];
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}, [wallet]);
|
|
28
11
|
var sendTransactionDebug = (0, react_1.useCallback)(function (tx) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
29
|
-
var signedTx, serializedTx, signature;
|
|
30
|
-
|
|
31
|
-
|
|
12
|
+
var signedTx, serializedTx, simulation, _i, _a, log, signature;
|
|
13
|
+
var _b;
|
|
14
|
+
return tslib_1.__generator(this, function (_c) {
|
|
15
|
+
switch (_c.label) {
|
|
32
16
|
case 0:
|
|
33
17
|
if (!wallet.signTransaction)
|
|
34
18
|
throw new Error('Wallet does not support sign transaction');
|
|
35
19
|
return [4 /*yield*/, wallet.signTransaction(tx)];
|
|
36
20
|
case 1:
|
|
37
|
-
signedTx =
|
|
21
|
+
signedTx = _c.sent();
|
|
38
22
|
serializedTx = signedTx.serialize();
|
|
23
|
+
return [4 /*yield*/, connection.simulateTransaction(signedTx)];
|
|
24
|
+
case 2:
|
|
25
|
+
simulation = (_c.sent()).value;
|
|
26
|
+
console.log('simulation logs:');
|
|
27
|
+
for (_i = 0, _a = (_b = simulation.logs) !== null && _b !== void 0 ? _b : []; _i < _a.length; _i++) {
|
|
28
|
+
log = _a[_i];
|
|
29
|
+
console.log(log);
|
|
30
|
+
}
|
|
39
31
|
return [4 /*yield*/, connection.sendRawTransaction(serializedTx, {
|
|
40
|
-
skipPreflight: true
|
|
32
|
+
skipPreflight: true,
|
|
41
33
|
})];
|
|
42
|
-
case
|
|
43
|
-
signature =
|
|
34
|
+
case 3:
|
|
35
|
+
signature = _c.sent();
|
|
36
|
+
console.log('signature', signature);
|
|
44
37
|
return [2 /*return*/, signature];
|
|
45
38
|
}
|
|
46
39
|
});
|
|
47
40
|
}); }, [connection, wallet]);
|
|
41
|
+
function getTransaction(data) {
|
|
42
|
+
if (!web3)
|
|
43
|
+
throw new Error('web3 is not defined. Please install @solana/web3.js into your project');
|
|
44
|
+
var parsedUInt8Array = bs58_1.default.decode(data);
|
|
45
|
+
var vtx = web3.VersionedTransaction.deserialize(parsedUInt8Array);
|
|
46
|
+
if (vtx.version === 'legacy')
|
|
47
|
+
return web3.Transaction.from(parsedUInt8Array);
|
|
48
|
+
return vtx;
|
|
49
|
+
}
|
|
50
|
+
function partiallySign(signer, tx) {
|
|
51
|
+
if (tx instanceof web3.Transaction) {
|
|
52
|
+
var requiredSignatures = tx.signatures.map(function (sig) {
|
|
53
|
+
return sig.publicKey.toString();
|
|
54
|
+
});
|
|
55
|
+
var shouldSign_1 = requiredSignatures.includes(signer.publicKey.toString());
|
|
56
|
+
if (shouldSign_1)
|
|
57
|
+
tx.partialSign(signer);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// Will this work??
|
|
61
|
+
var signerPubkeys = tx.message.staticAccountKeys
|
|
62
|
+
.slice(0, tx.message.header.numRequiredSignatures)
|
|
63
|
+
.map(function (pk) { return pk.toString(); });
|
|
64
|
+
var shouldSign = signerPubkeys.includes(signer.publicKey.toString());
|
|
65
|
+
if (shouldSign)
|
|
66
|
+
tx.sign([signer]);
|
|
67
|
+
}
|
|
48
68
|
var handleSendTransaction = (0, react_1.useCallback)(function (_a) {
|
|
49
69
|
var data = _a.data;
|
|
50
70
|
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
51
|
-
|
|
52
|
-
var parsedUInt8Array = bs58_1["default"].decode(data);
|
|
53
|
-
var vtx = web3_js_1.VersionedTransaction.deserialize(parsedUInt8Array);
|
|
54
|
-
if (vtx.version === 'legacy')
|
|
55
|
-
return web3_js_1.Transaction.from(parsedUInt8Array);
|
|
56
|
-
return vtx;
|
|
57
|
-
}
|
|
58
|
-
var tx, partiallySign, signature;
|
|
71
|
+
var tx;
|
|
59
72
|
return tslib_1.__generator(this, function (_b) {
|
|
60
73
|
switch (_b.label) {
|
|
61
74
|
case 0:
|
|
62
|
-
tx = getTransaction();
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var requiredSignatures = tx.signatures.map(function (sig) {
|
|
66
|
-
return sig.publicKey.toString();
|
|
67
|
-
});
|
|
68
|
-
var shouldSign_1 = requiredSignatures.includes(signer.publicKey.toString());
|
|
69
|
-
if (shouldSign_1)
|
|
70
|
-
tx.partialSign(signer);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
var signerPubkeys = tx.message.staticAccountKeys
|
|
74
|
-
.slice(0, tx.message.header.numRequiredSignatures)
|
|
75
|
-
.map(function (pk) { return pk.toString(); });
|
|
76
|
-
var shouldSign = signerPubkeys.includes(signer.publicKey.toString());
|
|
77
|
-
if (shouldSign)
|
|
78
|
-
tx.sign([signer]);
|
|
79
|
-
return;
|
|
80
|
-
};
|
|
81
|
-
if (partialSigners) {
|
|
82
|
-
partialSigners.forEach(partiallySign);
|
|
83
|
-
}
|
|
75
|
+
tx = getTransaction(data);
|
|
76
|
+
if (partialSigners)
|
|
77
|
+
partialSigners.forEach(function (signer) { return partiallySign(signer, tx); });
|
|
84
78
|
if (!debugTx) return [3 /*break*/, 2];
|
|
85
79
|
return [4 /*yield*/, sendTransactionDebug(tx)];
|
|
86
80
|
case 1: return [2 /*return*/, _b.sent()];
|
|
87
81
|
case 2: return [4 /*yield*/, wallet.sendTransaction(tx, connection)];
|
|
88
|
-
case 3:
|
|
89
|
-
signature = _b.sent();
|
|
90
|
-
return [2 /*return*/, signature];
|
|
82
|
+
case 3: return [2 /*return*/, _b.sent()];
|
|
91
83
|
}
|
|
92
84
|
});
|
|
93
85
|
});
|
|
@@ -95,31 +87,23 @@ function useSolanaIFrameMessageHandlers(_a) {
|
|
|
95
87
|
var handleSignTransaction = (0, react_1.useCallback)(function (_a) {
|
|
96
88
|
var data = _a.data;
|
|
97
89
|
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
98
|
-
var tx,
|
|
90
|
+
var tx, signedTransaction;
|
|
99
91
|
return tslib_1.__generator(this, function (_b) {
|
|
100
92
|
switch (_b.label) {
|
|
101
93
|
case 0:
|
|
102
94
|
if (!wallet.signTransaction) {
|
|
103
95
|
throw new Error('signTransaction is not supported by this wallet');
|
|
104
96
|
}
|
|
105
|
-
tx =
|
|
106
|
-
partiallySign = function (signer) {
|
|
107
|
-
var requiredSignatures = tx.signatures.map(function (sig) {
|
|
108
|
-
return sig.publicKey.toString();
|
|
109
|
-
});
|
|
110
|
-
var shouldSign = requiredSignatures.includes(signer.publicKey.toString());
|
|
111
|
-
if (shouldSign)
|
|
112
|
-
tx.partialSign(signer);
|
|
113
|
-
};
|
|
97
|
+
tx = getTransaction(data);
|
|
114
98
|
if (partialSigners) {
|
|
115
|
-
partialSigners.forEach(partiallySign);
|
|
99
|
+
partialSigners.forEach(function (signer) { return partiallySign(signer, tx); });
|
|
116
100
|
}
|
|
117
101
|
return [4 /*yield*/, wallet.signTransaction(tx)];
|
|
118
102
|
case 1:
|
|
119
103
|
signedTransaction = _b.sent();
|
|
120
|
-
return [2 /*return*/, bs58_1
|
|
104
|
+
return [2 /*return*/, bs58_1.default.encode(signedTransaction.serialize({
|
|
121
105
|
requireAllSignatures: false,
|
|
122
|
-
verifySignatures: false
|
|
106
|
+
verifySignatures: false,
|
|
123
107
|
}))];
|
|
124
108
|
}
|
|
125
109
|
});
|
|
@@ -128,7 +112,6 @@ function useSolanaIFrameMessageHandlers(_a) {
|
|
|
128
112
|
return {
|
|
129
113
|
handleSignTransaction: handleSignTransaction,
|
|
130
114
|
handleSendTransaction: handleSendTransaction,
|
|
131
|
-
handleSignMessage: handleSignMessage
|
|
132
115
|
};
|
|
133
116
|
}
|
|
134
117
|
exports.useSolanaIFrameMessageHandlers = useSolanaIFrameMessageHandlers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolanaIFrameMessageHandlers.js","sourceRoot":"","sources":["../../src/SolanaIFrameMessageHandlers.ts"],"names":[],"mappings":";;;;AAAA,+BAAkC;AAClC,sDAA0B;
|
|
1
|
+
{"version":3,"file":"SolanaIFrameMessageHandlers.js","sourceRoot":"","sources":["../../src/SolanaIFrameMessageHandlers.ts"],"names":[],"mappings":";;;;AAAA,+BAAkC;AAClC,sDAA0B;AAE1B,4DAAwC;AAkBxC,SAAgB,8BAA8B,CAAC,EAKrB;IAL1B,iBAkGC;QAjGC,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,cAAc,oBAAA,EACd,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA;IAEf,IAAM,oBAAoB,GAAG,IAAA,mBAAW,EACtC,UAAO,EAAgD;;;;;;oBACrD,IAAI,CAAC,MAAM,CAAC,eAAe;wBACzB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;oBAE7C,qBAAM,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,EAAA;;oBAA3C,QAAQ,GAAG,SAAgC;oBAC3C,YAAY,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;oBACZ,qBAAM,UAAU,CAAC,mBAAmB,CAAC,QAA4B,CAA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CAAC,MAAM,CAAC,eAAe,EAAE;4BAC3B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;yBACpE;wBAEK,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;wBAChC,IAAI,cAAc,EAAE;4BAClB,cAAc,CAAC,OAAO,CAAC,UAAA,MAAM,IAAI,OAAA,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,EAAzB,CAAyB,CAAC,CAAC;yBAC7D;wBAEyB,qBAAM,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,EAAA;;wBAApD,iBAAiB,GAAG,SAAgC;wBAC1D,sBAAO,cAAM,CAAC,MAAM,CAClB,iBAAiB,CAAC,SAAS,CAAC;gCAC1B,oBAAoB,EAAE,KAAK;gCAC3B,gBAAgB,EAAE,KAAK;6BACxB,CAAC,CACH,EAAC;;;;KACH,EACD,CAAC,cAAc,EAAE,MAAM,CAAC,CACzB,CAAC;IAEF,OAAO;QACL,qBAAqB,uBAAA;QACrB,qBAAqB,uBAAA;KACtB,CAAC;AACJ,CAAC;AAlGD,wEAkGC"}
|
package/build/cjs/index.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
import { IFrameMessageHandlers } from './SolanaIFrameMessageHandlers';
|
|
3
3
|
export type OnSuccessMethod = (params: string) => void | Promise<void>;
|
|
4
4
|
export declare function useIframeWallet({ handleSignTransaction, handleSendTransaction, handleSignMessage, }: IFrameMessageHandlers, onSuccess?: OnSuccessMethod): {
|
|
5
|
-
IFrameRef: import("react").
|
|
5
|
+
IFrameRef: import("react").MutableRefObject<HTMLIFrameElement | null>;
|
|
6
6
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useIframeWallet = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = require("react");
|
|
@@ -8,15 +8,15 @@ function useIframeWallet(_a, onSuccess) {
|
|
|
8
8
|
var handleSignTransaction = _a.handleSignTransaction, handleSendTransaction = _a.handleSendTransaction, handleSignMessage = _a.handleSignMessage;
|
|
9
9
|
var IFrameRef = (0, react_1.useRef)(null);
|
|
10
10
|
var sendIFrameMessage = (0, react_1.useCallback)(function (message) {
|
|
11
|
-
var _a;
|
|
11
|
+
var _a, _b;
|
|
12
12
|
if (!((_a = IFrameRef === null || IFrameRef === void 0 ? void 0 : IFrameRef.current) === null || _a === void 0 ? void 0 : _a.contentWindow))
|
|
13
13
|
throw new Error('Iframe not defined');
|
|
14
|
-
IFrameRef.current.contentWindow.postMessage(message, '*');
|
|
14
|
+
(_b = IFrameRef.current) === null || _b === void 0 ? void 0 : _b.contentWindow.postMessage(message, '*');
|
|
15
15
|
}, [IFrameRef]);
|
|
16
16
|
var handleIframeMessages = (0, react_1.useCallback)(function (_a) {
|
|
17
17
|
var data = _a.data;
|
|
18
18
|
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
19
|
-
var parsedData, _b,
|
|
19
|
+
var parsedData, _b, signature, signedTransaction, signedMessage, e_1, message;
|
|
20
20
|
return tslib_1.__generator(this, function (_c) {
|
|
21
21
|
switch (_c.label) {
|
|
22
22
|
case 0:
|
|
@@ -26,40 +26,43 @@ function useIframeWallet(_a, onSuccess) {
|
|
|
26
26
|
return [2 /*return*/];
|
|
27
27
|
_b = parsedData.method;
|
|
28
28
|
switch (_b) {
|
|
29
|
-
case '
|
|
30
|
-
case '
|
|
31
|
-
case '
|
|
32
|
-
case '
|
|
29
|
+
case 'sendTransaction': return [3 /*break*/, 1];
|
|
30
|
+
case 'success': return [3 /*break*/, 3];
|
|
31
|
+
case 'signTransaction': return [3 /*break*/, 4];
|
|
32
|
+
case 'signMessage': return [3 /*break*/, 6];
|
|
33
33
|
}
|
|
34
34
|
return [3 /*break*/, 8];
|
|
35
|
-
case 1: return [4 /*yield*/,
|
|
35
|
+
case 1: return [4 /*yield*/, handleSendTransaction(parsedData)];
|
|
36
36
|
case 2:
|
|
37
|
-
message = _c.sent();
|
|
38
|
-
sendIFrameMessage(message);
|
|
39
|
-
return [3 /*break*/, 9];
|
|
40
|
-
case 3: return [4 /*yield*/, handleSendTransaction(parsedData)];
|
|
41
|
-
case 4:
|
|
42
37
|
signature = _c.sent();
|
|
43
38
|
sendIFrameMessage(signature);
|
|
44
39
|
return [3 /*break*/, 9];
|
|
45
|
-
case
|
|
40
|
+
case 3:
|
|
46
41
|
{
|
|
47
42
|
if (onSuccess)
|
|
48
43
|
onSuccess(data);
|
|
49
44
|
return [3 /*break*/, 9];
|
|
50
45
|
}
|
|
51
|
-
_c.label =
|
|
52
|
-
case
|
|
46
|
+
_c.label = 4;
|
|
47
|
+
case 4:
|
|
53
48
|
if (!handleSignTransaction)
|
|
54
49
|
throw new Error("This wallet does not support method ".concat(parsedData.method));
|
|
55
50
|
return [4 /*yield*/, handleSignTransaction(parsedData)];
|
|
56
|
-
case
|
|
51
|
+
case 5:
|
|
57
52
|
signedTransaction = _c.sent();
|
|
58
53
|
sendIFrameMessage(signedTransaction);
|
|
59
54
|
return [3 /*break*/, 9];
|
|
55
|
+
case 6:
|
|
56
|
+
if (!handleSignMessage)
|
|
57
|
+
throw new Error("This wallet does not support method ".concat(parsedData.method));
|
|
58
|
+
return [4 /*yield*/, handleSignMessage(parsedData)];
|
|
59
|
+
case 7:
|
|
60
|
+
signedMessage = _c.sent();
|
|
61
|
+
sendIFrameMessage(signedMessage);
|
|
62
|
+
return [3 /*break*/, 9];
|
|
60
63
|
case 8:
|
|
61
64
|
{
|
|
62
|
-
throw new Error("Unsupported Wallet Method ".concat(parsedData.method, ", must be
|
|
65
|
+
throw new Error("Unsupported Wallet Method ".concat(parsedData.method, ", must be sendTransaction"));
|
|
63
66
|
}
|
|
64
67
|
_c.label = 9;
|
|
65
68
|
case 9: return [3 /*break*/, 11];
|
|
@@ -79,11 +82,11 @@ function useIframeWallet(_a, onSuccess) {
|
|
|
79
82
|
});
|
|
80
83
|
});
|
|
81
84
|
}, [
|
|
82
|
-
handleSignMessage,
|
|
83
85
|
handleSendTransaction,
|
|
86
|
+
sendIFrameMessage,
|
|
84
87
|
onSuccess,
|
|
85
88
|
handleSignTransaction,
|
|
86
|
-
|
|
89
|
+
handleSignMessage,
|
|
87
90
|
]);
|
|
88
91
|
(0, react_1.useEffect)(function () {
|
|
89
92
|
if (!window)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIframeWallet.js","sourceRoot":"","sources":["../../src/useIframeWallet.ts"],"names":[],"mappings":";;;;AAAA,+BAAqD;AAKrD,SAAgB,eAAe,CAC7B,EAIwB,EACxB,SAA2B;IAN7B,
|
|
1
|
+
{"version":3,"file":"useIframeWallet.js","sourceRoot":"","sources":["../../src/useIframeWallet.ts"],"names":[],"mappings":";;;;AAAA,+BAAqD;AAKrD,SAAgB,eAAe,CAC7B,EAIwB,EACxB,SAA2B;IAN7B,iBAuFC;QArFG,qBAAqB,2BAAA,EACrB,qBAAqB,2BAAA,EACrB,iBAAiB,uBAAA;IAInB,IAAM,SAAS,GAAG,IAAA,cAAM,EAA2B,IAAI,CAAC,CAAC;IAEzD,IAAM,iBAAiB,GAAG,IAAA,mBAAW,EACnC,UAAC,OAAe;;QACd,IAAI,CAAC,CAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,0CAAE,aAAa,CAAA;YACpC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAExC,MAAA,SAAS,CAAC,OAAO,0CAAE,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,IAAM,oBAAoB,GAAG,IAAA,mBAAW,EACtC,UAAO,EAAsB;YAArB,IAAI,UAAA;;;;;;;wBAEJ,UAAU,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;wBACjC,IAAI,CAAC,UAAU;4BAAE,sB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CAAC,CAAC;yBACvC;wBAAC,OAAO,CAAC,EAAE;4BACV,iBAAiB,CAAC,0BAA0B,CAAC,CAAC;yBAC/C;;;;;;KAEJ,EACD;QACE,qBAAqB;QACrB,iBAAiB;QACjB,SAAS;QACT,qBAAqB;QACrB,iBAAiB;KAClB,CACF,CAAC;IAEF,IAAA,iBAAS,EAAC;QACR,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACnD,MAAM,CAAC,SAAS,GAAG,oBAAoB,CAAC;IAC1C,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAE3B,OAAO,EAAC,SAAS,WAAA,EAAC,CAAC;AACrB,CAAC;AAvFD,0CAuFC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI;QACF,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QAC3B,OAAO,GAAG,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,IAAI,CAAC;KACb;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CoinflowBlockchain, CoinflowEnvs } from './CoinflowUtils';
|
|
3
|
+
import type { PublicKey } from '@solana/web3.js';
|
|
3
4
|
interface CoinflowIFrameProps {
|
|
4
5
|
walletPubkey: string;
|
|
5
6
|
IFrameRef: React.RefObject<HTMLIFrameElement>;
|
|
@@ -8,10 +9,11 @@ interface CoinflowIFrameProps {
|
|
|
8
9
|
transaction?: string;
|
|
9
10
|
blockchain: CoinflowBlockchain;
|
|
10
11
|
webhookInfo?: object;
|
|
11
|
-
token?: string;
|
|
12
|
+
token?: string | PublicKey;
|
|
12
13
|
email?: string;
|
|
13
14
|
env?: CoinflowEnvs;
|
|
14
15
|
loaderBackground?: string;
|
|
16
|
+
supportsVersionedTransactions?: boolean;
|
|
15
17
|
}
|
|
16
|
-
export declare function CoinflowIFrame({ walletPubkey, IFrameRef, env, route, transaction, amount, blockchain, webhookInfo, token, email, loaderBackground, }: CoinflowIFrameProps): JSX.Element;
|
|
18
|
+
export declare function CoinflowIFrame({ walletPubkey, IFrameRef, env, route, transaction, amount, blockchain, webhookInfo, token, email, loaderBackground, supportsVersionedTransactions }: CoinflowIFrameProps): JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { CoinflowUtils } from './CoinflowUtils';
|
|
3
3
|
export function CoinflowIFrame(_a) {
|
|
4
|
-
var walletPubkey = _a.walletPubkey, IFrameRef = _a.IFrameRef, env = _a.env, route = _a.route, transaction = _a.transaction, amount = _a.amount, blockchain = _a.blockchain, webhookInfo = _a.webhookInfo, token = _a.token, email = _a.email, loaderBackground = _a.loaderBackground;
|
|
4
|
+
var walletPubkey = _a.walletPubkey, IFrameRef = _a.IFrameRef, env = _a.env, route = _a.route, transaction = _a.transaction, amount = _a.amount, blockchain = _a.blockchain, webhookInfo = _a.webhookInfo, token = _a.token, email = _a.email, loaderBackground = _a.loaderBackground, supportsVersionedTransactions = _a.supportsVersionedTransactions;
|
|
5
5
|
var url = useMemo(function () {
|
|
6
6
|
return CoinflowUtils.getCoinflowUrl({
|
|
7
7
|
walletPubkey: walletPubkey,
|
|
@@ -11,22 +11,12 @@ export function CoinflowIFrame(_a) {
|
|
|
11
11
|
transaction: transaction,
|
|
12
12
|
blockchain: blockchain,
|
|
13
13
|
webhookInfo: webhookInfo,
|
|
14
|
-
token: token,
|
|
14
|
+
token: token === null || token === void 0 ? void 0 : token.toString(),
|
|
15
15
|
email: email,
|
|
16
|
-
loaderBackground: loaderBackground
|
|
16
|
+
loaderBackground: loaderBackground,
|
|
17
|
+
supportsVersionedTransactions: supportsVersionedTransactions
|
|
17
18
|
});
|
|
18
|
-
}, [
|
|
19
|
-
loaderBackground,
|
|
20
|
-
walletPubkey,
|
|
21
|
-
amount,
|
|
22
|
-
env,
|
|
23
|
-
route,
|
|
24
|
-
transaction,
|
|
25
|
-
blockchain,
|
|
26
|
-
webhookInfo,
|
|
27
|
-
token,
|
|
28
|
-
email,
|
|
29
|
-
]);
|
|
19
|
+
}, [walletPubkey, amount, env, route, transaction, blockchain, webhookInfo, token, email, loaderBackground, supportsVersionedTransactions]);
|
|
30
20
|
return useMemo(function () { return (React.createElement("iframe", { onLoad: function () {
|
|
31
21
|
if (IFrameRef.current)
|
|
32
22
|
IFrameRef.current.style.opacity = '1';
|
|
@@ -34,7 +24,7 @@ export function CoinflowIFrame(_a) {
|
|
|
34
24
|
width: '100%',
|
|
35
25
|
height: '100%',
|
|
36
26
|
opacity: 0,
|
|
37
|
-
transition: 'opacity 300ms linear'
|
|
27
|
+
transition: 'opacity 300ms linear',
|
|
38
28
|
}, title: "withdraw", frameBorder: "0", src: url })); }, [IFrameRef, url]);
|
|
39
29
|
}
|
|
40
30
|
//# sourceMappingURL=CoinflowIFrame.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowIFrame.js","sourceRoot":"","sources":["../../src/CoinflowIFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAmC,aAAa,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"CoinflowIFrame.js","sourceRoot":"","sources":["../../src/CoinflowIFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAmC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAkBhF,MAAM,UAAU,cAAc,CAAC,EAaT;QAZpB,YAAY,kBAAA,EACZ,SAAS,eAAA,EACT,GAAG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